Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion web/src/features/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ export function Overview(actions: OverviewActions) {
<div className="directory-toolbar"><nav className="breadcrumbs" aria-label="资料目录路径">{folder ? <button className="up-button" aria-label="返回上级目录" onClick={() => actions.onFolder(folder.parent_id ?? null)}><ArrowUp size={18} /></button> : null}<button onClick={() => actions.onFolder(null)}>全部资料</button>{[...ancestors, ...(folder ? [folder] : [])].map((entry, index, all) => <span key={entry.id}><ChevronRight size={16} />{index === all.length - 1 ? <strong aria-current="location">{entry.name}</strong> : <button onClick={() => actions.onFolder(entry.id)}>{entry.name}</button>}</span>)}</nav>
{showingRecords ? null : <div className="toolbar explorer-toolbar"><div className="directory-search"><select aria-label="搜索范围" value={searchScope} onChange={event => { setSearchScope(event.target.value as DirectorySearchScope); setSelected([]); }}><option value="current">当前目录</option><option value="all">全部资料</option></select><label className="search-field"><Search size={19} /><input aria-label={searchScope === 'all' ? '搜索全部资料' : '搜索当前目录'} placeholder={searchScope === 'all' ? '搜索全部资料' : '搜索当前目录'} value={keyword} onChange={event => { setKeyword(event.target.value); setSelected([]); }} /></label></div><select aria-label="目录排序" value={sort} onChange={e => { cancelDrag(); setSort(e.target.value as DirectorySort); }}><option value="manual">手动排序</option><option value="name-asc">名称升序</option><option value="name-desc">名称降序</option><option value="newest">最新备份优先</option><option value="oldest">最久未备份优先</option></select></div>}</div>
{orderError ? <div className="connection-error" role="alert"><span>{orderError}</span><button className="button secondary compact" disabled={pending} onClick={()=>void actions.onRefresh().then(()=>setOrderError(''))}>刷新目录</button></div> : null}
{showingRecords ? <AssetDetail asset={folder} state={state} onEditRecords={() => actions.onEditRecords(folder.id)} onAddRecord={() => actions.onAddRecord(folder.id)} /> : <div className="surface explorer-surface" aria-busy={pending}>{!rows.length ? keyword ? <EmptyState title={searchingAll ? '没有匹配的资料' : '当前目录没有匹配的资料'} action={<button className="text-button" onClick={() => { setKeyword(''); setSelected([]); }}>清除搜索</button>} /> : <EmptyState title={folder ? '暂无下级资料' : '暂无资料'} action={folder ? <div className="empty-actions"><button className="button secondary" onClick={() => actions.onDetail(folder.id)}>备份信息</button><button className="button primary" disabled={actions.marking} onClick={() => actions.onMark(folder)}>设为备份对象</button></div> : undefined} /> : <table className={`explorer-table${showBackupNotes ? ' with-backup-notes' : ''}`}><thead><tr><th>{actions.onBulk&&bulkSelecting?<label className="directory-select-all"><input type="checkbox" aria-label={searchingAll ? '全选搜索结果备份资料' : '全选当前目录备份资料'} checked={allSelected} disabled={!selectableIds.length||pending} ref={node=>{if(node)node.indeterminate=selectedVisible.length>0&&!allSelected;}} onChange={()=>setSelected(current=>allSelected?current.filter(id=>!selectableIds.includes(id)):[...new Set([...current,...selectableIds])])}/><span>名称</span></label>:'名称'}</th><th>最新备份</th>{showBackupNotes ? <th>备份说明</th> : null}<th>操作</th></tr></thead><tbody>{rows.map(({asset, leaf, latest}) => {
{showingRecords ? <AssetDetail asset={folder} state={state} onEditRecords={() => actions.onEditRecords(folder.id)} onAddRecord={() => actions.onAddRecord(folder.id)} /> : <div className="surface explorer-surface" aria-busy={pending}>{!rows.length ? keyword ? <EmptyState title={searchingAll ? '没有匹配的资料' : '当前目录没有匹配的资料'} action={<button className="text-button" onClick={() => { setKeyword(''); setSelected([]); }}>清除搜索</button>} /> : <EmptyState title={folder ? '暂无下级资料' : '暂无资料'} action={folder ? <div className="empty-actions"><button className="button secondary" onClick={() => actions.onDetail(folder.id)}>备份信息</button><button className="button primary" disabled={actions.marking} onClick={() => actions.onMark(folder)}>设为备份对象</button></div> : undefined} /> : <table className={`explorer-table${showBackupNotes ? ' with-backup-notes' : ''}`}>
<colgroup>
<col className="directory-name-column" />
<col className="directory-time-column" />
{showBackupNotes ? <col className="directory-notes-column" /> : null}
<col className="directory-actions-column" />
</colgroup>
<thead><tr><th>{actions.onBulk&&bulkSelecting?<label className="directory-select-all"><input type="checkbox" aria-label={searchingAll ? '全选搜索结果备份资料' : '全选当前目录备份资料'} checked={allSelected} disabled={!selectableIds.length||pending} ref={node=>{if(node)node.indeterminate=selectedVisible.length>0&&!allSelected;}} onChange={()=>setSelected(current=>allSelected?current.filter(id=>!selectableIds.includes(id)):[...new Set([...current,...selectableIds])])}/><span>名称</span></label>:'名称'}</th><th>最新备份</th>{showBackupNotes ? <th>备份说明</th> : null}<th>操作</th></tr></thead><tbody>{rows.map(({asset, leaf, latest}) => {
const Icon = asset.kind === 'folder' ? Folder : File;
const marked = leaf && asset.backup_target === true;
const index=siblings.findIndex(entry=>entry.id===asset.id);
Expand Down
26 changes: 12 additions & 14 deletions web/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,10 @@ tbody tr:hover { background: #fcfdff; }
.explorer-table { table-layout: fixed; }
.explorer-table th:first-child { border-radius: 12px 0 0 0; }
.explorer-table th:last-child { border-radius: 0 12px 0 0; }
.explorer-table th:nth-child(1) { width: 23%; }
.explorer-table th:nth-child(2) { width: 15%; }
.explorer-table th:nth-child(3) { width: 15%; }
.explorer-table th:nth-child(4) { width: 12%; }
.explorer-table th:nth-child(5) { width: 35%; }
.explorer-table td { padding: 16px; height: 66px; }
.explorer-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.explorer-identity > svg { width: 28px; height: 28px; flex-shrink: 0; }
.explorer-identity > div { min-width: 0; }
.explorer-identity > div { flex: 1; min-width: 0; }
.folder-icon { color: #74aaff; fill: #8bbbff; stroke-width: 1.25; }
.file-icon { color: #869bbb; }
.asset-name { display: block; border: 0; background: transparent; text-align: left; color: #172b4d; font-weight: 500; font-size: 14px; padding: 0; overflow-wrap: anywhere; }
Expand Down Expand Up @@ -222,9 +217,6 @@ tbody tr:hover { background: #fcfdff; }
.directory-toolbar { flex-wrap: wrap; }
.explorer-toolbar { width: 100%; }
.explorer-toolbar .search-field { flex: 1; }
.explorer-table th:nth-child(1) { width: 22%; }
.explorer-table th:nth-child(2), .explorer-table th:nth-child(3) { width: 15%; }
.explorer-table th:nth-child(4) { width: 13%; }
}
@media (max-width: 1000px) {
.app-shell { display: block; }
Expand All @@ -249,13 +241,16 @@ tbody tr:hover { background: #fcfdff; }
.explorer-toolbar select { width: 100%; }
.explorer-table, .explorer-table tbody { display: block; width: 100%; min-width: 0; }
.explorer-table thead { display: none; }
.explorer-table colgroup { display: none; }
.explorer-table tr { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.explorer-table tr:last-child { border-bottom: 0; }
.explorer-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border: 0; font-size: 12px; height: auto; overflow-wrap: anywhere; }
.explorer-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: 0 0 64px; }
.explorer-table td:first-child { padding: 2px 0 13px; }
.explorer-table td:first-child { padding: 2px 0 10px; }
.explorer-table td:first-child::before { content: none; }
.explorer-identity { width: 100%; gap: 12px; }
.explorer-identity { width: 100%; gap: 8px; }
.explorer-table time { white-space: nowrap; }
.explorer-table .directory-backup-notes { flex: 1; text-align: right; }
.explorer-actions { justify-content: flex-end; gap: 8px; }
.explorer-actions .text-button { font-size: 12px; }
.due-actions { justify-content: flex-end; }
Expand Down Expand Up @@ -296,10 +291,13 @@ tbody tr:hover { background: #fcfdff; }
.action-menu-options button.danger { color: #ba3a3a; }
.drag-handle { border: 0; background: transparent; color: #8f9bad; padding: 3px; display: flex; flex-shrink: 0; cursor: grab; }
.drag-handle:disabled { opacity: .3; cursor: default; }
.explorer-table th:nth-child(1), .explorer-table th:nth-child(2), .explorer-table th:nth-child(3) { width: 33.333333%; }
.explorer-table.with-backup-notes th:nth-child(1), .explorer-table.with-backup-notes th:nth-child(2), .explorer-table.with-backup-notes th:nth-child(3), .explorer-table.with-backup-notes th:nth-child(4) { width: 25%; }
.explorer-table .directory-time-column { width: 160px; }
.explorer-table .directory-actions-column { width: 88px; }
.explorer-table.with-backup-notes .directory-name-column { width: 52%; }
.directory-backup-notes { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.explorer-table td { height: 58px; }
@media (min-width: 1001px) {
.explorer-table td { height: 58px; }
}
.record-table-scroll { margin-top: 12px; }
.record-detail-table { min-width: 0; table-layout: fixed; width: 100%; }
.record-detail-table th { width: 33.333333%; }
Expand Down