fix(workspace): make file import a compact icon action

Place the import icon after New File and retain destination tooltips, accessible labels, and disabled state while importing.

Validation: WorkspaceFilesPanel tests passed (41 tests).

Release note: Replace the prominent file import button with a compact icon beside New File.
This commit is contained in:
mesalogo
2026-10-04 20:57:40 +08:00
parent e205e90993
commit 49fd0d3054
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -600,9 +600,9 @@ export function WorkspaceFilesPanel({
<button ref={refreshRef} className="icon-button" type="button" disabled={refreshing} aria-label={t('sidebar.workspace.refreshAriaLabel')} title={t('sidebar.workspace.refresh')} onClick={() => void refresh()}><RefreshCw size={14} aria-hidden="true" /></button>
</div>
{activeView === 'files' && root && <div className="workspace-files__toolbar workspace-files__actions">
<button className="secondary-button" type="button" disabled={importing} onClick={() => void importFiles()}><Upload size={14} aria-hidden="true" />{t(importing ? 'management.importing' : 'management.importFiles')}</button>
<span className="workspace-files__destination" title={createTarget || '/'}>{t('management.importTarget', { path: createTarget || '/' })}</span>
<button className="icon-button" type="button" aria-label={t('management.createFile')} title={`${t('management.createFile')}: ${createTarget || '/'}`} onClick={() => setDialog({ kind: 'createFile', path: createTarget })}><FilePlus size={14} aria-hidden="true" /></button>
<button className="icon-button" type="button" disabled={importing} aria-label={t(importing ? 'management.importing' : 'management.importFiles')} title={`${t(importing ? 'management.importing' : 'management.importFiles')}: ${createTarget || '/'}`} onClick={() => void importFiles()}><Upload size={14} aria-hidden="true" /></button>
<button className="icon-button" type="button" aria-label={t('management.createDirectory')} title={`${t('management.createDirectory')}: ${createTarget || '/'}`} onClick={() => setDialog({ kind: 'createDirectory', path: createTarget })}><FolderPlus size={14} aria-hidden="true" /></button>
</div>}
{activeView === 'files' && browsedPath && <nav className="workspace-files__breadcrumbs" aria-label={t('management.path')}>