🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(acceptance): split the record into checklist and files tabs, collapse the run ledger (#19172)
Arvin Xu51f3d9a45e4a
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.jsonindex 067c3ed29df..cf193a3541a 100644--- a/locales/en-US/verify.json+++ b/locales/en-US/verify.json@@ -165,6 +165,7 @@"acceptance.requirementEmpty": "No acceptance goal recorded for this subject yet.","acceptance.requirementEmptyEditable": "No acceptance goal yet — click to add one.","acceptance.requirementLabel": "Acceptance goal",+ "acceptance.resources.empty": "No files yet — rounds attach their evidence here.","acceptance.review.accept": "Accept","acceptance.review.acceptAll": "Accept all","acceptance.review.acceptAllDone": "All accepted",@@ -228,6 +229,8 @@"acceptance.subject.task": "Task","acceptance.subject.topic": "Topic","acceptance.surface.other": "Other",+ "acceptance.tabs.checks": "Checklist",+ "acceptance.tabs.resources": "Files","acceptance.titleFallback": "Delivery acceptance","acceptance.tray.addCheck": "Add tracking item","acceptance.tray.editModal.addTitle": "Add tracking item",diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.jsonindex 035f5a181d0..35bdfcbd540 100644--- a/locales/zh-CN/verify.json+++ b/locales/zh-CN/verify.json@@ -165,6 +165,7 @@"acceptance.requirementEmpty": "尚未记录该对象的验收目标。","acceptance.requirementEmptyEditable": "尚未记录验收目标,点击填写。","acceptance.requirementLabel": "验收目标",+ "acceptance.resources.empty": "还没有文件 —— 各轮验证产生的证据会汇总到这里。","acceptance.review.accept": "验收通过","acceptance.review.acceptAll": "全部验收","acceptance.review.acceptAllDone": "已全部验收",@@ -228,6 +229,8 @@"acceptance.subject.task": "任务","acceptance.subject.topic": "话题","acceptance.surface.other": "其他",+ "acceptance.tabs.checks": "检查清单",+ "acceptance.tabs.resources": "文件","acceptance.titleFallback": "交付验收","acceptance.tray.addCheck": "添加跟踪项","acceptance.tray.editModal.addTitle": "添加跟踪项",diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.tsindex 7c69c22bba5..704013fe217 100644--- a/packages/locales/src/default/verify.ts+++ b/packages/locales/src/default/verify.ts@@ -257,6 +257,9 @@ export default {'acceptance.status.verifying': 'Verification in progress','acceptance.shell.back': 'Back','acceptance.shell.menu': 'Show deliveries',+ 'acceptance.resources.empty': 'No files yet — rounds attach their evidence here.',+ 'acceptance.tabs.checks': 'Checklist',+ 'acceptance.tabs.resources': 'Files','acceptance.subject.document': 'Document','acceptance.subject.standalone': 'Standalone','acceptance.subject.task': 'Task',diff --git a/src/features/Acceptance/Report/ReportViewer.tsx b/src/features/Acceptance/Report/ReportViewer.tsxindex bd02ee59de7..f4565e820bb 100644--- a/src/features/Acceptance/Report/ReportViewer.tsx+++ b/src/features/Acceptance/Report/ReportViewer.tsx@@ -71,8 +71,6 @@ import {import { readVisualizationManifest } from './visualization';import { VisualizationRenderer } from './VisualizationRenderer';-type Filter = 'all' | CheckState;-const styles = createStaticStyles(({ css }) => ({scroll: css`overflow: auto;@@ -363,79 +361,16 @@ const styles = createStaticStyles(({ css }) => ({}`,- /* sticky filter chips */- stats: css`- position: sticky;- z-index: 10;- inset-block-start: 0;-- display: flex;- flex-wrap: wrap;- gap: 8px;- align-items: center;-- margin-block: 20px 12px;- padding-block: 12px;-- background: color-mix(in srgb, ${cssVar.colorBgContainer} 88%, transparent);- backdrop-filter: blur(8px);- `,- chip: css`- cursor: pointer;-- display: inline-flex;- gap: 7px;- align-items: center;-- height: 28px;- padding-inline: 12px;- border: 1px solid ${cssVar.colorBorderSecondary};- border-radius: 999px;-- font-size: 12px;- color: ${cssVar.colorTextSecondary};-- background: transparent;-- transition: background 0.12s ease;-- b {- font-weight: 600;- font-variant-numeric: tabular-nums;- color: ${cssVar.colorText};- }-- &:hover {- background: ${cssVar.colorFillTertiary};- }-- &[data-active='true'] {- border-color: ${cssVar.colorBorder};- color: ${cssVar.colorText};- background: ${cssVar.colorFillTertiary};- }- `,- dot: css`- width: 7px;- height: 7px;- border-radius: 999px;- `,- score: css`- cursor: default;- margin-inline-start: auto;- border-color: transparent;- color: ${cssVar.colorTextTertiary};-- b {- color: ${cssVar.colorTextSecondary};- }- `,-/* checks */checks: css`+ /* The filter bar used to carry this gap in its own margin; without it the+ hero and the first row collided. */overflow: hidden;++ margin-block-start: 24px;border: 1px solid ${cssVar.colorBorderSecondary};border-radius: ${cssVar.borderRadius};+background: ${cssVar.colorBgContainer};`,row: css`@@ -1312,7 +1247,7 @@ const CodingScopeCard = memo<{CodingScopeCard.displayName = 'CodingScopeCard';/**- * The report detail pane. Renders the verdict hero, a sticky verdict-filter bar,+ * The report detail pane. Renders the verdict hero,* every check as a severity-ordered expandable row (failed rows open by default),* and the full narrative behind a collapsed disclosure. Addressed by `:runId`;* refreshes itself while the run is non-terminal.@@ -1328,7 +1263,6 @@ const ReportViewer = memo<ReportViewerProps>(({ runId: explicitRunId }) => {// trailing punctuation onto the id — salvage the leading UUID.const verifyRunId = explicitRunId ?? extractUuid(routeRunId) ?? null;const { data, error, isLoading, mutate } = useVerifyReportBundle(verifyRunId);- const [filter, setFilter] = useState<Filter>('all');useEffect(() => {const status = data?.run.status;@@ -1382,64 +1316,28 @@ const ReportViewer = memo<ReportViewerProps>(({ runId: explicitRunId }) => {? (run.status as keyof typeof liveStatusLabelKey): null;- const counts = ordered.reduce(- (acc, row) => {- acc[row.state] += 1;- return acc;- },- { failed: 0, not_executed: 0, passed: 0, uncertain: 0 } as Record<CheckState, number>,- );- // A chip's count is a promise about the rows behind it, so whenever there are- // rows they are the truth — the report's own stats count the cases it ingested- // and know nothing about a planned check that never produced one. Only an- // empty list falls back to them (a report can exist before any result does).- const hasRows = ordered.length > 0;- const total = hasRows ? ordered.length : (report?.totalChecks ?? 0);- const passed = hasRows ? counts.passed : (report?.passedChecks ?? 0);- const failed = hasRows ? counts.failed : (report?.failedChecks ?? 0);- const uncertain = hasRows ? counts.uncertain : (report?.uncertainChecks ?? 0);const verdict = (report?.verdict as VerifyVerdict | null) ?? null;- const visible = filter === 'all' ? ordered : ordered.filter((row) => row.state === filter);+ // The verdict-filter bar is gone, so every row of the round renders. The+ // per-verdict tallies went with it: they existed to label its chips, and the+ // verdict pill above already states the round's outcome.+ const visible = ordered;const isCodingReport = run.scenario === 'coding';const interactionCost = readInteractionCost(run.metadata);// The server strips `origin` for anyone but the author; `isOwner` keeps the// affordance off the page for a visitor even if that ever regressed.const origin = data.isOwner ? run.metadata?.origin : undefined;- const chips: { count: number; dot?: string; key: Filter; label: string }[] = [- { count: total, key: 'all', label: t('report.filter.all') },- { count: failed, dot: cssVar.colorError, key: 'failed', label: t('report.filter.failed') },- {- count: uncertain,- dot: cssVar.colorWarning,- key: 'uncertain',- label: t('report.filter.uncertain'),- },- // Only a report with a stored plan can have these, so the chip appears only- // when there is something to filter to.- ...(counts.not_executed > 0- ? [- {- count: counts.not_executed,- dot: cssVar.colorTextQuaternary,- key: 'not_executed' as const,- label: t('report.filter.notExecuted'),- },- ]- : []),- { count: passed, dot: cssVar.colorSuccess, key: 'passed', label: t('report.filter.passed') },- ];-return (<div className={styles.scroll}><div className={styles.page}><main><Flexbox gap={12}>- <div className={styles.heroLine}>- <Text as={'h1'} style={{ fontSize: 24, lineHeight: 1.3, margin: 0 }}>- {run.title || t('report.titleFallback')}- </Text>- {verdict && (+ {/* Verdict above the title, not trailing it — the same order the+ acceptance page uses. A badge parked after a long title wraps+ to its own line anyway, and then reads as an afterthought+ rather than as the report's headline state. */}+ {verdict && (+ <div className={styles.heroLine} style={{ marginBlockEnd: 2 }}><spanclassName={styles.pill}style={{@@ -1450,8 +1348,11 @@ const ReportViewer = memo<ReportViewerProps>(({ runId: explicitRunId }) => {<Icon icon={VERDICT_META[verdict].icon} size={15} />{t(`report.verdict.${verdict}`)}</span>- )}- </div>+ </div>+ )}+ <Text as={'h1'} style={{ fontSize: 24, lineHeight: 1.3, margin: 0 }}>+ {run.title || t('report.titleFallback')}+ </Text>{!isCodingReport && run.goal && <Text className={styles.summary}>{run.goal}</Text>}{report?.summary && <Text className={styles.summary}>{report.summary}</Text>}@@ -1471,38 +1372,13 @@ const ReportViewer = memo<ReportViewerProps>(({ runId: explicitRunId }) => {)}</Flexbox>- <div className={styles.stats}>- {chips.map((c) => (- <button- className={styles.chip}- data-active={filter === c.key}- key={c.key}- type={'button'}- onClick={() => setFilter(c.key)}- >- {c.dot && <span className={styles.dot} style={{ background: c.dot }} />}- {c.label} <b>{c.count}</b>- </button>- ))}- {typeof report?.overallConfidence === 'number' && (- <span className={`${styles.chip} ${styles.score}`}>- {t('report.stats.confidence')} <b>{Math.round(report.overallConfidence * 100)}%</b>- </span>- )}- </div>-{visible.length > 0 ? (<div className={styles.checks}>{visible.map((row) => (- <CheckRow- key={row.id}- row={row}- defaultOpen={- row.state === 'failed' ||- row.state === 'not_executed' ||- (row.result?.evidence ?? []).some(isInlineVisualEvidence)- }- />+ /* Every row opens. A report is read to see what was actually+ observed, and a page of collapsed titles makes the reader+ click N times to learn that. */+ <CheckRow defaultOpen key={row.id} row={row} />))}</div>) : (diff --git a/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx b/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsxindex e5dc5f33faf..4835c1c3723 100644--- a/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx+++ b/src/features/Acceptance/Viewer/AcceptanceCheckInventory.tsx@@ -2,7 +2,7 @@import { Flexbox } from '@lobehub/ui';import { ActionIcon, Select, Text, toast } from '@lobehub/ui/base-ui';-import { createStaticStyles, cssVar, useResponsive } from 'antd-style';+import { useResponsive } from 'antd-style';import { ChevronsDownUp, ChevronsUpDown } from 'lucide-react';import type { ReactNode } from 'react';import { useCallback, useEffect, useState } from 'react';@@ -30,19 +30,6 @@ import { EMPTY_ID_SET, setAggregateEntry } from './expandState';import { useAcceptanceBundle } from './useAcceptanceBundle';import { canReviewAcceptance } from './visibility';-const styles = createStaticStyles(({ css }) => ({- countBadge: css`- padding-block: 1px;- padding-inline: 7px;- border-radius: 99px;-- font-size: 12px;- color: ${cssVar.colorTextSecondary};-- background: ${cssVar.colorFillTertiary};- `,-}));-interface AcceptanceCheckInventoryProps {children?: ReactNode;onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;@@ -198,10 +185,11 @@ const AcceptanceCheckInventory = ({return (<><Flexbox horizontal align={'center'} gap={8} wrap={compactToolbar ? 'nowrap' : 'wrap'}>+ {/* The tab above already carries the count; stating it twice on the+ same screen makes the reader check whether they disagree. */}<Text strong style={{ fontSize: 14, whiteSpace: 'nowrap' }}>{t('acceptance.checks.title')}</Text>- <span className={styles.countBadge}>{counts.total}</span><Flexbox flex={1} />{toolbar}<Selectdiff --git a/src/features/Acceptance/Viewer/AcceptanceGoal.tsx b/src/features/Acceptance/Viewer/AcceptanceGoal.tsxindex 7d5ed1cf5a0..696095913ac 100644--- a/src/features/Acceptance/Viewer/AcceptanceGoal.tsx+++ b/src/features/Acceptance/Viewer/AcceptanceGoal.tsx@@ -16,12 +16,12 @@ import { useAcceptanceBundle } from './useAcceptanceBundle';const GOAL_COLLAPSED_STORAGE_KEY = 'lobehub-acceptance-goal-collapsed';const styles = createStaticStyles(({ css }) => ({+ /**+ * No border, no card. The requirement is the page's own subject line, not a+ * widget parked on it — boxing it added a frame around the one thing nobody+ * needs help finding.+ */card: css`- overflow: hidden;- border: 1px solid ${cssVar.colorBorderSecondary};- border-radius: ${cssVar.borderRadiusLG};- background: ${cssVar.colorBgContainer};-&:hover [data-goal-toggle='true'] {pointer-events: auto;opacity: 1;@@ -82,10 +82,9 @@ const styles = createStaticStyles(({ css }) => ({interface AcceptanceGoalProps {editSlot?: ReactNode;- reportSlot?: ReactNode;}-const AcceptanceGoal = ({ editSlot, reportSlot }: AcceptanceGoalProps) => {+const AcceptanceGoal = ({ editSlot }: AcceptanceGoalProps) => {const { t } = useTranslation('verify');const { acceptanceId } = useAcceptanceScope();const { data } = useAcceptanceBundle(acceptanceId);@@ -93,38 +92,31 @@ const AcceptanceGoal = ({ editSlot, reportSlot }: AcceptanceGoalProps) => {if (!data) return null;const requirement = data.acceptance.requirement;- const latestSummary = data.latestReport?.summary;- const currentRound = data.rounds.at(-1);- const roundLabel = currentRound- ? t('acceptance.round', { round: currentRound.run.roundIndex })- : undefined;const scope = acceptanceCodingScope(data.rounds);const emptyLabel = editSlot? t('acceptance.requirementEmptyEditable'): t('acceptance.requirementEmpty');- const showContext = Boolean(latestSummary || scope);return (- <Flexbox- className={styles.card}- gap={collapsed ? 0 : 12}- paddingBlock={collapsed ? 8 : 12}- paddingInline={collapsed ? 12 : 16}- >- <Flexbox horizontal align={'center'} gap={4}>- <Text className={styles.requirementLabel}>{t('acceptance.requirementLabel')}</Text>+ <Flexbox className={styles.card} gap={collapsed ? 0 : 6}>+ {/* No "Acceptance goal" label: the sentence under the title IS the goal,+ and naming it added a caption to a paragraph that reads fine alone.+ Its controls therefore ride the sentence's own row — a header strip+ with nothing left to say is just an empty band of space. */}+ <Flexbox horizontal align={collapsed ? 'center' : 'flex-start'} gap={4}>+ <Text+ ellipsis={collapsed}+ title={collapsed ? (requirement ?? emptyLabel) : undefined}+ style={{+ flex: 1,+ fontSize: collapsed ? 13 : 15,+ lineHeight: collapsed ? undefined : 1.7,+ minWidth: 0,+ }}+ >+ {requirement ?? emptyLabel}+ </Text>{!collapsed && editSlot}- {collapsed && (- <Text- ellipsis- fontSize={13}- style={{ flex: 1, minWidth: 0 }}- title={requirement ?? emptyLabel}- >- {requirement ?? emptyLabel}- </Text>- )}- {!collapsed && <Flexbox flex={1} />}<ActionIcondata-goal-toggleclassName={styles.goalToggle}@@ -134,31 +126,8 @@ const AcceptanceGoal = ({ editSlot, reportSlot }: AcceptanceGoalProps) => {onClick={() => setCollapsed((value) => !value)}/></Flexbox>- {!collapsed &&- (requirement ? (- <Text style={{ fontSize: 15, lineHeight: 1.7 }}>{requirement}</Text>- ) : (- <Text style={{ fontSize: 15, lineHeight: 1.7 }}>{emptyLabel}</Text>- ))}- {!collapsed && showContext && (- <Flexbox- gap={8}- paddingBlock={'12px 0'}- style={{ borderBlockStart: `1px solid ${cssVar.colorBorderSecondary}` }}- >- <Flexbox horizontal align={'center'} gap={8}>- <Text fontSize={12} type={'secondary'}>- {t('acceptance.latestSummary')}- {roundLabel ? ` · ${roundLabel}` : ''}- </Text>- <Flexbox flex={1} />- {reportSlot}- </Flexbox>- {latestSummary && (- <Text className={styles.summaryClamp} fontSize={13} type={'secondary'}>- {latestSummary}- </Text>- )}+ {!collapsed && scope && (+ <Flexbox gap={8}>{scope && (<Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>{scope.branch && (diff --git a/src/features/Acceptance/Viewer/AcceptanceIdentity.tsx b/src/features/Acceptance/Viewer/AcceptanceIdentity.tsxindex 092df740a53..3e9af43f6af 100644--- a/src/features/Acceptance/Viewer/AcceptanceIdentity.tsx+++ b/src/features/Acceptance/Viewer/AcceptanceIdentity.tsx@@ -1,7 +1,7 @@'use client';import { Flexbox, Icon } from '@lobehub/ui';-import { Avatar, Tag, Text } from '@lobehub/ui/base-ui';+import { Avatar, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import dayjs from 'dayjs';import { GitPullRequest } from 'lucide-react';@@ -33,11 +33,25 @@ const styles = createStaticStyles(({ css }) => ({}));interface AcceptanceIdentityProps {+ /** Rendered on the meta line — the per-check entry point. */+ focusSlot?: ReactNode;statusSlot?: ReactNode;topicSlot?: ReactNode;}-const AcceptanceIdentity = ({ statusSlot, topicSlot }: AcceptanceIdentityProps) => {+/**+ * Identity, state and provenance in two lines.+ *+ * They used to take four: the status pill led a line of its own, the title a+ * second, the per-check entry a third and the provenance chips a fourth — so+ * the delivery's name, the one thing you scan for, sat in the middle of a+ * stack of qualifiers. Now the title anchors line one with its state beside+ * it, and everything that merely QUALIFIES it (counts, when it last ran, where+ * it came from, how to open it check by check) collapses onto one meta line+ * underneath.+ */++const AcceptanceIdentity = ({ focusSlot, statusSlot, topicSlot }: AcceptanceIdentityProps) => {const { t } = useTranslation('verify');const hydrated = useIsHydrated();const { acceptanceId, embedded } = useAcceptanceScope();@@ -64,19 +78,27 @@ const AcceptanceIdentity = ({ statusSlot, topicSlot }: AcceptanceIdentityProps)const showOrigin = Boolean(originAgent || topicSlot || pullRequest?.number);return (- <Flexbox gap={10}>+ <Flexbox gap={6}>+ {/* State leads, on its own line above the name — the delivery's standing+ is what a reader checks first, and it stops competing with the title+ for the same row. The per-check entry rides along with it: it acts on+ exactly the counts stated beside it. */}<Flexbox horizontal align={'center'} gap={10} wrap={'wrap'}>{statusSlot ?? <AcceptanceStatusPill status={acceptance.status} />}<Text fontSize={12} type={'secondary'}>{[countsText, latestAt].filter(Boolean).join(' · ')}</Text>+ {focusSlot}</Flexbox>- <Flexbox horizontal align={'center'} gap={10}>- <Text as={'h1'} style={{ fontSize: 18, margin: 0 }}>+ {/* No subject-type tag beside the name. Which KIND of thing was+ delivered is a fact about the plumbing, not about the delivery a+ reader came to judge — and it sat where the title's own meaning+ should carry. */}+ <Flexbox horizontal align={'center'} gap={10} wrap={'wrap'}>+ <Text ellipsis as={'h1'} style={{ fontSize: 18, margin: 0, minWidth: 0 }}>{subject.title ?? subject.id}</Text>- <Tag size={'small'}>{t(`acceptance.subject.${subject.type}`)}</Tag></Flexbox>{showOrigin && (diff --git a/src/features/Acceptance/Viewer/AcceptanceLedgerRail.tsx b/src/features/Acceptance/Viewer/AcceptanceLedgerRail.tsxindex 69e2cb55ce1..559fd19d06a 100644--- a/src/features/Acceptance/Viewer/AcceptanceLedgerRail.tsx+++ b/src/features/Acceptance/Viewer/AcceptanceLedgerRail.tsx@@ -1,7 +1,7 @@'use client';-import { DraggablePanel, Flexbox } from '@lobehub/ui';-import { ActionIcon, Drawer } from '@lobehub/ui/base-ui';+import { DraggablePanel, Flexbox, Icon } from '@lobehub/ui';+import { Drawer, Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, useResponsive } from 'antd-style';import { PanelRightOpen } from 'lucide-react';import { useEffect, useState } from 'react';@@ -18,18 +18,36 @@ import { useAcceptanceBundle } from './useAcceptanceBundle';import { canViewAcceptanceHistory } from './visibility';const styles = createStaticStyles(({ css }) => ({+ chipCount: css`+ font-size: 11px;+ font-weight: 500;+ color: ${cssVar.colorTextSecondary};+ `,+ /**+ * Collapsed, the run ledger is a VERTICAL chip hugging the content's right+ * edge: the rounds are the page's audit trail, not its reading material, so+ * the affordance keeps the column it would otherwise occupy down to a+ * thumb-width strip. The icon plus the round count carry it — spelling the+ * label out sideways would cost the width the collapse just bought back.+ */toggle: css`+ cursor: pointer;+position: absolute;z-index: 10;inset-block-start: 16px;- inset-inline-end: 16px;+ inset-inline-end: 12px;+ padding-block: 8px;+ padding-inline: 5px;border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: 99px;background: ${cssVar.colorBgContainer};&:hover {border-color: ${cssVar.colorBorder};+ background: ${cssVar.colorFillQuaternary};}`,}));@@ -44,7 +62,11 @@ const AcceptanceLedgerRail = () => {const { data } = useAcceptanceBundle(acceptanceId);const originConversation = useOriginConversation();const originTopicOpen = Boolean(originConversation?.isOpen);- const [expand, setExpand] = useState(!embedded);+ /**+ * Collapsed by default. The rounds are provenance — worth reaching for when+ * a verdict is in question, not worth a permanent column beside every read.+ */+ const [expand, setExpand] = useState(false);const highlightRound = null;const focused = Boolean(params.checkId);@@ -121,13 +143,16 @@ const AcceptanceLedgerRail = () => {return (<>{!focused && !expand && (- <ActionIcon+ <Flexbox+ align={'center'}className={styles.toggle}- icon={PanelRightOpen}- size={'small'}+ gap={5}title={t('acceptance.ledger.expand')}onClick={() => setExpand(true)}- />+ >+ <Icon icon={PanelRightOpen} size={14} />+ <Text className={styles.chipCount}>{data.rounds.length}</Text>+ </Flexbox>)}{isNarrowViewport ? (<Drawerdiff --git a/src/features/Acceptance/Viewer/AcceptanceResources.tsx b/src/features/Acceptance/Viewer/AcceptanceResources.tsxnew file mode 100644index 00000000000..0cf4d526b7b--- /dev/null+++ b/src/features/Acceptance/Viewer/AcceptanceResources.tsx@@ -0,0 +1,185 @@+'use client';++import { Empty, Flexbox, Icon, Image } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';+import { createStaticStyles, cssVar, useResponsive } from 'antd-style';+import dayjs from 'dayjs';+import { FileText, Film, Paperclip } from 'lucide-react';+import { useTranslation } from 'react-i18next';++import { useIsHydrated } from '@/hooks/useIsHydrated';++import { useAcceptanceScope } from './AcceptanceScope';+import { useAcceptanceBundle } from './useAcceptanceBundle';++const styles = createStaticStyles(({ css }) => ({+ /**+ * Masonry by explicit column assignment, not CSS `column-count`.+ *+ * The native version balances columns ONCE, during layout — and evidence+ * images arrive after it, so every tile had already piled into the first+ * column and stayed there. Reserving each tile's aspect ratio did not help:+ * the balancing pass happens before the ratios matter. Dealing the tiles out+ * ourselves is deterministic and independent of when the bytes land.+ */+ column: css`+ display: flex;+ flex: 1;+ flex-direction: column;+ gap: 12px;++ min-inline-size: 0;+ `,+ grid: css`+ display: flex;+ gap: 12px;+ align-items: flex-start;+ `,+ item: css`+ cursor: pointer;++ overflow: hidden;++ inline-size: 100%;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};++ background: ${cssVar.colorBgContainer};++ &:hover {+ border-color: ${cssVar.colorBorder};+ }+ `,+ meta: css`+ padding-block: 8px;+ padding-inline: 10px;+ `,+ nonVisual: css`+ display: flex;+ gap: 8px;+ align-items: center;++ padding-block: 18px;+ padding-inline: 12px;++ background: ${cssVar.colorFillQuaternary};+ `,+}));++const isVisual = (type: string) => type === 'screenshot' || type === 'gif';++/**+ * Everything this acceptance produced, in one place.+ *+ * The artefacts exist already — every round attaches them to the check whose+ * verdict they back — but reaching one meant knowing which check owned it and+ * expanding that row. The same artefact is also what you want when you are NOT+ * auditing a verdict ("where is that screenshot"), so it earns an inventory of+ * its own. Deduped by file: a carried-forward check re-attaches the same+ * artefact to every round it survives.+ */+const AcceptanceResources = () => {+ const { t } = useTranslation('verify');+ const { lg = true, md = true } = useResponsive();+ const hydrated = useIsHydrated();+ const { acceptanceId } = useAcceptanceScope();+ const { data } = useAcceptanceBundle(acceptanceId);+ if (!data) return null;++ const seen = new Set<string>();+ const items = data.checks+ .flatMap((check) =>+ (check.evidence ?? []).map((evidence) => ({ check: check.title, evidence })),+ )+ .filter(({ evidence }) => {+ const key = evidence.fileId ?? evidence.documentId ?? evidence.id;+ if (!key || seen.has(key)) return false;+ // Text captured inline is the check's own body, not a file someone can+ // open — listing it here would pad the inventory with dead tiles.+ if (!evidence.fileUrl && !evidence.documentId) return false;+ seen.add(key);+ return true;+ });++ if (items.length === 0)+ return (+ <Flexbox paddingBlock={32}>+ <Empty description={t('acceptance.resources.empty')} icon={Paperclip} />+ </Flexbox>+ );++ const columnCount = lg ? 3 : md ? 2 : 1;+ const columns: (typeof items)[] = Array.from({ length: columnCount }, () => []);+ items.forEach((entry, index) => columns[index % columnCount]!.push(entry));++ return (+ <div className={styles.grid}>+ {columns.map((column, columnIndex) => (+ <div className={styles.column} key={columnIndex}>+ {column.map(({ check, evidence }) => {+ const href = evidence.fileUrl ?? undefined;+ const name = evidence.fileName ?? evidence.description ?? check;+ const captured =+ hydrated && evidence.capturedAt+ ? dayjs(evidence.capturedAt).format('MM-DD HH:mm')+ : undefined;+ const visual = isVisual(evidence.type) && Boolean(evidence.fileUrl);++ return (+ <div+ className={styles.item}+ key={evidence.id}+ onClick={href ? () => window.open(href, '_blank', 'noreferrer') : undefined}+ >+ {visual ? (+ /* The ratio is reserved from the stored dimensions, not left to+ the image's own load: CSS columns balance once, at layout, and+ an image that arrives afterwards has already lost its place —+ every tile piles into the first column. */+ <div+ style={{+ aspectRatio:+ evidence.fileWidth && evidence.fileHeight+ ? `${evidence.fileWidth} / ${evidence.fileHeight}`+ : '16 / 10',+ background: cssVar.colorFillQuaternary,+ width: '100%',+ }}+ >+ <Image+ alt={name}+ preview={false}+ src={evidence.fileUrl!}+ style={{ height: '100%', objectFit: 'cover', width: '100%' }}+ />+ </div>+ ) : (+ <div className={styles.nonVisual}>+ <Icon+ icon={evidence.type === 'video' ? Film : FileText}+ size={16}+ style={{ color: cssVar.colorTextTertiary }}+ />+ <Text ellipsis fontSize={13}>+ {name}+ </Text>+ </div>+ )}+ <Flexbox className={styles.meta} gap={2}>+ <Text ellipsis fontSize={12}>+ {name}+ </Text>+ <Text ellipsis fontSize={11} type={'secondary'}>+ {[check, captured].filter(Boolean).join(' · ')}+ </Text>+ </Flexbox>+ </div>+ );+ })}+ </div>+ ))}+ </div>+ );+};++export default AcceptanceResources;diff --git a/src/features/Acceptance/Viewer/AcceptanceTabs.tsx b/src/features/Acceptance/Viewer/AcceptanceTabs.tsxnew file mode 100644index 00000000000..38c0d5a0783--- /dev/null+++ b/src/features/Acceptance/Viewer/AcceptanceTabs.tsx@@ -0,0 +1,103 @@+'use client';++import { Flexbox, Icon } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';+import { createStaticStyles, cssVar, cx } from 'antd-style';+import { ListChecks, Paperclip } from 'lucide-react';+import { useTranslation } from 'react-i18next';++export type AcceptanceTabKey = 'checks' | 'resources';++interface AcceptanceTabsProps {+ active: AcceptanceTabKey;+ checkCount: number;+ onChange: (key: AcceptanceTabKey) => void;+ resourceCount: number;+}++const styles = createStaticStyles(({ css }) => ({+ count: css`+ padding-block: 0;+ padding-inline: 6px;+ border-radius: 99px;++ font-size: 11px;+ color: ${cssVar.colorTextSecondary};++ background: ${cssVar.colorFillSecondary};+ `,+ tab: css`+ cursor: pointer;++ position: relative;++ padding-block: 8px;+ padding-inline: 10px;++ white-space: nowrap;++ &:hover {+ color: ${cssVar.colorText};+ }+ `,+ tabActive: css`+ &::after {+ content: '';++ position: absolute;+ inset-block-end: -1px;+ inset-inline: 6px;++ block-size: 2px;+ border-radius: 2px;++ background: ${cssVar.colorPrimary};+ }+ `,+}));++/**+ * The delivery's two faces: the checks a person judges, and the artefacts the+ * rounds produced. They sit above the full-width rule so the rule reads as the+ * boundary between "what this delivery is" and "what you are looking at".+ */+const AcceptanceTabs = ({ active, checkCount, onChange, resourceCount }: AcceptanceTabsProps) => {+ const { t } = useTranslation('verify');+ const tabs = [+ {+ count: checkCount,+ icon: ListChecks,+ key: 'checks' as const,+ label: t('acceptance.tabs.checks'),+ },+ {+ count: resourceCount,+ icon: Paperclip,+ key: 'resources' as const,+ label: t('acceptance.tabs.resources'),+ },+ ];++ return (+ <Flexbox horizontal align={'center'} gap={2}>+ {tabs.map((tab) => (+ <Flexbox+ horizontal+ align={'center'}+ className={cx(styles.tab, tab.key === active && styles.tabActive)}+ gap={6}+ key={tab.key}+ onClick={() => onChange(tab.key)}+ >+ <Icon icon={tab.icon} size={14} style={{ color: cssVar.colorTextTertiary }} />+ <Text fontSize={13} weight={tab.key === active ? 600 : 400}>+ {tab.label}+ </Text>+ <Text className={styles.count}>{tab.count}</Text>+ </Flexbox>+ ))}+ </Flexbox>+ );+};++export default AcceptanceTabs;diff --git a/src/features/Acceptance/Viewer/index.tsx b/src/features/Acceptance/Viewer/index.tsxindex 272c6d23aca..48ad3ab6d77 100644--- a/src/features/Acceptance/Viewer/index.tsx+++ b/src/features/Acceptance/Viewer/index.tsx@@ -2,6 +2,7 @@import { Flexbox } from '@lobehub/ui';import { createStaticStyles, cssVar } from 'antd-style';+import { useState } from 'react';import { useParams } from 'react-router';import { extractUuid } from '../utils';@@ -15,16 +16,34 @@ import AcceptanceGoalEdit from './AcceptanceGoalEdit';import AcceptanceIdentity from './AcceptanceIdentity';import AcceptanceLedgerRail from './AcceptanceLedgerRail';import AcceptanceOriginTopic from './AcceptanceOriginTopic';-import { AcceptanceBundleGate, AcceptanceScope } from './AcceptanceScope';+import AcceptanceResources from './AcceptanceResources';+import { AcceptanceBundleGate, AcceptanceScope, useAcceptanceScope } from './AcceptanceScope';import AcceptanceSharedNotice from './AcceptanceSharedNotice';import AcceptanceStatusControl from './AcceptanceStatusControl';-import AcceptanceViewReportLink from './AcceptanceViewReportLink';+import type { AcceptanceTabKey } from './AcceptanceTabs';+import AcceptanceTabs from './AcceptanceTabs';import { acceptanceScrollLayout } from './layout';+import { useAcceptanceBundle } from './useAcceptanceBundle';++const CONTENT_MAX_WIDTH = 920;const styles = createStaticStyles(({ css }) => ({+ column: css`+ width: 100%;+ max-width: ${CONTENT_MAX_WIDTH}px;+ margin-inline: auto;+ padding-inline: 24px;+ `,contentFrame: css`overflow: ${acceptanceScrollLayout.frameOverflow};`,+ /* Spans the frame, not the reading column — the rule is the page's own+ horizon line, so cutting it at 920 would read as a card edge. */+ headerBand: css`+ flex: none;+ padding-block: 20px 0;+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};+ `,page: css`position: relative;@@ -42,6 +61,62 @@ interface AcceptancePageProps {onDraftToComposer?: (text: string) => boolean;}+/**+ * The record's own body: an identity band that ends in the full-width rule,+ * then whichever face of the delivery the tabs select.+ */+const AcceptanceBody = ({ onDraftToComposer }: Pick<AcceptancePageProps, 'onDraftToComposer'>) => {+ const { acceptanceId } = useAcceptanceScope();+ const { data } = useAcceptanceBundle(acceptanceId);+ const [tab, setTab] = useState<AcceptanceTabKey>('checks');++ const resourceCount = new Set(+ (data?.checks ?? []).flatMap((check) =>+ (check.evidence ?? [])+ .filter((evidence) => evidence.fileUrl || evidence.documentId)+ .map((evidence) => evidence.fileId ?? evidence.documentId ?? evidence.id),+ ),+ ).size;++ return (+ <>+ <Flexbox className={styles.headerBand}>+ <Flexbox className={styles.column} gap={12}>+ <AcceptanceSharedNotice />+ <AcceptanceIdentity+ focusSlot={<AcceptanceEnterFocus />}+ statusSlot={<AcceptanceStatusControl />}+ topicSlot={<AcceptanceOriginTopic />}+ />+ <AcceptanceGoal editSlot={<AcceptanceGoalEdit />} />+ {/* The requirement needs room to land before the tabs start a new+ thought — at the band's uniform gap it read as another row of+ the same list. */}+ <Flexbox style={{ paddingBlockStart: 16 }}>+ <AcceptanceTabs+ active={tab}+ checkCount={data?.checks.length ?? 0}+ resourceCount={resourceCount}+ onChange={setTab}+ />+ </Flexbox>+ </Flexbox>+ </Flexbox>++ <Flexbox className={styles.column} gap={16} paddingBlock={20}>+ {tab === 'checks' ? (+ <>+ <AcceptanceCheckInventory toolbar={<AcceptanceCheckOwnerToolbar />} />+ <AcceptanceDecision onDraftToComposer={onDraftToComposer} />+ </>+ ) : (+ <AcceptanceResources />+ )}+ </Flexbox>+ </>+ );+};+const AcceptancePage = ({acceptanceId: explicitAcceptanceId,onDraftToComposer,@@ -61,14 +136,7 @@ const AcceptancePage = ({<Flexboxflex={focused ? 1 : undefined}gap={16}- paddingBlock={focused ? 0 : 20}- paddingInline={focused ? 0 : 24}- style={{- margin: focused ? 0 : '0 auto',- maxWidth: focused ? 'none' : 920,- minHeight: focused ? 0 : undefined,- width: '100%',- }}+ style={{ minHeight: focused ? 0 : undefined, width: '100%' }}>{focused ? (<>@@ -81,23 +149,9 @@ const AcceptancePage = ({/><AcceptanceFocusWorkspace /></>- ) : (- <>- <AcceptanceSharedNotice />- <AcceptanceIdentity- statusSlot={<AcceptanceStatusControl />}- topicSlot={<AcceptanceOriginTopic />}- />- <AcceptanceEnterFocus />- <AcceptanceGoal- editSlot={<AcceptanceGoalEdit />}- reportSlot={<AcceptanceViewReportLink />}- />- <AcceptanceCheckInventory toolbar={<AcceptanceCheckOwnerToolbar />} />- <AcceptanceDecision onDraftToComposer={onDraftToComposer} />- </>- )}+ ) : null}</Flexbox>+ {!focused && <AcceptanceBody onDraftToComposer={onDraftToComposer} />}</Flexbox><AcceptanceLedgerRail /></Flexbox>