feat(web): SVG 图标集替换 Unicode —— tsk_3uhHOGU0qzj0
用 design/assets/icons/ 的 15 个双色 SVG 图标替换现网纯 Unicode 图标: • 拷贝 design/assets/icons/*.svg → web/assets/icons/(15 个) • app.js 顶部新增 ICONS 对象 + icon() 内联 helper • index.html:徽章组(gate/ready/running/deps)、配置按钮(config)、 同步按钮(sync)、搜索输入框(search + filter-search-wrap 包装)、 清除筛选按钮(close)、「新建」/「新建任务」按钮(add) 各区块头加语义图标:project/task/gate/running/flow • app.js 模板字符串:⛓→deps、✕→close(任务行取消/预览关闭/归档关闭)、 依赖等待标签、ap-reason→reason SVG、分支显示→git、事件项 ev-type→event • style.css:新增 svg.icon 基础尺寸规则、filter-search-wrap 布局、 各语义上下文 --icon-accent 注入(暗/浅主题均用 CSS 变量自动适配)、 .ap-reason::before 移除 content:'↳' 改用 SVG • 品牌字符保留不动:▍▮→·— 及状态 CSS 圆点 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+33
-12
@@ -3,6 +3,27 @@
|
||||
════════════════════════════════════════════════════════════ */
|
||||
'use strict';
|
||||
|
||||
// ── SVG 图标集(v1.1 双色调,24×24,2px 圆头;currentColor=基础描边,--icon-accent=信号色) ──
|
||||
const ICONS = {
|
||||
task: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="4" width="16" height="16" rx="2.5"/><polyline points="8 12 11 15 16 9" stroke="var(--icon-accent,#5fdd7d)"/></svg>`,
|
||||
project: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 3h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"/></svg>`,
|
||||
gate: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3L22 21L2 21Z"/><line x1="12" y1="10" x2="12" y2="14" stroke="var(--icon-accent,#b88ef5)"/><line x1="12" y1="17.5" x2="12" y2="17.51" stroke="var(--icon-accent,#b88ef5)"/></svg>`,
|
||||
ready: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 4L19 12L7 20Z" stroke="var(--icon-accent,#5fdd7d)"/></svg>`,
|
||||
running: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="8"/><circle cx="12" cy="12" r="3" fill="var(--icon-accent,#59c8d8)" stroke="none"/></svg>`,
|
||||
sync: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5" stroke="var(--icon-accent,#5fdd7d)"/></svg>`,
|
||||
config: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="3" y1="6" x2="12" y2="6"/><circle cx="15" cy="6" r="2.5" stroke="var(--icon-accent,#5fdd7d)"/><line x1="18" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="5.5" y2="12"/><circle cx="9" cy="12" r="2.5" stroke="var(--icon-accent,#5fdd7d)"/><line x1="12.5" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="12.5" y2="18"/><circle cx="16" cy="18" r="2.5" stroke="var(--icon-accent,#5fdd7d)"/><line x1="19.5" y1="18" x2="21" y2="18"/></svg>`,
|
||||
search: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="10.5" cy="10.5" r="6.5"/><line x1="15.5" y1="15.5" x2="21" y2="21" stroke="var(--icon-accent,#5fdd7d)"/></svg>`,
|
||||
git: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9" stroke="var(--icon-accent,#5fdd7d)"/></svg>`,
|
||||
deps: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/><line x1="10" y1="10" x2="14" y2="14" stroke="var(--icon-accent,#f0b429)"/></svg>`,
|
||||
reason: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="5 4 5 14 18 14"/><polyline points="13 9 18 14 13 19" stroke="var(--icon-accent,#f0b429)"/></svg>`,
|
||||
event: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="2 12 7 12 10 5 14 19 17 12 22 12" stroke="var(--icon-accent,#59c8d8)"/></svg>`,
|
||||
flow: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" y1="12" x2="19" y2="12"/><polyline points="13 6 19 12 13 18" stroke="var(--icon-accent,#59c8d8)"/></svg>`,
|
||||
add: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="12" y1="4" x2="12" y2="20" stroke="var(--icon-accent,#5fdd7d)"/><line x1="4" y1="12" x2="20" y2="12" stroke="var(--icon-accent,#5fdd7d)"/></svg>`,
|
||||
close: `<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="5" y1="5" x2="19" y2="19"/><line x1="19" y1="5" x2="5" y2="19"/></svg>`,
|
||||
};
|
||||
/** 返回指定图标的内联 SVG HTML(name 不存在时返回空串) */
|
||||
function icon(name) { return ICONS[name] || ''; }
|
||||
|
||||
// ── 模型常量(与 src/model/status.ts / complexity.ts 对齐) ──
|
||||
const STATUS_LABEL = {
|
||||
init: '新建', analyzing: '分析拆解中', plan_review: '待确认拆解',
|
||||
@@ -461,7 +482,7 @@ function gateDocs(t) {
|
||||
blocks.push(reviewReportBlocks(r)); // CODE REVIEW + 安全审计 两节(各带 verdict 徽章),置于 DIFF 摘要上方
|
||||
blocks.push(`<div class="gate-doc-label">RESULT · 执行结果</div>
|
||||
<dl class="result-kv">
|
||||
${r.branch ? `<dt>分支</dt><dd>${esc(r.branch)}</dd>` : ''}
|
||||
${r.branch ? `<dt>${icon('git')} 分支</dt><dd>${esc(r.branch)}</dd>` : ''}
|
||||
${r.worktree ? `<dt>worktree</dt><dd>${esc(r.worktree)}</dd>` : ''}
|
||||
${r.prUrl ? `<dt>PR</dt><dd><a href="${esc(r.prUrl)}" target="_blank">${esc(r.prUrl)}</a></dd>` : ''}
|
||||
</dl>`);
|
||||
@@ -699,7 +720,7 @@ function renderArchiveModal(t, runs, events) {
|
||||
const resultBlock = r ? `${reviewReportBlocks(r)}
|
||||
<div class="gate-doc-label">执行结果</div>
|
||||
<dl class="result-kv">
|
||||
${r.branch ? kv('分支', esc(r.branch)) : ''}
|
||||
${r.branch ? kv(`${icon('git')} 分支`, esc(r.branch)) : ''}
|
||||
${r.worktree ? kv('worktree', esc(r.worktree)) : ''}
|
||||
${r.prUrl ? kv('合并', esc(r.prUrl)) : ''}
|
||||
${r.commits && r.commits.length ? kv('commits', r.commits.map(esc).join('<br>')) : ''}
|
||||
@@ -709,7 +730,7 @@ function renderArchiveModal(t, runs, events) {
|
||||
const approvalRows = t.approvals && t.approvals.length ? `<div class="gate-doc-label">审批记录</div>
|
||||
<dl class="result-kv">${t.approvals.map((a) => kv(
|
||||
`${GATE_LABEL[a.gate] || esc(a.gate)} · ${a.action === 'accept' ? '接受' : '驳回'}`,
|
||||
`审批人 ${esc(a.actor)} · ${fmtFull(a.at)}${a.reason ? `<br>意见:${esc(a.reason)}` : ''}`,
|
||||
`审批人 ${esc(a.actor)} · ${fmtFull(a.at)}${a.reason ? `<br>${icon('reason')} 意见:${esc(a.reason)}` : ''}`,
|
||||
)).join('')}</dl>` : '';
|
||||
|
||||
const timeline = events.length ? `<div class="gate-doc-label">状态流转时间线</div>
|
||||
@@ -739,7 +760,7 @@ function renderArchiveModal(t, runs, events) {
|
||||
${cplxBadge(t.complexity)}
|
||||
${statusChip(t.status)}
|
||||
<span class="spacer"></span>
|
||||
<button class="btn btn-ghost" data-action="archive-modal-close" title="关闭(Esc)">✕</button>
|
||||
<button class="btn btn-ghost" data-action="archive-modal-close" title="关闭(Esc)">${icon('close')}</button>
|
||||
</div>
|
||||
<div class="preview-body">
|
||||
${attrs}${docs}${runRows}${resultBlock}${approvalRows}${timeline}
|
||||
@@ -804,7 +825,7 @@ function renderPreview() {
|
||||
${cplxBadge(t.complexity)}
|
||||
${statusChip(t.status)}
|
||||
<span class="spacer"></span>
|
||||
<button class="btn btn-ghost" data-action="preview-close" title="关闭(Esc)">✕</button>
|
||||
<button class="btn btn-ghost" data-action="preview-close" title="关闭(Esc)">${icon('close')}</button>
|
||||
</div>
|
||||
<div class="preview-body">${gateDocs(t)}</div>
|
||||
<div class="preview-foot">
|
||||
@@ -1008,12 +1029,12 @@ function renderTree() {
|
||||
if (t.status !== 'blocked' || !(t.deps || []).length) return '';
|
||||
const unmet = t.deps.filter((d) => byId.get(d)?.status !== 'done');
|
||||
if (!unmet.length) return '';
|
||||
return `<span class="t-deps-wait" title="等待依赖完成:${unmet.map((d) => esc(byId.get(d)?.title || d)).join('、')}">⛓ 等依赖 ${unmet.length}</span>`;
|
||||
return `<span class="t-deps-wait" title="等待依赖完成:${unmet.map((d) => esc(byId.get(d)?.title || d)).join('、')}">${icon('deps')} 等依赖 ${unmet.length}</span>`;
|
||||
})()}
|
||||
<span class="t-prio ${t.priority === 0 ? 'hot' : ''}">P${t.priority}</span>
|
||||
${cplxBadge(t.complexity, t.id)}
|
||||
${statusChip(t.status)}
|
||||
${!ARCHIVED.has(t.status) ? `<button class="btn btn-ghost btn-xs task-row-cancel" data-action="row-cancel" data-id="${esc(t.id)}" title="取消任务(进入归档)">✕</button>` : ''}
|
||||
${!ARCHIVED.has(t.status) ? `<button class="btn btn-ghost btn-xs task-row-cancel" data-action="row-cancel" data-id="${esc(t.id)}" title="取消任务(进入归档)">${icon('close')}</button>` : ''}
|
||||
<button class="btn btn-ghost btn-xs task-row-delete" data-action="row-delete" data-id="${esc(t.id)}" title="彻底删除任务(不可恢复)">🗑</button>
|
||||
</div>
|
||||
${expanded ? renderDetail(t) : ''}
|
||||
@@ -1054,7 +1075,7 @@ function renderDetail(t) {
|
||||
<div>${reviewReportBlocks(r)}
|
||||
<div class="detail-label">RESULT · 执行结果</div>
|
||||
<dl class="result-kv">
|
||||
<dt>分支</dt><dd>${esc(r.branch || '—')}</dd>
|
||||
<dt>${icon('git')} 分支</dt><dd>${esc(r.branch || '—')}</dd>
|
||||
<dt>worktree</dt><dd>${esc(r.worktree || '—')}</dd>
|
||||
${r.prUrl ? `<dt>合并</dt><dd>${esc(r.prUrl)}</dd>` : ''}
|
||||
${r.commits && r.commits.length ? `<dt>commits</dt><dd>${r.commits.map(esc).join('<br>')}</dd>` : ''}
|
||||
@@ -1072,7 +1093,7 @@ function renderDetail(t) {
|
||||
<span class="ap-act-${a.action}">${a.action === 'accept' ? '✓ 通过' : '✗ 驳回'}</span>
|
||||
<span class="ap-gate">${GATE_LABEL[a.gate] || esc(a.gate)} · ${esc(a.actor)}</span>
|
||||
<span class="ap-time">${fmtTime(a.at)}</span>
|
||||
${a.reason ? `<span class="ap-reason">${esc(a.reason)}</span>` : ''}
|
||||
${a.reason ? `<span class="ap-reason">${icon('reason')}<span>${esc(a.reason)}</span></span>` : ''}
|
||||
</div>`).join('')}
|
||||
</div>`);
|
||||
}
|
||||
@@ -1086,7 +1107,7 @@ function renderDetail(t) {
|
||||
const dt = S.tasks.find((x) => x.id === d);
|
||||
const ok = dt && dt.status === 'done';
|
||||
return `<div class="dep-item ${ok ? 'ok' : 'wait'}" data-action="goto-task" data-id="${esc(d)}" title="点击定位到该任务">
|
||||
<span class="dep-mark">${ok ? '✓' : '⛓'}</span>
|
||||
<span class="dep-mark">${ok ? '✓' : icon('deps')}</span>
|
||||
${dt ? statusChip(dt.status) : ''}
|
||||
<span class="dep-title">${esc(dt ? dt.title : d)}</span>
|
||||
<span class="t-id">${esc(d.slice(-6))}</span>
|
||||
@@ -1114,7 +1135,7 @@ function renderDetail(t) {
|
||||
<button class="btn btn-xs" data-action="task-cancel-abort" data-id="${esc(t.id)}">算了</button>
|
||||
</div>`;
|
||||
}
|
||||
return `<button class="btn btn-xs btn-reject" data-action="task-cancel" data-id="${esc(t.id)}" title="取消任务(进入 cancelled 状态,计入归档)">✕ 取消任务</button>`;
|
||||
return `<button class="btn btn-xs btn-reject" data-action="task-cancel" data-id="${esc(t.id)}" title="取消任务(进入 cancelled 状态,计入归档)">${icon('close')} 取消任务</button>`;
|
||||
})() : '';
|
||||
const deleteSection = (() => {
|
||||
if (S.confirmDelete === t.id) {
|
||||
@@ -1214,7 +1235,7 @@ function renderEvents() {
|
||||
ul.innerHTML = S.events.slice(0, 80).map((e) => `
|
||||
<li class="${EVENT_CLASS[e.type] || ''}">
|
||||
<div class="ev-head">
|
||||
<span class="ev-type">${EVENT_LABEL[e.type] || esc(e.type)}</span>
|
||||
<span class="ev-type">${icon('event')}${EVENT_LABEL[e.type] || esc(e.type)}</span>
|
||||
<span class="ev-time">${fmtTime(e.at)}</span>
|
||||
</div>
|
||||
<div class="ev-detail">${eventDetail(e)}</div>
|
||||
|
||||
Reference in New Issue
Block a user