feat(web): 来源与目录批量条按选中高亮并换用线性图标

为什么:「对内/对外/禁止导入」是三块实心色按钮挤在右上角,「已选 N 项」缩在
禁止导入下面;没选中时整条也一样抢眼,📁/📄 emoji 与工作台风格不协调。

改了什么(策略按钮的启用条件、调用与确认不变):
- 批量条:「全选当前页」后紧跟「已选 N 项」,策略按钮归入一组(role=group);
  只有选中后整条才浅钴蓝高亮。
- 策略按钮改为浅底语义色描边,与表格内策略徽标同色同形。
- 📁/📄 换成 CSS mask 线性图标;文件夹名改为深色正文、悬停变钴蓝。
- 表头/单元格字号统一(11→12.5px),行悬停底色;页头接入共享 .page-header。
- 删除重复的列宽规则与被后文覆盖的禁止导入样式(同一含义只留一份),
  目录区硬编码蓝/灰映射回令牌。

验证:typecheck、vitest 全量通过(App 用例按新 h1 标记更新);浏览器只读核对
勾选→高亮/已选 1 项、取消→恢复中性、文件格式筛选展开;未点击任何策略按钮。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
姚章浩
2026-11-16 17:09:43 +08:00
parent 060872a144
commit 10182b027e
3 changed files with 103 additions and 92 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ describe('App', () => {
expect(html).not.toContain('aria-label="已打开页面"') expect(html).not.toContain('aria-label="已打开页面"')
expect(html).not.toContain('class="tab-list"') expect(html).not.toContain('class="tab-list"')
expect(html).not.toContain('class="workspace-tab') expect(html).not.toContain('class="workspace-tab')
expect(html).toContain('<h1>来源与目录</h1>') expect(html).toContain('<h1 class="page-title">来源与目录</h1>')
expect(html).not.toContain('最近任务') expect(html).not.toContain('最近任务')
}) })
}) })
+15 -17
View File
@@ -174,10 +174,10 @@ export function SourceCatalogBrowserView({
refreshJob?.state === 'pending' || refreshJob?.state === 'running' || refreshJob?.state === 'retry' refreshJob?.state === 'pending' || refreshJob?.state === 'running' || refreshJob?.state === 'retry'
return ( return (
<main className="page-shell catalog-browser"> <main className="page-shell catalog-browser">
<header className="hero compact"> <header className="hero compact page-header">
<div> <div>
<h1>来源与目录</h1> <h1 className="page-title">来源与目录</h1>
<p className="subtitle">各个知识源头的资料总览与标注</p> <p className="subtitle page-subtitle">各个知识源头的资料总览与标注</p>
</div> </div>
<button onClick={onRefresh} disabled={loading || refreshActive}> <button onClick={onRefresh} disabled={loading || refreshActive}>
{refreshActive ? '实时刷新中…' : '实时刷新目录'} {refreshActive ? '实时刷新中…' : '实时刷新目录'}
@@ -343,7 +343,7 @@ export function SourceCatalogBrowserView({
</details> </details>
{visibleItems.length ? ( {visibleItems.length ? (
<section className="catalog-routing"> <section className={selectedCount ? 'catalog-routing has-selection' : 'catalog-routing'}>
<div className="routing-actions"> <div className="routing-actions">
<label className="routing-check"> <label className="routing-check">
<input <input
@@ -359,7 +359,8 @@ export function SourceCatalogBrowserView({
/> />
全选当前页 全选当前页
</label> </label>
<div className="catalog-policy-actions"> <small className="selected-count">已选 {selectedCount} 项</small>
<div className="catalog-policy-actions" role="group" aria-label="处理策略">
<button <button
className="internal-policy-button" className="internal-policy-button"
disabled={!routeReady || !selectedNodeIDs.length || !policyEnabled('internal')} disabled={!routeReady || !selectedNodeIDs.length || !policyEnabled('internal')}
@@ -374,16 +375,13 @@ export function SourceCatalogBrowserView({
> >
对外 对外
</button> </button>
<div className="blocked-policy-stack"> <button
<button className="blocked-policy-button"
className="blocked-policy-button" disabled={!routeReady || !selectedNodeIDs.length}
disabled={!routeReady || !selectedNodeIDs.length} onClick={() => void applyPolicy('blocked')}
onClick={() => void applyPolicy('blocked')} >
> 禁止导入
禁止导入 </button>
</button>
<small className="selected-count">已选 {selectedCount} 项</small>
</div>
</div> </div>
</div> </div>
{routingMessage ? <p role="status">{routingMessage}</p> : null} {routingMessage ? <p role="status">{routingMessage}</p> : null}
@@ -417,7 +415,7 @@ export function SourceCatalogBrowserView({
onChange={() => toggleNode(node.node_id)} onChange={() => toggleNode(node.node_id)}
/> />
<button className="catalog-name" onClick={() => onOpenFolder(node)}> <button className="catalog-name" onClick={() => onOpenFolder(node)}>
<span aria-hidden="true">📁</span> <span className="catalog-icon folder" aria-hidden="true" />
{node.name} {node.name}
</button> </button>
</div> </div>
@@ -429,7 +427,7 @@ export function SourceCatalogBrowserView({
checked={selectedIDs.includes(node.node_id)} checked={selectedIDs.includes(node.node_id)}
onChange={() => toggleNode(node.node_id)} onChange={() => toggleNode(node.node_id)}
/> />
<span aria-hidden="true">📄</span> <span className="catalog-icon file" aria-hidden="true" />
{node.name} {node.name}
</label> </label>
)} )}
+87 -74
View File
@@ -122,7 +122,7 @@
font-weight: 800; font-weight: 800;
} }
.catalog-tree-toggle:hover { .catalog-tree-toggle:hover {
background: #e9f4fb; background: var(--c-run-bg);
} }
.catalog-tree-name { .catalog-tree-name {
overflow: hidden; overflow: hidden;
@@ -167,7 +167,7 @@
} }
.catalog-breadcrumbs span:last-child button { .catalog-breadcrumbs span:last-child button {
border-radius: 6px; border-radius: 6px;
background: #eaf4fc; background: var(--c-run-bg);
color: var(--c-run); color: var(--c-run);
font-weight: 700; font-weight: 700;
} }
@@ -241,16 +241,21 @@
display: grid; display: grid;
gap: 9px; gap: 9px;
border-bottom: 1px solid var(--border-base); border-bottom: 1px solid var(--border-base);
padding: 11px 16px; padding: 10px 16px;
background: var(--bg-soft); background: var(--bg-panel);
} }
.routing-fields, .routing-fields {
.routing-actions {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: end; align-items: end;
gap: 9px; gap: 9px;
} }
.routing-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
}
.routing-fields label { .routing-fields label {
display: grid; display: grid;
gap: 4px; gap: 4px;
@@ -265,8 +270,7 @@
.routing-check { .routing-check {
display: flex !important; display: flex !important;
align-items: center; align-items: center;
gap: 5px; gap: 6px;
padding-bottom: 7px;
} }
.routing-actions span { .routing-actions span {
margin-right: auto; margin-right: auto;
@@ -274,7 +278,7 @@
font-size: 10px; font-size: 10px;
} }
.routing-actions button { .routing-actions button {
padding: 7px 9px; padding: 5px 12px;
} }
.catalog-routing p { .catalog-routing p {
margin: 0; margin: 0;
@@ -375,13 +379,20 @@
z-index: 2; z-index: 2;
top: 0; top: 0;
background: var(--bg-soft); background: var(--bg-soft);
color: var(--ink-mute);
font-weight: 500;
font-size: 11.5px;
letter-spacing: 0.02em;
} }
.catalog-table th, .catalog-table th,
.catalog-table td { .catalog-table td {
padding: 12px 10px; padding: 11px 12px;
white-space: normal; white-space: normal;
overflow-wrap: anywhere; overflow-wrap: anywhere;
font-size: 11px; font-size: 12.5px;
}
.catalog-table tbody tr:hover {
background: var(--bg-hover);
} }
.catalog-table th:nth-child(1) { .catalog-table th:nth-child(1) {
width: 32%; width: 32%;
@@ -404,17 +415,20 @@
.catalog-name { .catalog-name {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 7px; gap: 8px;
border: 0; border: 0;
padding: 0; padding: 0;
background: transparent; background: transparent;
box-shadow: none; box-shadow: none;
color: var(--c-run); color: var(--ink-strong);
font-weight: 500;
text-align: left; text-align: left;
line-height: 1.5; line-height: 1.5;
} }
.catalog-name:hover { .catalog-name:hover:not(:disabled) {
text-decoration: underline; border: 0;
background: transparent;
color: var(--c-run);
} }
.catalog-file { .catalog-file {
display: flex; display: flex;
@@ -597,32 +611,6 @@
color: var(--ink-mute); color: var(--ink-mute);
font-size: 9px; font-size: 9px;
} }
.catalog-table th:nth-child(1) {
width: 32%;
}
.catalog-table th:nth-child(2) {
width: 8%;
}
.catalog-table th:nth-child(3) {
width: 15%;
}
.catalog-table th:nth-child(4) {
width: 9%;
}
.catalog-table th:nth-child(5) {
width: 16%;
}
.catalog-table th:nth-child(6) {
width: 20%;
}
.routing-actions .blocked-policy-button {
border-color: var(--c-fail-border);
background: var(--c-fail-bg);
color: var(--c-fail);
}
.routing-actions .blocked-policy-button:hover:not(:disabled) {
background: var(--c-fail-bg);
}
.catalog-node-control { .catalog-node-control {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
@@ -632,29 +620,33 @@
margin-top: 4px; margin-top: 4px;
flex: 0 0 auto; flex: 0 0 auto;
} }
/* 策略按钮用浅底语义色:三种实心色块并排太抢眼,且与表格里的策略徽标同色同形,一眼对应 */
.routing-actions .internal-policy-button { .routing-actions .internal-policy-button {
border-color: var(--c-done); border-color: var(--c-done-border);
background: var(--c-done); background: var(--c-done-bg);
color: var(--bg-panel); color: var(--c-done);
}
.routing-actions .internal-policy-button:hover:not(:disabled) {
background: var(--c-done);
} }
.routing-actions .external-policy-button { .routing-actions .external-policy-button {
border-color: var(--c-warn); border-color: var(--c-warn-border);
background: var(--c-warn); background: var(--c-warn-bg);
color: var(--bg-panel); color: var(--c-warn);
}
.routing-actions .external-policy-button:hover:not(:disabled) {
background: var(--c-warn);
} }
.routing-actions .blocked-policy-button { .routing-actions .blocked-policy-button {
border-color: var(--c-fail); border-color: var(--c-fail-border);
background: var(--c-fail); background: var(--c-fail-bg);
color: var(--bg-panel); color: var(--c-fail);
}
.routing-actions .internal-policy-button:hover:not(:disabled) {
border-color: var(--c-done);
background: var(--c-done-bg);
}
.routing-actions .external-policy-button:hover:not(:disabled) {
border-color: var(--c-warn);
background: var(--c-warn-bg);
} }
.routing-actions .blocked-policy-button:hover:not(:disabled) { .routing-actions .blocked-policy-button:hover:not(:disabled) {
background: var(--c-fail); border-color: var(--c-fail);
background: var(--c-fail-bg);
} }
.catalog-policy-cell .scope-badge.internal { .catalog-policy-cell .scope-badge.internal {
background: var(--c-done-bg); background: var(--c-done-bg);
@@ -670,25 +662,46 @@
} }
.catalog-policy-actions { .catalog-policy-actions {
display: flex; display: flex;
align-items: flex-start; align-items: center;
gap: 8px; gap: 8px;
margin-left: auto; margin-left: auto;
} }
.blocked-policy-stack { .routing-actions .selected-count {
display: grid;
gap: 4px;
}
.blocked-policy-stack .selected-count {
margin: 0;
color: var(--ink-mute); color: var(--ink-mute);
font-size: 10px; font-size: 12px;
line-height: 1.2;
text-align: center;
white-space: nowrap; white-space: nowrap;
font-variant-numeric: tabular-nums;
}
/* 只有真的选中了才变成强调色,与解析监控的批量条同一规则 */
.catalog-routing.has-selection {
border-bottom-color: var(--c-run-border);
background: var(--c-run-bg);
}
.catalog-routing.has-selection .selected-count {
color: var(--c-run);
font-weight: 600;
}
.catalog-icon {
width: 16px;
height: 16px;
flex: none;
margin-top: 1px;
background: currentColor;
-webkit-mask: var(--icon) center / contain no-repeat;
mask: var(--icon) center / contain no-repeat;
}
.catalog-icon.folder {
color: var(--c-run);
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 4A1.5 1.5 0 0 1 3 2.5h3.1l1.6 1.6H13A1.5 1.5 0 0 1 14.5 5.6V12A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12z'/%3E%3C/svg%3E");
opacity: 0.85;
}
.catalog-icon.file {
color: var(--ink-faint);
--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 1.5h5l3.5 3.5v8A1.5 1.5 0 0 1 11 14.5H4A1.5 1.5 0 0 1 2.5 13V3A1.5 1.5 0 0 1 4 1.5zm4.5 1v3h3' fill='none' stroke='black' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E");
} }
.snapshot-history { .snapshot-history {
margin: 12px 0; margin: 12px 0;
border: 1px solid #d8e3f0; border: 1px solid var(--border-base);
border-radius: 10px; border-radius: 10px;
padding: 14px 16px; padding: 14px 16px;
background: var(--bg-soft); background: var(--bg-soft);
@@ -760,7 +773,7 @@
padding: 7px 12px; padding: 7px 12px;
border: 1px solid var(--c-run-border); border: 1px solid var(--c-run-border);
border-radius: 999px; border-radius: 999px;
background: #eef6fc; background: var(--c-run-bg);
color: var(--ink-base); color: var(--ink-base);
font: inherit; font: inherit;
font-size: 11px; font-size: 11px;
@@ -784,7 +797,7 @@
margin-left: auto; margin-left: auto;
border: 0; border: 0;
background: transparent; background: transparent;
color: #4c7d9e; color: var(--ink-mute);
font: inherit; font: inherit;
font-size: 11px; font-size: 11px;
text-decoration: underline; text-decoration: underline;
@@ -805,9 +818,9 @@
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
padding: 18px; padding: 18px;
border: 1px solid var(--border, #e3e8ec); border: 1px solid var(--border-base);
border-radius: 10px; border-radius: 10px;
background: var(--card, #fff); background: var(--bg-panel);
} }
.catalog-scanning-state > div { .catalog-scanning-state > div {
display: flex; display: flex;
@@ -818,7 +831,7 @@
font-size: 15px; font-size: 15px;
} }
.catalog-scanning-state span { .catalog-scanning-state span {
color: var(--muted-foreground, #5b6773); color: var(--ink-mute);
font-size: 13px; font-size: 13px;
} }
.catalog-scanning-state progress { .catalog-scanning-state progress {
@@ -830,6 +843,6 @@
font-size: 13px; font-size: 13px;
} }
.catalog-scanning-state small { .catalog-scanning-state small {
color: var(--muted-foreground, #5b6773); color: var(--ink-mute);
font-size: 12px; font-size: 12px;
} }