mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-17 14:01:58 +00:00
数据目录 F2b / C9:概览的进度条色段改成和上方文字同一个先后(有待确认项、没有待确认项、没有目录),下面加图例说明每种颜色;色条和图例只给眼睛看,数字由那句话念;补检查脚本的断言
This commit is contained in:
@@ -498,17 +498,34 @@ function Overview({ rows, empty, systemNotes, draft, onOpen }: {
|
||||
)
|
||||
}
|
||||
|
||||
/** 审阅进度:有待确认项 / 没有待确认项 / 没有目录的表各占多少 */
|
||||
function ProgressBar({ pending, done, none }: { pending: number; done: number; none: number }) {
|
||||
const total = pending + done + none || 1
|
||||
const seg = (n: number, color: string, label: string) => (n > 0
|
||||
? <span className="h-full" style={{ width: `${(n / total) * 100}%`, background: color }} title={`${label} ${n}`} />
|
||||
: null)
|
||||
/**
|
||||
* 审阅进度:有待确认项 / 没有待确认项 / 没有目录的表各占多少。色段的先后和上面那句话一致(有待确认项在前),
|
||||
* 下面挂图例说明每种颜色。数字已经写在那句话里,色条和图例只给眼睛看,读屏不重复念
|
||||
*/
|
||||
const PROGRESS: { key: 'pending' | 'done' | 'none'; color: string }[] = [
|
||||
{ key: 'pending', color: 'var(--st-waiting)' },
|
||||
{ key: 'done', color: 'var(--st-done)' },
|
||||
{ key: 'none', color: 'var(--border-strong)' },
|
||||
]
|
||||
|
||||
function ProgressBar(counts: { pending: number; done: number; none: number }) {
|
||||
const total = counts.pending + counts.done + counts.none || 1
|
||||
return (
|
||||
<div className="flex h-1.5 overflow-hidden rounded-full bg-hover" aria-hidden>
|
||||
{seg(done, 'var(--st-done)', CT.filter.done)}
|
||||
{seg(pending, 'var(--st-waiting)', CT.filter.pending)}
|
||||
{seg(none, 'var(--border-strong)', CT.filter.none)}
|
||||
<div aria-hidden>
|
||||
<div className="flex h-1.5 overflow-hidden rounded-full bg-hover" data-catalog-progress={PROGRESS.map((p) => p.key).join(',')}>
|
||||
{PROGRESS.map(({ key, color }) => (counts[key] > 0
|
||||
? <span key={key} className="h-full" style={{ width: `${(counts[key] / total) * 100}%`, background: color }}
|
||||
title={`${CT.filter[key]} ${counts[key]}`} data-progress-seg={key} />
|
||||
: null))}
|
||||
</div>
|
||||
<ul className="mt-1.5 flex flex-wrap gap-x-3 gap-y-1 text-2xs text-faint" data-catalog-progress-legend="">
|
||||
{PROGRESS.map(({ key, color }) => (
|
||||
<li key={key} className="inline-flex items-center gap-1.5" data-legend={key}>
|
||||
<span className="h-2 w-2 shrink-0 rounded-sm" style={{ background: color }} />
|
||||
{CT.filter[key]}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1174,6 +1174,18 @@ await section('数据目录 · 空状态与导入表格', async () => {
|
||||
const ovt = await page.locator('[data-catalog-overview]').innerText()
|
||||
check('有目录、没选表时:写审阅进度,给出使用最多、还有推断项的表', ovt.includes('共 152 张表:5 张有待确认项,3 张没有待确认项,144 张没有目录')
|
||||
&& (await page.locator('[data-catalog-review-next]').getAttribute('data-catalog-review-next')) === 'visits', ovt.replace(/\s+/g, ' ').slice(0, 120))
|
||||
// 进度条的色段和那句话同一个先后(有待确认项、没有待确认项、没有目录),下面有图例说明每种颜色
|
||||
const segs = await page.locator('[data-catalog-overview] [data-progress-seg]').evaluateAll((els) => els.map((e) => e.getAttribute('data-progress-seg')))
|
||||
const legend = await page.locator('[data-catalog-progress-legend] [data-legend]').evaluateAll((els) => els.map((e) => [e.getAttribute('data-legend'), e.innerText.trim()]))
|
||||
check('进度条的色段按「有待确认项、没有待确认项、没有目录」排,和文字的先后一致', segs.join(',') === 'pending,done,none', segs.join(','))
|
||||
check('……下面有图例,先后和文字一致', legend.map(([k]) => k).join(',') === 'pending,done,none'
|
||||
&& legend.map(([, t]) => t).join('|') === '有待确认项|没有待确认项|没有目录', JSON.stringify(legend))
|
||||
const swatch = await page.evaluate(() => [...document.querySelectorAll('[data-catalog-progress-legend] [data-legend]')].map((li) => {
|
||||
const key = li.getAttribute('data-legend')
|
||||
const seg = document.querySelector(`[data-progress-seg="${key}"]`)
|
||||
return getComputedStyle(li.querySelector('span')).backgroundColor === (seg ? getComputedStyle(seg).backgroundColor : '')
|
||||
}))
|
||||
check('……图例的色块和色段同色', swatch.length === 3 && swatch.every(Boolean), JSON.stringify(swatch))
|
||||
|
||||
// 导入表格的源:说明由系统生成,只读
|
||||
await goto(page, `/data/catalog/${S2}`)
|
||||
|
||||
Reference in New Issue
Block a user