🤯 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): redesign the Acceptance viewer (#23042)
Inneibaa55ddfeb58
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.jsonindex 1f882f263aa..fa30bc904d9 100644--- a/locales/en-US/verify.json+++ b/locales/en-US/verify.json@@ -49,14 +49,22 @@"acceptance.bar.mobileProgress": "Delivery: {{done}} / {{total}} reviewed","acceptance.bar.needsFix": "All reviewed — {{count}} to fix","acceptance.bar.progress": "{{done}} of {{total}} checks confirmed — {{rest}} awaiting your review",- "acceptance.bar.progressDone": "All {{total}} checks confirmed — ready to accept",- "acceptance.bar.progressZero": "{{total}} checks awaiting your review",+ "acceptance.bar.progressDone_one": "The check is confirmed — ready to accept",+ "acceptance.bar.progressDone_other": "All {{count}} checks confirmed — ready to accept",+ "acceptance.bar.progressZero_one": "{{count}} check awaiting your review",+ "acceptance.bar.progressZero_other": "{{count}} checks awaiting your review","acceptance.bar.readOnlyReason": "Only the creator or a workspace member with edit access can accept or reject this delivery. You can still approve it, comment in Discussion, or request edit-collaboration access.","acceptance.bar.rejectComment": "Reject delivery","acceptance.bar.rejectOnlyReason": "You have edit-collaboration access. Accepting the delivery stays with the creator or a workspace member with edit access.","acceptance.bar.rerun": "Fix","acceptance.bar.rerunDrafted": "Added to your composer — review and send it.","acceptance.bar.rerunSent": "Sent to the source conversation — the repair round is starting.",+ "acceptance.bar.stripLabel": "{{accepted}} of {{total}} checks accepted",+ "acceptance.bar.tally.accepted": "{{count}} accepted",+ "acceptance.bar.tally.ignored": "{{count}} ignored",+ "acceptance.bar.tally.needsFix_one": "{{count}} needs a fix",+ "acceptance.bar.tally.needsFix_other": "{{count}} need a fix",+ "acceptance.bar.tally.pending": "{{count}} to review","acceptance.checkCreate.add": "Add checks","acceptance.checkCreate.addToScope": "Add to acceptance scope","acceptance.checkCreate.empty": "All checks in this rubric are already in scope.",@@ -80,8 +88,8 @@"acceptance.checkWork.drafted": "Check-specific instruction drafted","acceptance.checkWork.sent": "This check was sent to the source conversation","acceptance.checkWork.title": "Work on this check",- "acceptance.checks.allAccepted.desc": "Nice work — every acceptance check has been signed off.",- "acceptance.checks.allAccepted.title": "All checks accepted 🎉",+ "acceptance.checks.allAccepted.desc": "Every acceptance check has been signed off.",+ "acceptance.checks.allAccepted.title": "All checks accepted","acceptance.checks.copied": "Copied","acceptance.checks.copySeq": "Copy the check label","acceptance.checks.empty": "No acceptance checks recorded yet",@@ -101,6 +109,7 @@"acceptance.checks.notRequiredHint": "Optional — a failure here doesn’t block acceptance.","acceptance.checks.rerun": "Verified in {{count}} rounds","acceptance.checks.rerunHint": "This check ran in {{count}} rounds; the latest result counts.",+ "acceptance.checks.showAll": "Show all {{count}}","acceptance.checks.title": "Acceptance checks","acceptance.checks.viewTrace": "View verification run","acceptance.checks.waived": "Waived",@@ -157,6 +166,7 @@"acceptance.comments.draftsTitle": "New comments","acceptance.comments.draftsUnsent": "{{count}} comment(s) not sent. Your text is kept — send again.","acceptance.comments.empty": "No discussion yet.",+ "acceptance.comments.emptyTitle": "No discussion yet","acceptance.comments.evidenceDrafts": "{{count}} unsent","acceptance.comments.evidenceFromRound": "Evidence from round {{round}} — replaced in a later round","acceptance.comments.evidenceModalTitle": "Comment on evidence",@@ -166,6 +176,7 @@"acceptance.comments.historicalRegions": "{{count}} region note(s) on evidence replaced by a later round","acceptance.comments.linkCopied": "Link copied","acceptance.comments.loadFailed": "Failed to load the discussion. Please refresh.",+ "acceptance.comments.loadFailedTitle": "Failed to load the discussion","acceptance.comments.moreActions": "More actions","acceptance.comments.participants": "Participants","acceptance.comments.placeholder": "Comment on this delivery…",@@ -207,6 +218,7 @@"acceptance.comments.withdrawDescription": "You can withdraw or re-approve any time while the round is open. Only your status when the owner decides counts.","acceptance.comments.youApproved": "You approved round {{round}}","acceptance.comments.youApprovedNoRound": "You approved this delivery",+ "acceptance.decision.notRun": "Not run","acceptance.detail.suggestion": "Suggestion","acceptance.dispute.kind.invalid_criterion": "Check is invalid","acceptance.dispute.kind.missed_evidence": "Evidence already proves it",@@ -235,6 +247,7 @@"acceptance.feedback.title": "Feedback","acceptance.filter.accepted": "Accepted {{count}}","acceptance.filter.all": "All {{count}}",+ "acceptance.filter.allLabel": "All","acceptance.filter.ignored": "Ignored {{count}}","acceptance.filter.needsFix": "Needs fix {{count}}","acceptance.filter.pending": "To review {{count}}",@@ -267,7 +280,10 @@"acceptance.gate.leadProbes": "{{count}} experiments are done. Once you start, the remaining {{remaining}} units follow this plan in batches.","acceptance.gate.leadRework": "Reworked: {{codes}}.","acceptance.gate.nextWaveTitle": "Wave {{wave}}",+ "acceptance.gate.panelClose": "Close","acceptance.gate.planFiles": "{{count}} files",+ "acceptance.gate.planFold": "Hide the full plan",+ "acceptance.gate.planRead": "Read the full plan","acceptance.gate.planTitle": "Execution plan","acceptance.gate.releaseWave": "Approve and release wave {{wave}} ({{count}})","acceptance.gate.remaining": "{{count}} more after that, each wave reviewed by the main Agent. About {{estimate}} tokens in total, estimated from the experiments.",@@ -286,10 +302,15 @@"acceptance.gate.unitArtifacts": "Outputs","acceptance.gate.unitArtifactsEmpty": "No outputs registered for this unit.","acceptance.gate.unitBrief": "What this unit does",- "acceptance.gate.unitCount": "{{count}} units",- "acceptance.gate.unitMeta": "{{runs}} run(s) · {{tokens}} tokens",- "acceptance.gate.unitReworked": "Passed after {{rework}} rework round(s).",- "acceptance.gate.unitReworkedCostly": "Passed after {{rework}} rework round(s), using {{ratio}}× the average.",+ "acceptance.gate.unitCount_one": "{{count}} unit",+ "acceptance.gate.unitCount_other": "{{count}} units",+ "acceptance.gate.unitReworkedCostly_one": "Passed after {{count}} rework round, using {{ratio}}× the average.",+ "acceptance.gate.unitReworkedCostly_other": "Passed after {{count}} rework rounds, using {{ratio}}× the average.",+ "acceptance.gate.unitReworked_one": "Passed after {{count}} rework round.",+ "acceptance.gate.unitReworked_other": "Passed after {{count}} rework rounds.",+ "acceptance.gate.unitRuns_one": "{{count}} run",+ "acceptance.gate.unitRuns_other": "{{count}} runs",+ "acceptance.gate.unitTokens": "{{tokens}} tokens","acceptance.gate.unitUnsettled": "Did not settle cleanly. Check its acceptance before going on.","acceptance.gate.unitWaiting": "Starts on approval","acceptance.gate.unitWaitingHint": "Not started yet. It runs the plan above once you approve.",@@ -340,6 +361,7 @@"acceptance.local.shareHint": "Comments, mentions and a shareable link need LobeHub. Ask your agent to publish this acceptance, or run:","acceptance.local.shareTitle": "Review with your team","acceptance.local.unsaved": "{{count}} unsaved review(s)",+ "acceptance.notFound.back": "Back to acceptances","acceptance.notFound.description": "It may have been deleted, or it was never shared with you.","acceptance.notFound.title": "Acceptance not found","acceptance.origin.agentFallback": "Agent",@@ -401,6 +423,16 @@"acceptance.requirementEmptyEditable": "No acceptance goal yet — click to add one.","acceptance.requirementLabel": "Acceptance goal","acceptance.resources.empty": "No files yet. Evidence from each round will appear here.",+ "acceptance.resources.emptyDescription": "Evidence from each round will appear here.",+ "acceptance.resources.emptyTitle": "No files yet",+ "acceptance.resources.filter.all": "All",+ "acceptance.resources.filter.other": "Other",+ "acceptance.resources.filter.recording": "Recordings",+ "acceptance.resources.filter.screenshot": "Screenshots",+ "acceptance.resources.filterLabel": "Filter files",+ "acceptance.resources.noMatch": "No files match this filter",+ "acceptance.resources.roundLabel": "Filter by round",+ "acceptance.resources.showAll": "Show all {{count}}","acceptance.review.accept": "Accept","acceptance.review.acceptAll": "Accept all","acceptance.review.acceptAllDone": "All accepted",@@ -426,6 +458,7 @@"acceptance.review.ignoredNote": "Ignored · {{time}}","acceptance.review.imageNumber": "Image {{current}} / {{total}}","acceptance.review.mobileRegionCommentsEmpty": "Drag on the image above to mark a region. Its comment will appear here.",+ "acceptance.review.more": "More actions","acceptance.review.nextImage": "Next image","acceptance.review.previousImage": "Previous image","acceptance.review.regionComments": "Region comments",@@ -441,13 +474,19 @@"acceptance.review.revertToReject": "Reject instead","acceptance.review.submitFailed": "Could not submit. Your draft is saved; please try again.","acceptance.review.supplement": "Additional notes (optional)",- "acceptance.review.supplementButton": "Notes",- "acceptance.review.supplementButtonDraft": "Notes · draft saved","acceptance.review.writeFeedback": "Write feedback","acceptance.review.zoomIn": "Zoom in","acceptance.review.zoomOut": "Zoom out","acceptance.round": "Round {{round}}","acceptance.roundCount": "{{count}} verification round(s)",+ "acceptance.roundState.accepted": "Accepted",+ "acceptance.roundState.errored": "Errored",+ "acceptance.roundState.rejected": "Delivery rejected",+ "acceptance.roundState.repairing": "Repairing",+ "acceptance.roundState.running": "In progress",+ "acceptance.roundState.summary": "{{accepted}} of {{total}} accepted",+ "acceptance.roundState.toReview": "To review",+ "acceptance.roundState.waiting": "Waiting for verification","acceptance.roundStatus.errored": "Errored","acceptance.roundStatus.failed": "Failed","acceptance.roundStatus.passed": "Passed",@@ -466,6 +505,10 @@"acceptance.share.title": "Share","acceptance.shell.back": "Back","acceptance.shell.menu": "Show Acceptance menu",+ "acceptance.stage.fitHeight": "Fit height",+ "acceptance.stage.fitWidth": "Fit width",+ "acceptance.stage.imagePosition": "{{current}} of {{total}}",+ "acceptance.stage.openComments": "{{count}} open comment(s)","acceptance.stats.failed": "{{count}} failed","acceptance.stats.notExecuted": "{{count}} not executed","acceptance.stats.passed": "{{count}} passed",@@ -541,6 +584,23 @@"acceptance.video.reload": "Reload","acceptance.video.seek": "Seek","acceptance.video.speed": "Speed",+ "acceptance.video.story.addHint": "or drag on the video to circle the problem",+ "acceptance.video.story.addNote": "Add a note at {{time}}",+ "acceptance.video.story.addSpanNote": "Add a note on {{start}} – {{end}}",+ "acceptance.video.story.coverSpan": "Cover a span instead",+ "acceptance.video.story.delete": "Delete",+ "acceptance.video.story.empty": "No notes yet. Pause where something is wrong and add a note, or drag on the video to circle it.",+ "acceptance.video.story.loadFailedBody": "Its link may have expired.",+ "acceptance.video.story.loadFailedTitle": "The video failed to load",+ "acceptance.video.story.noteCircled": "circled on this frame",+ "acceptance.video.story.noteFrame": "on this frame",+ "acceptance.video.story.notePin": "Your note {{index}} at {{time}}",+ "acceptance.video.story.noteSpan": "from {{start}} to {{end}}",+ "acceptance.video.story.shortcuts": "Keyboard shortcuts",+ "acceptance.video.story.singleFrame": "Mark one frame instead",+ "acceptance.video.story.title": "What the recording shows",+ "acceptance.video.story.withdraw": "Withdraw",+ "acceptance.video.story.yourNote": "Your note","acceptance.viewFullReport": "View full report","acceptance.workspace.actions.delete": "Delete","acceptance.workspace.actions.markAccepted": "Mark as accepted",@@ -788,12 +848,13 @@"flow.expandGroup": "Expand {{title}}","flow.expected": "Expected behavior","flow.fullscreen": "Full screen",- "flow.graphView": "Graph",+ "flow.graphView": "Storyboard","flow.groupProgress": "{{passed}} / {{total}} verified","flow.groupReviewed": "{{count}} accepted","flow.instruction": "How to reach this state","flow.latestResult": "Latest result","flow.noAttachments": "No additional evidence attached. See the observation above.",+ "flow.noPicture": "No screenshot","flow.nodeCount": "{{count}} nodes","flow.outlineView": "Steps","flow.pendingPlan": "Draft",@@ -820,6 +881,17 @@"flow.state.uncertain": "Uncertain","flow.title": "User flow","flow.unvisited": "This state has not been verified on this path.",+ "flow.unvisitedShort": "Not verified on this path",+ "flow.walk.attempt": "Attempt {{number}}",+ "flow.walk.expected": "Expected",+ "flow.walk.latestAttempt": "Attempt {{number}} · latest",+ "flow.walk.next": "Next · {{title}}",+ "flow.walk.observed": "Observed",+ "flow.walk.position": "State {{index}} of {{total}}",+ "flow.walk.previous": "Previous: {{title}}",+ "flow.walk.reachedBy": "reached by “{{trigger}}”",+ "flow.walk.reachedFrom": "reached by “{{trigger}}” from {{source}}",+ "flow.walk.start": "Start · {{title}}","list.failedCount": "{{count}} failed","list.running": "Verifying…","meta.description": "Verification runs, delivery reports, and acceptance reviews.",diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.jsonindex 99c5fd64dbe..c013d21c233 100644--- a/locales/zh-CN/verify.json+++ b/locales/zh-CN/verify.json@@ -49,14 +49,22 @@"acceptance.bar.mobileProgress": "整体交付 · {{done}} / {{total}} 项已验收","acceptance.bar.needsFix": "已全部评审 · {{count}} 项待修复","acceptance.bar.progress": "已完成 {{done}} / {{total}} 项验证项,剩余 {{rest}} 项等待你的验收",- "acceptance.bar.progressDone": "{{total}} 项验证项已全部确认,可以接受交付",- "acceptance.bar.progressZero": "共 {{total}} 项等待你的验收",+ "acceptance.bar.progressDone_one": "{{count}} 项验证项已全部确认,可以接受交付",+ "acceptance.bar.progressDone_other": "{{count}} 项验证项已全部确认,可以接受交付",+ "acceptance.bar.progressZero_one": "共 {{count}} 项等待你的验收",+ "acceptance.bar.progressZero_other": "共 {{count}} 项等待你的验收","acceptance.bar.readOnlyReason": "只有发起人或有编辑权限的工作区成员可以接受或打回这次交付。你仍然可以表达接受、在讨论中留言,或申请编辑协作权限。","acceptance.bar.rejectComment": "打回交付","acceptance.bar.rejectOnlyReason": "你有编辑协作权限;接受交付仍由发起人或有编辑权限的工作区成员决定。","acceptance.bar.rerun": "打回重跑","acceptance.bar.rerunDrafted": "已填入对话框,检查后发送。","acceptance.bar.rerunSent": "已发送到源会话,修复轮次启动中。",+ "acceptance.bar.stripLabel": "{{total}} 项验证项中已验收 {{accepted}} 项",+ "acceptance.bar.tally.accepted": "{{count}} 项已验收",+ "acceptance.bar.tally.ignored": "{{count}} 项已忽略",+ "acceptance.bar.tally.needsFix_one": "{{count}} 项待修复",+ "acceptance.bar.tally.needsFix_other": "{{count}} 项待修复",+ "acceptance.bar.tally.pending": "{{count}} 项未验收","acceptance.checkCreate.add": "添加检查项","acceptance.checkCreate.addToScope": "加入验收范围","acceptance.checkCreate.empty": "这个 Rubric 中的检查项都已在验收范围内。",@@ -80,7 +88,7 @@"acceptance.checkWork.drafted": "单项处理指令已写入输入框","acceptance.checkWork.sent": "已将这一项发送到来源会话","acceptance.checkWork.title": "处理此项",- "acceptance.checks.allAccepted.desc": "太棒了,所有验收项都已通过 🎉",+ "acceptance.checks.allAccepted.desc": "每一项验收检查都已确认。","acceptance.checks.allAccepted.title": "已全部验收","acceptance.checks.copied": "已复制","acceptance.checks.copySeq": "复制检查项序号",@@ -101,6 +109,7 @@"acceptance.checks.notRequiredHint": "非必需:失败不阻止验收","acceptance.checks.rerun": "验证 {{count}} 轮","acceptance.checks.rerunHint": "同一检查项在 {{count}} 轮各验证一次,以最后一轮为准",+ "acceptance.checks.showAll": "显示全部 {{count}} 项","acceptance.checks.title": "验收检查清单","acceptance.checks.viewTrace": "查看验证过程","acceptance.checks.waived": "已豁免",@@ -157,6 +166,7 @@"acceptance.comments.draftsTitle": "新评论","acceptance.comments.draftsUnsent": "{{count}} 条评论未发送,内容已保留,请重新发送。","acceptance.comments.empty": "还没有讨论。",+ "acceptance.comments.emptyTitle": "还没有讨论","acceptance.comments.evidenceDrafts": "{{count}} 条未发送","acceptance.comments.evidenceFromRound": "第 {{round}} 轮的证据,后续轮次已替换","acceptance.comments.evidenceModalTitle": "评论证据",@@ -166,6 +176,7 @@"acceptance.comments.historicalRegions": "{{count}} 条圈选评论指向已被后续轮次替换的证据","acceptance.comments.linkCopied": "链接已复制","acceptance.comments.loadFailed": "讨论加载失败,请刷新重试。",+ "acceptance.comments.loadFailedTitle": "讨论加载失败","acceptance.comments.moreActions": "更多操作","acceptance.comments.participants": "参与者","acceptance.comments.placeholder": "对整次交付说点什么…",@@ -207,6 +218,7 @@"acceptance.comments.withdrawDescription": "本轮期间随时可以撤回或再次表达,最后停在哪个状态才算数。","acceptance.comments.youApproved": "你已在第 {{round}} 轮表达接受","acceptance.comments.youApprovedNoRound": "你已表达接受",+ "acceptance.decision.notRun": "未执行","acceptance.detail.suggestion": "建议","acceptance.dispute.kind.invalid_criterion": "检查项不成立","acceptance.dispute.kind.missed_evidence": "证据已能证明",@@ -235,6 +247,7 @@"acceptance.feedback.title": "反馈清单","acceptance.filter.accepted": "已验收 {{count}}","acceptance.filter.all": "全部 {{count}}",+ "acceptance.filter.allLabel": "全部","acceptance.filter.ignored": "已忽略 {{count}}","acceptance.filter.needsFix": "待修复 {{count}}","acceptance.filter.pending": "未验收 {{count}}",@@ -267,7 +280,10 @@"acceptance.gate.leadProbes": "{{count}} 个试点已经完成。开启后,剩下 {{remaining}} 项会照这份方案分批执行。","acceptance.gate.leadRework": "其中 {{codes}} 有返工。","acceptance.gate.nextWaveTitle": "第 {{wave}} 批",+ "acceptance.gate.panelClose": "关闭","acceptance.gate.planFiles": "共 {{count}} 个文件",+ "acceptance.gate.planFold": "收起完整方案",+ "acceptance.gate.planRead": "阅读完整方案","acceptance.gate.planTitle": "执行方案","acceptance.gate.releaseWave": "通过并放出第 {{wave}} 批({{count}} 项)","acceptance.gate.remaining": "之后还有 {{count}} 项,由主 Agent 逐批审核放行。按实验平均估算,总共约 {{estimate}} token。",@@ -286,10 +302,15 @@"acceptance.gate.unitArtifacts": "产出","acceptance.gate.unitArtifactsEmpty": "这一项没有登记产出。","acceptance.gate.unitBrief": "这一项要做什么",- "acceptance.gate.unitCount": "{{count}} 项",- "acceptance.gate.unitMeta": "{{runs}} 轮 · {{tokens}} token",- "acceptance.gate.unitReworked": "返工 {{rework}} 轮后通过。",- "acceptance.gate.unitReworkedCostly": "返工 {{rework}} 轮后通过,用量是平均的 {{ratio}} 倍。",+ "acceptance.gate.unitCount_one": "{{count}} 项",+ "acceptance.gate.unitCount_other": "{{count}} 项",+ "acceptance.gate.unitReworkedCostly_one": "返工 {{count}} 轮后通过,用量是平均的 {{ratio}} 倍。",+ "acceptance.gate.unitReworkedCostly_other": "返工 {{count}} 轮后通过,用量是平均的 {{ratio}} 倍。",+ "acceptance.gate.unitReworked_one": "返工 {{count}} 轮后通过。",+ "acceptance.gate.unitReworked_other": "返工 {{count}} 轮后通过。",+ "acceptance.gate.unitRuns_one": "{{count}} 轮",+ "acceptance.gate.unitRuns_other": "{{count}} 轮",+ "acceptance.gate.unitTokens": "{{tokens}} token","acceptance.gate.unitUnsettled": "没有顺利收尾,继续前先看看它的验收。","acceptance.gate.unitWaiting": "通过后开始","acceptance.gate.unitWaitingHint": "还没开始,通过后按上面的方案执行。",@@ -340,6 +361,7 @@"acceptance.local.shareHint": "评论、@ 提及和分享链接需要 LobeHub。让 Agent 发布这份验收,或运行:","acceptance.local.shareTitle": "和团队一起评审","acceptance.local.unsaved": "{{count}} 条评审未保存",+ "acceptance.notFound.back": "返回验收列表","acceptance.notFound.description": "它可能已被删除,也可能没有分享给你。","acceptance.notFound.title": "找不到这条验收","acceptance.origin.agentFallback": "智能体",@@ -401,6 +423,16 @@"acceptance.requirementEmptyEditable": "尚未记录验收目标,点击填写。","acceptance.requirementLabel": "验收目标","acceptance.resources.empty": "还没有文件 —— 各轮验证产生的证据会汇总到这里。",+ "acceptance.resources.emptyDescription": "各轮验证产生的证据会汇总到这里。",+ "acceptance.resources.emptyTitle": "还没有文件",+ "acceptance.resources.filter.all": "全部",+ "acceptance.resources.filter.other": "其他",+ "acceptance.resources.filter.recording": "录屏",+ "acceptance.resources.filter.screenshot": "截图",+ "acceptance.resources.filterLabel": "筛选文件",+ "acceptance.resources.noMatch": "没有符合筛选条件的文件",+ "acceptance.resources.roundLabel": "按轮次筛选",+ "acceptance.resources.showAll": "显示全部 {{count}} 个","acceptance.review.accept": "验收通过","acceptance.review.acceptAll": "全部验收","acceptance.review.acceptAllDone": "已全部验收",@@ -426,6 +458,7 @@"acceptance.review.ignoredNote": "已于 {{time}} 忽略,不再参与验收","acceptance.review.imageNumber": "图片 {{current}} / {{total}}","acceptance.review.mobileRegionCommentsEmpty": "在上方图片上拖动圈出区域,评论会出现在这里。",+ "acceptance.review.more": "更多操作","acceptance.review.nextImage": "下一张图片","acceptance.review.previousImage": "上一张图片","acceptance.review.regionComments": "圈选评论",@@ -441,13 +474,19 @@"acceptance.review.revertToReject": "改为拒绝","acceptance.review.submitFailed": "提交失败,草稿已保留,请重试。","acceptance.review.supplement": "补充说明(可选)",- "acceptance.review.supplementButton": "补充说明",- "acceptance.review.supplementButtonDraft": "补充说明 · 有草稿","acceptance.review.writeFeedback": "填写反馈","acceptance.review.zoomIn": "放大","acceptance.review.zoomOut": "缩小","acceptance.round": "第 {{round}} 轮","acceptance.roundCount": "{{count}} 轮验证",+ "acceptance.roundState.accepted": "已验收",+ "acceptance.roundState.errored": "异常",+ "acceptance.roundState.rejected": "交付已打回",+ "acceptance.roundState.repairing": "修复中",+ "acceptance.roundState.running": "进行中",+ "acceptance.roundState.summary": "已验收 {{accepted}}/{{total}}",+ "acceptance.roundState.toReview": "待验收",+ "acceptance.roundState.waiting": "等待验证","acceptance.roundStatus.errored": "异常","acceptance.roundStatus.failed": "失败","acceptance.roundStatus.passed": "通过",@@ -466,6 +505,10 @@"acceptance.share.title": "分享","acceptance.shell.back": "返回","acceptance.shell.menu": "查看验收列表",+ "acceptance.stage.fitHeight": "适应高度",+ "acceptance.stage.fitWidth": "适应宽度",+ "acceptance.stage.imagePosition": "{{current}} / {{total}}",+ "acceptance.stage.openComments": "{{count}} 条未解决的评论","acceptance.stats.failed": "{{count}} 失败","acceptance.stats.notExecuted": "{{count}} 未执行","acceptance.stats.passed": "{{count}} 通过",@@ -541,6 +584,23 @@"acceptance.video.reload": "重新加载","acceptance.video.seek": "进度","acceptance.video.speed": "倍速",+ "acceptance.video.story.addHint": "或在视频上拖动,框出有问题的区域",+ "acceptance.video.story.addNote": "在 {{time}} 添加批注",+ "acceptance.video.story.addSpanNote": "为 {{start}} – {{end}} 添加批注",+ "acceptance.video.story.coverSpan": "改为标注一段区间",+ "acceptance.video.story.delete": "删除",+ "acceptance.video.story.empty": "还没有批注。暂停在有问题的画面后添加批注,或直接在视频上拖动框选。",+ "acceptance.video.story.loadFailedBody": "链接可能已过期。",+ "acceptance.video.story.loadFailedTitle": "视频加载失败",+ "acceptance.video.story.noteCircled": "已在此帧框选",+ "acceptance.video.story.noteFrame": "针对此帧",+ "acceptance.video.story.notePin": "你的批注 {{index}},位于 {{time}}",+ "acceptance.video.story.noteSpan": "{{start}} 至 {{end}}",+ "acceptance.video.story.shortcuts": "键盘快捷键",+ "acceptance.video.story.singleFrame": "改为只标注一帧",+ "acceptance.video.story.title": "录屏里发生了什么",+ "acceptance.video.story.withdraw": "撤回",+ "acceptance.video.story.yourNote": "你的批注","acceptance.viewFullReport": "查看完整报告","acceptance.workspace.actions.delete": "删除","acceptance.workspace.actions.markAccepted": "标记为已验收",@@ -788,12 +848,13 @@"flow.expandGroup": "展开{{title}}","flow.expected": "预期表现","flow.fullscreen": "全屏查看",- "flow.graphView": "关系图",+ "flow.graphView": "故事板","flow.groupProgress": "{{passed}} / {{total}} 项验证通过","flow.groupReviewed": "{{count}} 项已验收","flow.instruction": "如何到达此状态","flow.latestResult": "最新结果","flow.noAttachments": "暂无附加证据,可先查看上方实际结果。",+ "flow.noPicture": "无截图","flow.nodeCount": "{{count}} 个节点","flow.outlineView": "步骤","flow.pendingPlan": "草稿",@@ -820,6 +881,17 @@"flow.state.uncertain": "不确定","flow.title": "验收流程","flow.unvisited": "此路径下的状态尚未验证。",+ "flow.unvisitedShort": "此路径未验证",+ "flow.walk.attempt": "第 {{number}} 次",+ "flow.walk.expected": "预期",+ "flow.walk.latestAttempt": "第 {{number}} 次 · 最新",+ "flow.walk.next": "下一步 · {{title}}",+ "flow.walk.observed": "实际",+ "flow.walk.position": "第 {{index}} / {{total}} 个状态",+ "flow.walk.previous": "上一步:{{title}}",+ "flow.walk.reachedBy": "经「{{trigger}}」到达",+ "flow.walk.reachedFrom": "从「{{source}}」经「{{trigger}}」到达",+ "flow.walk.start": "开始 · {{title}}","list.failedCount": "{{count}} 项未通过","list.running": "验证中…","meta.description": "验证运行、交付报告与验收评审。",diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.tsindex dc6d0c302a0..6e4e7aaee71 100644--- a/packages/locales/src/default/verify.ts+++ b/packages/locales/src/default/verify.ts@@ -78,7 +78,25 @@ export default {'acceptance.video.reload': 'Reload','acceptance.video.seek': 'Seek','acceptance.video.speed': 'Speed',- 'flow.graphView': 'Graph',+ 'acceptance.video.story.addHint': 'or drag on the video to circle the problem',+ 'acceptance.video.story.addNote': 'Add a note at {{time}}',+ 'acceptance.video.story.addSpanNote': 'Add a note on {{start}} – {{end}}',+ 'acceptance.video.story.coverSpan': 'Cover a span instead',+ 'acceptance.video.story.delete': 'Delete',+ 'acceptance.video.story.empty':+ 'No notes yet. Pause where something is wrong and add a note, or drag on the video to circle it.',+ 'acceptance.video.story.loadFailedBody': 'Its link may have expired.',+ 'acceptance.video.story.loadFailedTitle': 'The video failed to load',+ 'acceptance.video.story.noteCircled': 'circled on this frame',+ 'acceptance.video.story.noteFrame': 'on this frame',+ 'acceptance.video.story.notePin': 'Your note {{index}} at {{time}}',+ 'acceptance.video.story.noteSpan': 'from {{start}} to {{end}}',+ 'acceptance.video.story.shortcuts': 'Keyboard shortcuts',+ 'acceptance.video.story.singleFrame': 'Mark one frame instead',+ 'acceptance.video.story.title': 'What the recording shows',+ 'acceptance.video.story.withdraw': 'Withdraw',+ 'acceptance.video.story.yourNote': 'Your note',+ 'flow.graphView': 'Storyboard','flow.outlineView': 'Steps','flow.plan.requestChanges': 'Request changes','flow.plan.feedbackDescription':@@ -212,20 +230,42 @@ export default {'A note on the whole delivery, for anything the queued feedback doesn’t cover. The next verification round will read it.','acceptance.bar.copied': 'Copied — paste it into any agent to start the repair.','acceptance.bar.copyReview': 'Copy repair prompt',+ 'flow.noPicture': 'No screenshot',+ 'flow.unvisitedShort': 'Not verified on this path',+ 'flow.walk.attempt': 'Attempt {{number}}',+ 'flow.walk.expected': 'Expected',+ 'flow.walk.latestAttempt': 'Attempt {{number}} · latest',+ 'flow.walk.next': 'Next · {{title}}',+ 'flow.walk.observed': 'Observed',+ 'flow.walk.position': 'State {{index}} of {{total}}',+ 'flow.walk.previous': 'Previous: {{title}}',+ 'flow.walk.reachedBy': 'reached by “{{trigger}}”',+ 'flow.walk.reachedFrom': 'reached by “{{trigger}}” from {{source}}',+ 'flow.walk.start': 'Start · {{title}}',+ 'acceptance.filter.allLabel': 'All',+ 'acceptance.bar.stripLabel': '{{accepted}} of {{total}} checks accepted',+ 'acceptance.bar.tally.accepted': '{{count}} accepted',+ 'acceptance.bar.tally.ignored': '{{count}} ignored',+ 'acceptance.bar.tally.needsFix_one': '{{count}} needs a fix',+ 'acceptance.bar.tally.needsFix_other': '{{count}} need a fix',+ 'acceptance.bar.tally.pending': '{{count}} to review',+ 'acceptance.decision.notRun': 'Not run','acceptance.bar.feedback': 'Feedback {{count}}','acceptance.bar.needsFix': 'All reviewed — {{count}} to fix','acceptance.bar.progress':'{{done}} of {{total}} checks confirmed — {{rest}} awaiting your review',- 'acceptance.bar.progressDone': 'All {{total}} checks confirmed — ready to accept',- 'acceptance.bar.progressZero': '{{total}} checks awaiting your review',+ 'acceptance.bar.progressDone_one': 'The check is confirmed — ready to accept',+ 'acceptance.bar.progressDone_other': 'All {{count}} checks confirmed — ready to accept',+ 'acceptance.bar.progressZero_one': '{{count}} check awaiting your review',+ 'acceptance.bar.progressZero_other': '{{count}} checks awaiting your review','acceptance.bar.readOnlyReason':'Only the creator or a workspace member with edit access can accept or reject this delivery. You can still approve it, comment in Discussion, or request edit-collaboration access.','acceptance.bar.rejectComment': 'Reject delivery','acceptance.bar.rerun': 'Fix','acceptance.bar.rerunDrafted': 'Added to your composer — review and send it.','acceptance.bar.rerunSent': 'Sent to the source conversation — the repair round is starting.',- 'acceptance.checks.allAccepted.desc': 'Nice work — every acceptance check has been signed off.',- 'acceptance.checks.allAccepted.title': 'All checks accepted 🎉',+ 'acceptance.checks.allAccepted.desc': 'Every acceptance check has been signed off.',+ 'acceptance.checks.allAccepted.title': 'All checks accepted','acceptance.checks.copied': 'Copied','acceptance.checks.copySeq': 'Copy the check label','acceptance.checks.empty': 'No acceptance checks recorded yet',@@ -248,6 +288,7 @@ export default {'acceptance.checks.notRequired': 'Non-blocking','acceptance.checks.notRequiredHint': 'Optional — a failure here doesn’t block acceptance.','acceptance.checks.rerun': 'Verified in {{count}} rounds',+ 'acceptance.checks.showAll': 'Show all {{count}}','acceptance.checks.rerunHint': 'This check ran in {{count}} rounds; the latest result counts.','acceptance.checks.title': 'Acceptance checks','acceptance.checks.waived': 'Waived',@@ -269,6 +310,7 @@ export default {'acceptance.error.title': 'Unable to load acceptance','acceptance.notFound.description': 'It may have been deleted, or it was never shared with you.','acceptance.notFound.title': 'Acceptance not found',+ 'acceptance.notFound.back': 'Back to acceptances','acceptance.local.allSaved': 'All reviews saved','acceptance.local.badge': 'Local report','acceptance.local.badgeHint': 'Rendered on this computer. Nothing was uploaded.',@@ -325,6 +367,7 @@ export default {'acceptance.comments.historicalRegions':'{{count}} region note(s) on evidence replaced by a later round','acceptance.comments.empty': 'No discussion yet.',+ 'acceptance.comments.emptyTitle': 'No discussion yet','acceptance.comments.readOnly': 'You can read the discussion; sign in to take part.','acceptance.comments.region': 'Region','acceptance.comments.beforeDelivery': 'Before delivery',@@ -358,6 +401,7 @@ export default {'acceptance.comments.author.former': 'Former member','acceptance.comments.author.deactivated': 'Deactivated','acceptance.comments.loadFailed': 'Failed to load the discussion. Please refresh.',+ 'acceptance.comments.loadFailedTitle': 'Failed to load the discussion','acceptance.comments.copyLinkHint': '{{time}} · click to copy this comment’s link','acceptance.comments.createFailed': 'Failed to post the comment. Please try again.','acceptance.comments.deleteFailed': 'Failed to delete the comment. Please try again.',@@ -517,6 +561,7 @@ export default {'acceptance.review.fullscreen': 'Annotate in full screen','acceptance.review.fullscreenDone': 'Done annotating','acceptance.review.ignore': 'Ignore',+ 'acceptance.review.more': 'More actions','acceptance.review.ignoredNote': 'Ignored · {{time}}','acceptance.review.regionComments': 'Region comments','acceptance.review.regionCommentsEmpty':@@ -531,15 +576,25 @@ export default {'acceptance.review.revertToAccept': 'Accept instead','acceptance.review.revertToReject': 'Reject instead','acceptance.review.supplement': 'Additional notes (optional)',- 'acceptance.review.supplementButton': 'Notes',- 'acceptance.review.supplementButtonDraft': 'Notes · draft saved','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.review.zoomIn': 'Zoom in','acceptance.review.zoomOut': 'Zoom out',+ 'acceptance.stage.fitHeight': 'Fit height',+ 'acceptance.stage.fitWidth': 'Fit width',+ 'acceptance.stage.imagePosition': '{{current}} of {{total}}',+ 'acceptance.stage.openComments': '{{count}} open comment(s)','acceptance.round': 'Round {{round}}','acceptance.roundCount': '{{count}} verification round(s)',+ 'acceptance.roundState.accepted': 'Accepted',+ 'acceptance.roundState.errored': 'Errored',+ 'acceptance.roundState.rejected': 'Delivery rejected',+ 'acceptance.roundState.repairing': 'Repairing',+ 'acceptance.roundState.running': 'In progress',+ 'acceptance.roundState.summary': '{{accepted}} of {{total}} accepted',+ 'acceptance.roundState.toReview': 'To review',+ 'acceptance.roundState.waiting': 'Waiting for verification','acceptance.roundStatus.errored': 'Errored','acceptance.roundStatus.failed': 'Failed','acceptance.roundStatus.passed': 'Passed',@@ -571,20 +626,29 @@ export default {'Gate checks {{passed}}/{{total}} passed. They show the experiments finished, not that the plan carries over.','acceptance.gate.remaining':'{{count}} more after that, each wave reviewed by the main Agent. About {{estimate}} tokens in total, estimated from the experiments.',- 'acceptance.gate.unitMeta': '{{runs}} run(s) · {{tokens}} tokens',- 'acceptance.gate.unitReworkedCostly':- 'Passed after {{rework}} rework round(s), using {{ratio}}× the average.',- 'acceptance.gate.unitReworked': 'Passed after {{rework}} rework round(s).',+ 'acceptance.gate.unitRuns_one': '{{count}} run',+ 'acceptance.gate.unitRuns_other': '{{count}} runs',+ 'acceptance.gate.unitTokens': '{{tokens}} tokens',+ 'acceptance.gate.unitReworkedCostly_one':+ 'Passed after {{count}} rework round, using {{ratio}}× the average.',+ 'acceptance.gate.unitReworkedCostly_other':+ 'Passed after {{count}} rework rounds, using {{ratio}}× the average.',+ 'acceptance.gate.unitReworked_one': 'Passed after {{count}} rework round.',+ 'acceptance.gate.unitReworked_other': 'Passed after {{count}} rework rounds.','acceptance.gate.unitUnsettled': 'Did not settle cleanly. Check its acceptance before going on.','acceptance.gate.unitAcceptanceOpen': 'Open acceptance','acceptance.gate.unitAcceptance': 'Acceptance {{passed}}/{{total}}',- 'acceptance.gate.unitCount': '{{count}} units',+ 'acceptance.gate.unitCount_one': '{{count}} unit',+ 'acceptance.gate.unitCount_other': '{{count}} units','acceptance.gate.resultsWave': 'Last wave','acceptance.gate.resultsProbes': 'Experiment results','acceptance.gate.hideFiles': 'Hide files','acceptance.gate.showFiles': 'Show the skill files','acceptance.gate.planFiles': '{{count}} files','acceptance.gate.planTitle': 'Execution plan',+ 'acceptance.gate.planRead': 'Read the full plan',+ 'acceptance.gate.planFold': 'Hide the full plan',+ 'acceptance.gate.panelClose': 'Close','acceptance.gate.agentSays': 'Main Agent: {{reason}}','acceptance.gate.unitArtifacts': 'Outputs','acceptance.gate.unitArtifactsEmpty': 'No outputs registered for this unit.',@@ -612,6 +676,16 @@ export default {'acceptance.shell.back': 'Back','acceptance.shell.menu': 'Show Acceptance menu','acceptance.resources.empty': 'No files yet. Evidence from each round will appear here.',+ 'acceptance.resources.emptyDescription': 'Evidence from each round will appear here.',+ 'acceptance.resources.emptyTitle': 'No files yet',+ 'acceptance.resources.filter.all': 'All',+ 'acceptance.resources.filter.other': 'Other',+ 'acceptance.resources.filter.recording': 'Recordings',+ 'acceptance.resources.filter.screenshot': 'Screenshots',+ 'acceptance.resources.filterLabel': 'Filter files',+ 'acceptance.resources.noMatch': 'No files match this filter',+ 'acceptance.resources.roundLabel': 'Filter by round',+ 'acceptance.resources.showAll': 'Show all {{count}}','acceptance.tabs.checks': 'Checklist','acceptance.tabs.resources': 'Files','acceptance.subject.document': 'Document',diff --git a/plugins/vite/sharedRendererConfig.test.ts b/plugins/vite/sharedRendererConfig.test.tsindex 05bd756b398..dec134f4c3a 100644--- a/plugins/vite/sharedRendererConfig.test.ts+++ b/plugins/vite/sharedRendererConfig.test.ts@@ -70,6 +70,7 @@ describe('sharedOptimizeDeps', () => {expect(sharedOptimizeDeps.exclude).toEqual(['@lobehub/ui/stylex/cssVar.stylex','@lobehub/ui/stylex/media.stylex',+ 'mdast-util-to-markdown',]);});});diff --git a/plugins/vite/sharedRendererConfig.ts b/plugins/vite/sharedRendererConfig.tsindex 3c2e7d7cb88..faf3bfd3495 100644--- a/plugins/vite/sharedRendererConfig.ts+++ b/plugins/vite/sharedRendererConfig.ts@@ -578,7 +578,10 @@ export function sharedRendererDefine(options: { isElectron: boolean; isMobile: b}export const sharedOptimizeDeps = {- exclude: [...stylexTokenModules],+ // Vite resolves an optimized dep by bare name for every importer. Pre-bundling+ // the workspace-pinned 2.1.x would hand it to mdast-util-to-markdown-cjk-friendly,+ // which needs the 2.2 attention API, and <Markdown> throws in dev.+ exclude: [...stylexTokenModules, 'mdast-util-to-markdown'],include: ['react','react-dom',diff --git a/scripts/stylexMigration/legacyFiles.json b/scripts/stylexMigration/legacyFiles.jsonindex e1183c86cae..2a92ebe0d77 100644--- a/scripts/stylexMigration/legacyFiles.json+++ b/scripts/stylexMigration/legacyFiles.json@@ -68,8 +68,6 @@"packages/builtin-tools/src/codex/ErrorInspector.tsx","packages/builtin-tools/src/github/RunCommandInspector.tsx","packages/shared-tool-ui/src/styles.ts",- "src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx",- "src/features/Acceptance/Viewer/Review/rejectModalShell.ts","src/features/AgentBreadcrumb/index.tsx","src/features/AgentBuilder/TopicSelector.tsx","src/features/AgentChannel/PlatformCard.tsx",diff --git a/src/features/Acceptance/Report/VisualizationRenderer.tsx b/src/features/Acceptance/Report/VisualizationRenderer.tsxindex 4e8a8b7e071..d56d7846468 100644--- a/src/features/Acceptance/Report/VisualizationRenderer.tsx+++ b/src/features/Acceptance/Report/VisualizationRenderer.tsx@@ -73,6 +73,7 @@ const styles = stylex.create({},body: { minWidth: '0', padding: '14px' },card: {+ containerType: 'inline-size',overflow: 'hidden',borderWidth: '1px',borderStyle: 'solid',@@ -123,7 +124,7 @@ const styles = stylex.create({display: 'grid',gridTemplateColumns: {'default': 'minmax(120px, 1fr) minmax(240px, 2.4fr) auto',- '@media (width <= 640px)': '1fr auto',+ '@container (width <= 520px)': '1fr auto',},gap: '16px',alignItems: 'center',@@ -180,8 +181,8 @@ const styles = stylex.create({display: 'flex',flexDirection: 'column',gap: '9px',- gridColumn: { 'default': null, '@media (width <= 640px)': '1 / -1' },- gridRow: { 'default': null, '@media (width <= 640px)': 2 },+ gridColumn: { 'default': null, '@container (width <= 520px)': '1 / -1' },+ gridRow: { 'default': null, '@container (width <= 520px)': 2 },},valueText: {display: 'flex',diff --git a/src/features/Acceptance/Viewer/AcceptanceNotFound.tsx b/src/features/Acceptance/Viewer/AcceptanceNotFound.tsxnew file mode 100644index 00000000000..43cb1011e72--- /dev/null+++ b/src/features/Acceptance/Viewer/AcceptanceNotFound.tsx@@ -0,0 +1,45 @@+'use client';++import { Button, Icon } from '@lobehub/ui';+import { ArrowLeft, Lock } from 'lucide-react';+import { useTranslation } from 'react-i18next';+import { useNavigate } from 'react-router';++import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';+import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';++import QuietState from './QuietState';+import { acceptanceListPath, useAcceptanceRouteBase } from './routes';++const BackToAcceptances = () => {+ const { t } = useTranslation('verify');+ const navigate = useNavigate();+ const routeBase = useAcceptanceRouteBase();+ const workspaceSlug = useActiveWorkspaceSlug();++ return (+ <Button+ icon={<Icon icon={ArrowLeft} />}+ onClick={() =>+ navigate(buildWorkspaceAwarePath(acceptanceListPath(routeBase), workspaceSlug))+ }+ >+ {t('acceptance.notFound.back')}+ </Button>+ );+};++const AcceptanceNotFound = ({ embedded }: { embedded: boolean }) => {+ const { t } = useTranslation('verify');++ return (+ <QuietState+ action={embedded ? undefined : <BackToAcceptances />}+ description={t('acceptance.notFound.description')}+ icon={Lock}+ title={t('acceptance.notFound.title')}+ />+ );+};++export default AcceptanceNotFound;diff --git a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx b/src/features/Acceptance/Viewer/AcceptanceOverview.tsxindex aa73708fa8d..9ce1d33d8eb 100644--- a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx+++ b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx@@ -19,6 +19,7 @@ import { useAcceptanceComments } from './Comments/hooks';import ReviewerApprovalBar from './Comments/ReviewerApprovalBar';import AcceptanceOriginTopic from './Conversation/AcceptanceOriginTopic';import AcceptanceResources from './Evidence/AcceptanceResources';+import { collectResources } from './Evidence/resources';import { AcceptanceFlow } from './Flow/AcceptanceFlow';import { getFlowNodeCount, resolveAcceptanceTab } from './Flow/flowNavigation';import AcceptanceEnterFocus from './Focus/AcceptanceEnterFocus';@@ -87,13 +88,7 @@ export const AcceptanceOverview = ({// A Goal decision gate reviews its own frozen dossier, not a checklist.const gateDossier =data?.subject.type === 'goal_gate' ? rounds.at(-1)?.run.metadata?.releaseGate : undefined;- const resourceCount = new Set(- checks.flatMap((check) =>- (check.evidence ?? [])- .filter((evidence) => evidence.fileUrl || evidence.documentId)- .map((evidence) => evidence.fileId ?? evidence.documentId ?? evidence.id),- ),- ).size;+ const resourceCount = collectResources(data?.checks ?? []).length;return (<>diff --git a/src/features/Acceptance/Viewer/AcceptanceScope.tsx b/src/features/Acceptance/Viewer/AcceptanceScope.tsxindex 185fd15b513..209a8963615 100644--- a/src/features/Acceptance/Viewer/AcceptanceScope.tsx+++ b/src/features/Acceptance/Viewer/AcceptanceScope.tsx@@ -1,11 +1,14 @@'use client';-import { Button, Center, Empty, Spin } from '@lobehub/ui';+import { Button, Center, Icon, Spin } from '@lobehub/ui';+import { Info, RefreshCw } from 'lucide-react';import { createContext, type ReactNode, use } from 'react';import { useTranslation } from 'react-i18next';import { isTrpcErrorCode } from '@/utils/trpcError';+import AcceptanceNotFound from './AcceptanceNotFound';+import QuietState from './QuietState';import { useAcceptanceBundle } from './useAcceptanceBundle';type AcceptanceScopeValue = {@@ -44,7 +47,7 @@ export const AcceptanceBundleGate = ({height?: string | number;}) => {const { t } = useTranslation('verify');- const { acceptanceId } = useAcceptanceScope();+ const { acceptanceId, embedded } = useAcceptanceScope();const { data, error, isLoading, mutate } = useAcceptanceBundle(acceptanceId);if (isLoading && !data) {@@ -64,10 +67,7 @@ export const AcceptanceBundleGate = ({if (!data && isTrpcErrorCode(error, 'NOT_FOUND')) {return (<Center height={height}>- <Empty- description={t('acceptance.notFound.description')}- title={t('acceptance.notFound.title')}- />+ <AcceptanceNotFound embedded={embedded} /></Center>);}@@ -75,9 +75,17 @@ export const AcceptanceBundleGate = ({if (!data) {return (<Center height={height}>- <Empty description={t('acceptance.error.description')} title={t('acceptance.error.title')}>- <Button onClick={() => void mutate()}>{t('report.actions.retry')}</Button>- </Empty>+ <QuietState+ description={t('acceptance.error.description')}+ icon={Info}+ title={t('acceptance.error.title')}+ tone={'warning'}+ action={+ <Button icon={<Icon icon={RefreshCw} />} onClick={() => void mutate()}>+ {t('report.actions.retry')}+ </Button>+ }+ /></Center>);}diff --git a/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsxindex 51262aa9eb1..015067fc8a6 100644--- a/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx+++ b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx@@ -1,27 +1,28 @@'use client';import { isDraftVerifyRun } from '@lobechat/const/verify';-import { ActionIcon, Flexbox, Select, Text, toast, useResponsive } from '@lobehub/ui';+import { ActionIcon, Flexbox, Select, toast, useResponsive } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { ChevronsDownUp, ChevronsUpDown } from 'lucide-react';import type { ReactNode } from 'react';-import { useCallback, useEffect, useState } from 'react';+import { use, useCallback, useEffect, useState } from 'react';import { useTranslation } from 'react-i18next';import { useSearchParams } from 'react-router';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';-import { useSingleton } from '@/hooks/useSingleton';import { verifyService } from '@/services/verify';import { useVerifyStore } from '@/store/verify';import { useAcceptanceScope } from '../AcceptanceScope';import { hasVisualEvidence } from '../Evidence/evidence';import AcceptanceInteractionCost from '../History/AcceptanceInteractionCost';+import { RunsPanelContext } from '../History/runsPanel';import { acceptanceCheckPath, useAcceptanceRouteBase } from '../routes';import { checksForTurn } from '../turnChecks';import { useAcceptanceBundle } from '../useAcceptanceBundle';import { useAcceptanceTurn } from '../useAcceptanceTurn';-import { canReviewAcceptance } from '../visibility';+import { canReviewAcceptance, canViewAcceptanceHistory } from '../visibility';import CheckList from './CheckList';import {type CheckFilter,@@ -35,8 +36,60 @@ import {import { EMPTY_ID_SET, setAggregateEntry } from './expandState';import { collectGroupFeedback } from './readPresentation';+const FILTER_TABS = [+ { key: 'pending', labelKey: 'acceptance.focus.state.pending' },+ { key: 'needsFix', labelKey: 'acceptance.focus.state.needsFix' },+ { key: 'accepted', labelKey: 'acceptance.focus.state.accepted' },+ { key: 'ignored', labelKey: 'acceptance.focus.state.ignored' },+ { key: 'all', labelKey: 'acceptance.filter.allLabel' },+] as const;+const styles = stylex.create({filters: { width: { 'default': null, '@media (width <= 767px)': '100%' } },+ filterTabs: {+ display: 'flex',+ flex: '1',+ gap: '4px',+ alignItems: 'center',+ minWidth: 0,+ overflowX: 'auto',+ scrollbarWidth: 'none',+ },+ filterTab: {+ cursor: 'pointer',+ display: 'inline-flex',+ flex: 'none',+ gap: '6px',+ alignItems: 'center',+ height: '28px',+ margin: 0,+ paddingBlock: 0,+ paddingInline: '8px',+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '6px',+ font: 'inherit',+ fontSize: '14px',+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },+ whiteSpace: 'nowrap',+ backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },+ outlineWidth: { 'default': 0, ':focus-visible': '2px' },+ outlineStyle: { 'default': 'none', ':focus-visible': 'solid' },+ outlineColor: cssVar.colorPrimary,+ outlineOffset: '2px',+ },+ filterTabActive: {+ fontWeight: 500,+ color: { 'default': cssVar.colorText, ':hover': cssVar.colorText },+ backgroundColor: { 'default': cssVar.colorFillSecondary, ':hover': cssVar.colorFillSecondary },+ },+ filterCount: {+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ fontWeight: 400,+ color: cssVar.colorTextTertiary,+ },filterSelect: {width: { 'default': '118px', '@media (width <= 767px)': '0' },flex: { 'default': null, '@media (width <= 767px)': '1' },@@ -104,15 +157,15 @@ const AcceptanceCheckInventory = ({setCollapsedById((map) => setAggregateEntry(map, acceptanceId, update)),[acceptanceId],);- const seededIds = useSingleton(() => new Set<string>());+ const [seededIds, setSeededIds] = useState<ReadonlySet<string>>(() => new Set());+ const [urlSeed, setUrlSeed] = useState<{ acceptanceId: string; filter: CheckFilter }>();- useEffect(() => {- if (!data || data.checks.length === 0) return;- if (seededIds.has(acceptanceId)) return;- seededIds.add(acceptanceId);+ const seedChecks = data?.checks ?? [];+ if (data && seedChecks.length > 0 && !seededIds.has(acceptanceId)) {+ setSeededIds(new Set(seededIds).add(acceptanceId));setExpanded(new Set(- data.checks+ seedChecks.filter((check) =>window.matchMedia('(min-width: 768px)').matches &&@@ -123,43 +176,37 @@ const AcceptanceCheckInventory = ({),);setCollapsedGroups(- shouldGroupChecks(data.checks.length)+ shouldGroupChecks(seedChecks.length)? new Set(- groupChecks(data.checks, t('acceptance.group.uncategorized'))+ groupChecks(seedChecks, t('acceptance.group.uncategorized')).filter((group) => isGroupFullyAccepted(group.checks)).map((group) => group.key),): new Set(),);- const defaultFilter: CheckFilter = data.rounds.length > 1 ? 'pending' : 'all';+ const defaultFilter: CheckFilter = (data.rounds ?? []).length > 1 ? 'pending' : 'all';if (embedded) {setLocalFilter(defaultFilter);} else if (!urlFilterRaw && !roundFilter && defaultFilter !== 'all') {- setSearchParams(- (prev) => {- const params = new URLSearchParams(prev);- params.set('filter', defaultFilter);- return params;- },- { replace: true },- );+ setUrlSeed({ acceptanceId, filter: defaultFilter });}- }, [- acceptanceId,- data,- embedded,- seededIds,- setCollapsedGroups,- setExpanded,- setSearchParams,- t,- urlFilterRaw,- roundFilter,- md,- ]);+ }++ useEffect(() => {+ if (!urlSeed) return;+ setSearchParams(+ (prev) => {+ const params = new URLSearchParams(prev);+ params.set('filter', urlSeed.filter);+ return params;+ },+ { replace: true },+ );+ }, [setSearchParams, urlSeed]);if (!data) return null;+ const hasRunsPanel = use(RunsPanelContext);const canReview =canReviewAcceptance(data) &&(roundFilter === null || roundFilter === data.rounds.at(-1)?.run.roundIndex);@@ -228,11 +275,27 @@ const AcceptanceCheckInventory = ({flex={1}gap={8}>- <Text strong style={{ fontSize: 14, whiteSpace: 'nowrap' }}>- {t('acceptance.checks.title')}- </Text>+ <div+ aria-label={t('acceptance.checks.title')}+ role={'group'}+ {...stylex.props(styles.filterTabs)}+ >+ {FILTER_TABS.map(({ key, labelKey }) => (+ <button+ aria-pressed={filter === key}+ key={key}+ type={'button'}+ {...stylex.props(styles.filterTab, filter === key && styles.filterTabActive)}+ onClick={() => setFilter(key)}+ >+ {t(labelKey)}+ <span {...stylex.props(styles.filterCount)}>+ {key === 'all' ? counts.total : counts[key]}+ </span>+ </button>+ ))}+ </div>{titleExtra}- <Flexbox flex={1} />{toolbar}</Flexbox><Flexbox@@ -241,31 +304,6 @@ const AcceptanceCheckInventory = ({className={stylex.props(styles.filters).className}gap={8}>- <Select- className={stylex.props(styles.filterSelect).className}- value={filter}- variant={'filled'}- options={[- { label: t('acceptance.filter.all', { count: counts.total }), value: 'all' },- {- label: t('acceptance.filter.pending', { count: counts.pending }),- value: 'pending',- },- {- label: t('acceptance.filter.needsFix', { count: counts.needsFix }),- value: 'needsFix',- },- {- label: t('acceptance.filter.accepted', { count: counts.accepted }),- value: 'accepted',- },- {- label: t('acceptance.filter.ignored', { count: counts.ignored }),- value: 'ignored',- },- ]}- onChange={(value) => setFilter(value as CheckFilter)}- />{data.rounds.length > 1 && (<SelectclassName={stylex.props(styles.filterSelect).className}@@ -312,6 +350,7 @@ const AcceptanceCheckInventory = ({onOpenCheck={openCheckPage}onOpenTrace={onOpenTrace}onRound={setRoundFilter}+ onShowAll={() => setFilter('all')}onDismissProposal={canReview? async (input) => {@@ -370,8 +409,12 @@ const AcceptanceCheckInventory = ({}/>{/* After the list, never inside it: the checks are the decision surface,- and a row sitting among them reads as one more thing to review. */}- <AcceptanceInteractionCost data={data} />+ and a row sitting among them reads as one more thing to review. Whoever+ can open the Runs panel already reads the cost there; a host that+ mounts the inventory alone has no such panel. */}+ {!(hasRunsPanel && canViewAcceptanceHistory(data.isOwner)) && (+ <AcceptanceInteractionCost data={data} />+ )}</>);};diff --git a/src/features/Acceptance/Viewer/Checks/CheckGroupHeader.tsx b/src/features/Acceptance/Viewer/Checks/CheckGroupHeader.tsxnew file mode 100644index 00000000000..1f86111b791--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckGroupHeader.tsx@@ -0,0 +1,231 @@+import { ActionIcon, Button, Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import {+ BadgeCheck,+ ChevronDown,+ ChevronRight,+ ChevronsDownUp,+ ChevronsUpDown,+ MessageSquareText,+} from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import DecisionStrip from '../Review/DecisionStrip';+import { decisionSegments } from './checkDecision';+import { isException, isGroupFullyAccepted, userReviewState } from './checkState';+import type { AcceptanceCheck } from './types';++const phone = '@media (width <= 767px)';++const styles = stylex.create({+ header: {+ cursor: 'pointer',+ display: 'flex',+ flexWrap: { default: null, [phone]: 'wrap' },+ gap: '8px',+ alignItems: 'center',+ minHeight: '44px',+ paddingBlock: '8px',+ paddingInline: '16px',+ borderBlockStartWidth: '1px',+ borderBlockStartStyle: { 'default': 'solid', ':first-child': 'none' },+ borderBlockStartColor: cssVar.colorBorderSecondary,+ backgroundColor: cssVar.colorFillQuaternary,+ },+ toggle: {+ cursor: 'pointer',+ display: 'flex',+ gap: '8px',+ flexBasis: { default: null, [phone]: '100%' },+ alignItems: 'center',+ minWidth: 0,+ margin: 0,+ padding: 0,+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '4px',+ font: 'inherit',+ textAlign: 'start',+ appearance: 'none',+ backgroundColor: 'transparent',+ outlineWidth: { 'default': 0, ':focus-visible': '2px' },+ outlineStyle: { 'default': 'none', ':focus-visible': 'solid' },+ outlineColor: cssVar.colorPrimary,+ outlineOffset: '2px',+ },+ label: {+ overflow: 'hidden',+ minWidth: 0,+ fontSize: '14px',+ fontWeight: 600,+ lineHeight: '22px',+ color: cssVar.colorText,+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ },+ strip: {+ flex: 'none',+ width: '64px',+ },+ stat: {+ flex: 'none',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ whiteSpace: 'nowrap',+ },+ statError: { color: cssVar.colorErrorText },+ statDone: {+ display: 'inline-flex',+ gap: '4px',+ alignItems: 'center',+ color: cssVar.colorSuccessText,+ },+ spacer: { flex: '1' },+});++interface CheckGroupHeaderProps {+ accepting: boolean;+ anyItemOpen: boolean;+ canReview: boolean;+ checks: AcceptanceCheck[];+ collapsed: boolean;+ label: string;+ onAcceptAll: (ids: string[]) => void;+ onFeedback: () => void;+ onToggle: () => void;+ onToggleItems?: () => void;+ reviewPending: boolean;+}++const CheckGroupHeader = memo<CheckGroupHeaderProps>(+ ({+ accepting,+ anyItemOpen,+ canReview,+ checks,+ collapsed,+ label,+ onAcceptAll,+ onFeedback,+ onToggle,+ onToggleItems,+ reviewPending,+ }) => {+ const { t } = useTranslation('verify');+ const reviewable = checks.filter((check) => check.result);+ const countReview = (state: ReturnType<typeof userReviewState>) =>+ reviewable.filter((check) => userReviewState(check) === state).length;+ const acceptedCount = countReview('accepted');+ const rejectedCount = countReview('rejected');+ const ignoredCount = countReview('ignored');+ const unaccepted = reviewable.filter(+ (check) => !['accepted', 'ignored'].includes(userReviewState(check)),+ );+ const exceptionCount = checks.filter((check) => isException(check)).length;+ const passed = checks.filter((check) => check.state === 'passed').length;+ const allVerified = passed === checks.length && isGroupFullyAccepted(checks);++ return (+ <div {...stylex.props(styles.header)} onClick={onToggle}>+ <button+ aria-expanded={!collapsed}+ type={'button'}+ {...stylex.props(styles.toggle)}+ onClick={(event) => {+ event.stopPropagation();+ onToggle();+ }}+ >+ <Icon+ color={cssVar.colorTextQuaternary}+ icon={collapsed ? ChevronRight : ChevronDown}+ size={14}+ />+ <span {...stylex.props(styles.label)}>{label}</span>+ </button>+ <DecisionStrip+ label={t('acceptance.bar.stripLabel', { accepted: acceptedCount, total: checks.length })}+ segments={decisionSegments(checks)}+ xstyle={styles.strip}+ />+ {allVerified ? (+ <span {...stylex.props(styles.stat, styles.statDone)}>+ <Icon icon={BadgeCheck} size={14} />+ {t('acceptance.group.allVerified', { passed, total: checks.length })}+ </span>+ ) : (+ <>+ <span {...stylex.props(styles.stat)}>+ {t('acceptance.group.acceptedRatio', {+ accepted: acceptedCount,+ total: checks.length,+ })}+ </span>+ {exceptionCount > 0 && (+ <span {...stylex.props(styles.stat, styles.statError)}>+ {t('acceptance.group.failedCount', { count: exceptionCount })}+ </span>+ )}+ {rejectedCount > 0 && (+ <span {...stylex.props(styles.stat, styles.statError)}>+ {t('acceptance.group.rejectedCount', { count: rejectedCount })}+ </span>+ )}+ {ignoredCount > 0 && (+ <span {...stylex.props(styles.stat)}>+ {t('acceptance.group.ignoredCount', { count: ignoredCount })}+ </span>+ )}+ </>+ )}+ <span {...stylex.props(styles.spacer)} />+ {canReview && unaccepted.length > 0 && (+ <Button+ disabled={reviewPending && !accepting}+ icon={<Icon icon={BadgeCheck} />}+ loading={accepting}+ size={'small'}+ onClick={(event) => {+ event.stopPropagation();+ onAcceptAll(unaccepted.map((check) => check.id));+ }}+ >+ {t('acceptance.review.acceptAll')}+ </Button>+ )}+ {canReview && (+ <ActionIcon+ icon={MessageSquareText}+ size={'small'}+ title={t('acceptance.group.feedbackAction')}+ onClick={(event) => {+ event.stopPropagation();+ onFeedback();+ }}+ />+ )}+ {!collapsed && onToggleItems && (+ <ActionIcon+ icon={anyItemOpen ? ChevronsDownUp : ChevronsUpDown}+ size={'small'}+ title={+ anyItemOpen ? t('acceptance.group.collapseItems') : t('acceptance.group.expandItems')+ }+ onClick={(event) => {+ event.stopPropagation();+ onToggleItems();+ }}+ />+ )}+ </div>+ );+ },+);++CheckGroupHeader.displayName = 'AcceptanceCheckGroupHeader';++export default CheckGroupHeader;diff --git a/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx b/src/features/Acceptance/Viewer/Checks/CheckHistory.tsxindex 84acf6fb75a..16fd33adc89 100644--- a/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx+++ b/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx@@ -62,8 +62,9 @@ export const IgnoredNote = memo<{ review: AcceptanceCheckReviewEntry }>(({ revie*/export const FeedbackCard = memo<{evidenceById: Map<string, AcceptanceEvidence>;+ hideHeader?: boolean;review: AcceptanceCheckReviewEntry;-}>(({ evidenceById, review }) => {+}>(({ evidenceById, hideHeader, review }) => {const { t } = useTranslation('verify');const hydrated = useIsHydrated();if (review.action === 'accept') return <AcceptedNote review={review} />;@@ -78,15 +79,17 @@ export const FeedbackCard = memo<{return (<Flexbox gap={8}>- <Flexbox horizontal align={'center'} gap={6}>- <Icon color={cssVar.colorError} icon={MessageSquareX} size={13} />- <Text style={{ color: cssVar.colorError, fontSize: 12 }}>- {t('acceptance.review.feedbackLabel')}- </Text>- <Text fontSize={12} type={'secondary'}>- {hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : null}- </Text>- </Flexbox>+ {!hideHeader && (+ <Flexbox horizontal align={'center'} gap={6}>+ <Icon color={cssVar.colorError} icon={MessageSquareX} size={13} />+ <Text style={{ color: cssVar.colorError, fontSize: 12 }}>+ {t('acceptance.review.feedbackLabel')}+ </Text>+ <Text fontSize={12} type={'secondary'}>+ {hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : null}+ </Text>+ </Flexbox>+ )}{review.comment && <Text style={{ fontSize: 12 }}>{review.comment}</Text>}<AttachmentThumbs attachments={review.attachments} />{[...groups.entries()].map(([evidenceId, annotations]) => {diff --git a/src/features/Acceptance/Viewer/Checks/CheckList.tsx b/src/features/Acceptance/Viewer/Checks/CheckList.tsxindex b139b1087b8..df57f2fd8d6 100644--- a/src/features/Acceptance/Viewer/Checks/CheckList.tsx+++ b/src/features/Acceptance/Viewer/Checks/CheckList.tsx@@ -1,31 +1,20 @@'use client';import type { AcceptanceGroupFeedback } from '@lobechat/types';-import { ActionIcon, Button, cssVar, Empty, Flexbox, Icon, Text } from '@lobehub/ui';+import { Button, Flexbox } from '@lobehub/ui';import * as stylex from '@stylexjs/stylex';-import {- BadgeCheck,- ChevronRight,- ChevronsDownUp,- ChevronsUpDown,- CircleDashed,- MessageSquareText,- PartyPopper,-} from 'lucide-react';import { Fragment, memo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { sx } from '@/styles/sx';-import { hasVisualEvidence } from '../Evidence/evidence';-import { groupHeaderMarker } from '../markers.stylex';import { openGroupFeedbackModal } from '../Review/modals';+import { decisionSections } from './checkDecision';+import CheckGroupHeader from './CheckGroupHeader';import { AcceptanceCheckRow } from './CheckRow';import type { CheckFilter } from './checkState';import {checkFilterState,groupChecks,- isException,isGroupFullyAccepted,SEVERITY,shouldGroupChecks,@@ -60,6 +49,7 @@ interface CheckListProps {/** Record the user's verdict; resolves true when the write landed. */onReview: (input: CheckReviewInput) => Promise<boolean>;onRound?: (round: number) => void;+ onShowAll?: () => void;onToggleGroup: (key: string) => void;onToggleGroupItems: (ids: string[], open: boolean) => void;onToggleItem: (id: string) => void;@@ -82,6 +72,7 @@ const CheckList = memo<CheckListProps>(onReview,onOpenTrace,onRound,+ onShowAll,onToggleGroup,onToggleGroupItems,onToggleItem,@@ -115,253 +106,117 @@ const CheckList = memo<CheckListProps>(})).filter((group) => group.rows.length > 0);- // A filter that matches nothing must read as "this bucket is empty", not as- // a blank bordered card — each filter gets its own reassuring line. But an- // EMPTY pending bucket where every check is signed off isn't "nothing here"- // — it's the finish line, so it earns a celebration instead of a flat line.if (visibleRows.length === 0) {+ // An empty pending bucket where every check is signed off is the finish+ // line, not "nothing here".const allAccepted = filter === 'pending' && isGroupFullyAccepted(checks);+ const emptyKey =+ filter === 'all'+ ? ('acceptance.checks.empty' as const)+ : (`acceptance.checks.emptyFilter.${filter}` as const);return (- <Flexbox align={'center'} gap={12} justify={'center'} {...stylex.props(styles.emptyCard)}>- {allAccepted ? (- <>- <Icon- {...stylex.props(styles.celebrateIcon)}- color={cssVar.colorSuccess}- icon={PartyPopper}- size={40}- />- <Flexbox align={'center'} gap={4}>- <Text strong style={{ color: cssVar.colorSuccess, fontSize: 15 }}>- {t('acceptance.checks.allAccepted.title')}- </Text>- <Text fontSize={13} type={'secondary'}>- {t('acceptance.checks.allAccepted.desc')}- </Text>- </Flexbox>- </>- ) : (- <Empty- icon={CircleDashed}- description={t(- filter === 'all'- ? 'acceptance.checks.empty'- : `acceptance.checks.emptyFilter.${filter}`,- )}- />+ <div {...stylex.props(styles.emptyState)}>+ <span {...stylex.props(styles.emptyTitle)}>+ {allAccepted ? t('acceptance.checks.allAccepted.title') : t(emptyKey)}+ </span>+ {allAccepted && (+ <span {...stylex.props(styles.emptyDesc)}>+ {t('acceptance.checks.allAccepted.desc')}+ </span>)}- </Flexbox>+ {filter !== 'all' && checks.length > 0 && onShowAll && (+ <Button onClick={onShowAll}>+ {t('acceptance.checks.showAll', { count: checks.length })}+ </Button>+ )}+ </div>);}if (!shouldGroupChecks(checks.length)) {+ const sections = filter === 'all' ? decisionSections(visibleRows) : [];+ const renderRow = (check: AcceptanceCheck) => (+ <AcceptanceCheckRow+ canReview={canReview}+ check={check}+ expanded={expanded.has(check.id)}+ key={check.id}+ reviewPending={reviewPending}+ onDismissProposal={onDismissProposal}+ onOpenDetail={onOpenCheck ? () => onOpenCheck(check.id) : undefined}+ onOpenTrace={onOpenTrace}+ onReview={onReview}+ onRound={onRound}+ onToggle={() => onToggleItem(check.id)}+ />+ );return (<Flexbox {...stylex.props(styles.groupCard)}>- {visibleRows.map((check) => (- <AcceptanceCheckRow- canReview={canReview}- check={check}- expanded={expanded.has(check.id)}- key={check.id}- reviewPending={reviewPending}- onDismissProposal={onDismissProposal}- onOpenDetail={onOpenCheck ? () => onOpenCheck(check.id) : undefined}- onOpenTrace={onOpenTrace}- onReview={onReview}- onRound={onRound}- onToggle={() => onToggleItem(check.id)}- />- ))}+ {sections.length > 1+ ? sections.map((section) => (+ <Fragment key={section.key}>+ <div {...stylex.props(styles.sectionHeader)}>+ {t(`acceptance.focus.state.${section.key}`)}+ <span {...stylex.props(styles.sectionCount)}>{section.checks.length}</span>+ </div>+ <div>{section.checks.map(renderRow)}</div>+ </Fragment>+ ))+ : visibleRows.map(renderRow)}</Flexbox>);}return (<Flexbox {...stylex.props(styles.groupCard)}>- {groups.map(({ checks: groupChecks_, key, label, rows }, groupIndex) => {- const passed = groupChecks_.filter((check) => check.state === 'passed').length;+ {groups.map(({ checks: groupChecks_, key, label, rows }) => {const collapsed = collapsedGroups.has(key);const anyItemOpen = rows.some((check) => expanded.has(check.id));- // Only executed checks can be stamped — see the row-level gating.- const reviewableChecks = groupChecks_.filter((check) => check.result);- const unaccepted = reviewableChecks.filter(- (check) => !['accepted', 'ignored'].includes(userReviewState(check)),- );- // The header counts what the REVIEWER cares about: how many they- // signed off, how many the verifier flagged, how many they sent- // back — not the verifier's pass tally alone.- const acceptedCount = reviewableChecks.filter(- (check) => userReviewState(check) === 'accepted',- ).length;- const rejectedCount = reviewableChecks.filter(- (check) => userReviewState(check) === 'rejected',- ).length;- const ignoredCount = reviewableChecks.filter(- (check) => userReviewState(check) === 'ignored',- ).length;- const exceptionCount = groupChecks_.filter((check) => isException(check)).length;- // Everything passed AND the user signed all of it off — the ratio- // itself turns into the green receipt, no separate right-side note.- const allVerified = passed === groupChecks_.length && isGroupFullyAccepted(groupChecks_);// Group-scoped feedback targets the raw category ('' = uncategorized).const rawCategory = key === 'uncategorized' ? '' : label;const feedbackEntries = groupFeedback.filter((entry) => entry.category === rawCategory);return (<Fragment key={key}>- <Flexbox- horizontal- align={'center'}- gap={8}- {...sx(styles.groupHeader, groupHeaderMarker, {- borderBlockStart:- groupIndex > 0 ? `1px solid ${cssVar.colorBorderSecondary}` : 'none',- })}- onClick={() => onToggleGroup(key)}- >- <Text strong style={{ fontSize: 13 }}>- {label}- </Text>- {allVerified ? (- <Flexbox- horizontal- align={'center'}- gap={4}- style={{ color: cssVar.colorSuccess, fontSize: 12 }}- >- <Icon icon={BadgeCheck} size={13} />- {t('acceptance.group.allVerified', { passed, total: groupChecks_.length })}- </Flexbox>- ) : (- <Flexbox horizontal align={'center'} gap={8}>- <Text fontSize={12} type={'secondary'}>- {t('acceptance.group.acceptedRatio', {- accepted: acceptedCount,- total: groupChecks_.length,- })}- </Text>- {exceptionCount > 0 && (- <Text style={{ color: cssVar.colorError, fontSize: 12 }}>- {t('acceptance.group.failedCount', { count: exceptionCount })}- </Text>- )}- {rejectedCount > 0 && (- <Text style={{ color: cssVar.colorError, fontSize: 12 }}>- {t('acceptance.group.rejectedCount', { count: rejectedCount })}- </Text>- )}- {ignoredCount > 0 && (- <Text fontSize={12} type={'secondary'}>- {t('acceptance.group.ignoredCount', { count: ignoredCount })}- </Text>- )}- </Flexbox>- )}- {/* Bulk accept sits by the ratio it settles, hover-revealed —- a full-width column of always-on buttons begs misclicks. */}- {canReview &&- reviewableChecks.length > 0 &&- (unaccepted.length > 0 ? (- <Button- disabled={reviewPending && acceptingGroup !== key}- icon={<Icon icon={BadgeCheck} />}- loading={acceptingGroup === key}- size={'small'}- // The spinner must stay visible after the pointer leaves.- {...sx(- styles.groupActions,- acceptingGroup === key ? { opacity: 1 } : undefined,- )}- type={'text'}- onClick={async (event) => {- event.stopPropagation();- setAcceptingGroup(key);- const ok = await onReview({- action: 'accept',- checkItemIds: unaccepted.map((check) => check.id),- });- setAcceptingGroup(null);- // A fully signed-off group is settled business — fold it.- if (ok && !collapsed) onToggleGroup(key);- }}- >- {t('acceptance.review.acceptAll')}- </Button>- ) : allVerified || ignoredCount > 0 ? null : (- // Fully signed off but not all green — the mixed-verdict- // receipt that can't fold into the ratio text.- <Flexbox- horizontal- align={'center'}- gap={4}- style={{ color: cssVar.colorSuccess, fontSize: 12 }}- >- <Icon icon={BadgeCheck} size={13} />- {t('acceptance.review.acceptAllDone')}- </Flexbox>- ))}- <Flexbox flex={1} />- {/* Group-scoped feedback — the channel for concerns that- belong to no single check yet must reach the next round.- Lives with the other group-level controls by the chevron. */}- {canReview && (- <span {...stylex.props(styles.groupActions)}>- <ActionIcon- icon={MessageSquareText}- size={'small'}- title={t('acceptance.group.feedbackAction')}- onClick={(event) => {- event.stopPropagation();- openGroupFeedbackModal({- groupLabel: label,- onConfirm: (comment, fileIds) =>- onGroupFeedback(rawCategory, comment, fileIds),- });- }}- />- </span>- )}- {collapsed || onOpenCheck ? (- // Fixed-size placeholder keeps the header height stable across- // toggles — and stands in for the bulk expander on rows that- // navigate away instead of unfolding.- <div style={{ height: 24, width: 24 }} />- ) : (- <ActionIcon- icon={anyItemOpen ? ChevronsDownUp : ChevronsUpDown}- size={'small'}- title={- anyItemOpen- ? t('acceptance.group.collapseItems')- : t('acceptance.group.expandItems')- }- onClick={(event) => {- event.stopPropagation();- // Expanding a group is "show me what still needs judgment"- // — rows the user already accepted are settled business- // and stay folded (they open individually on demand).- // Collapsing folds everything, accepted or not.- onToggleGroupItems(- anyItemOpen- ? rows.map((check) => check.id)- : rows- .filter((check) => userReviewState(check) !== 'accepted')- .map((check) => check.id),- !anyItemOpen,- );- }}- />- )}- <Icon- color={cssVar.colorTextQuaternary}- icon={ChevronRight}- size={14}- style={{- transform: collapsed ? 'none' : 'rotate(90deg)',- transition: 'transform 0.2s',- }}- />- </Flexbox>+ <CheckGroupHeader+ accepting={acceptingGroup === key}+ anyItemOpen={anyItemOpen}+ canReview={canReview}+ checks={groupChecks_}+ collapsed={collapsed}+ label={label}+ reviewPending={reviewPending}+ onToggle={() => onToggleGroup(key)}+ onAcceptAll={async (checkItemIds) => {+ setAcceptingGroup(key);+ const ok = await onReview({ action: 'accept', checkItemIds });+ setAcceptingGroup(null);+ // A fully signed-off group is settled business — fold it.+ if (ok && !collapsed) onToggleGroup(key);+ }}+ onFeedback={() =>+ openGroupFeedbackModal({+ groupLabel: label,+ onConfirm: (comment, fileIds) => onGroupFeedback(rawCategory, comment, fileIds),+ })+ }+ // Expanding a group is "show me what still needs judgment" —+ // rows the user already accepted stay folded. Collapsing folds+ // everything, accepted or not.+ onToggleItems={+ onOpenCheck+ ? undefined+ : () =>+ onToggleGroupItems(+ anyItemOpen+ ? rows.map((check) => check.id)+ : rows+ .filter((check) => userReviewState(check) !== 'accepted')+ .map((check) => check.id),+ !anyItemOpen,+ )+ }+ />{/* Group feedback trail — newest first; entries consumed by alater round stay readable but visually recede. */}{!collapsed && (diff --git a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx b/src/features/Acceptance/Viewer/Checks/CheckRow.tsxindex aecbc574336..e32f42ec0ed 100644--- a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx+++ b/src/features/Acceptance/Viewer/Checks/CheckRow.tsx@@ -1,84 +1,30 @@'use client';-import { isCheckWaivedByDispute, readEvidenceChapters } from '@lobechat/const/verify';-import {- ActionIcon,- Button,- copyToClipboard,- cssVar,- Flexbox,- Icon,- Tag,- Text,- TextArea,- Tooltip,- useResponsive,-} from '@lobehub/ui';+import { isCheckWaivedByDispute } from '@lobechat/const/verify';+import { cssVar, Flexbox, useResponsive } from '@lobehub/ui';import * as stylex from '@stylexjs/stylex';-import dayjs from 'dayjs';-import {- AudioLines,- BadgeCheck,- Ban,- Check,- CheckCheck,- ChevronRight,- CircleDashed,- FileText,- Film,- Images,- MessageSquare,- MessageSquareX,- Repeat,- Route,- Scale,-} from 'lucide-react';+import { Scale } from 'lucide-react';import { memo, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { sx } from '@/styles/sx';--import { hasRenderableEvidence, readVisualizationManifest } from '../../Report/visualization';-import { VisualizationDeltaBadge, VisualizationRenderer } from '../../Report/VisualizationRenderer';+import { readVisualizationManifest } from '../../Report/visualization';import { checkDisplayTitle } from '../../utils';-import { HistoricalComments } from '../Comments/HistoricalComments';import { useCheckComments } from '../Comments/useCheckComments';-import {- canMarkEvidence,- evidenceCounts,- evidenceShortcut,- isRejectable,-} from '../Evidence/evidence';-import { EvidenceList } from '../Evidence/EvidenceList';+import { canMarkEvidence, evidenceCounts, evidenceShortcut } from '../Evidence/evidence';import type { EvidenceOverlayMap } from '../Evidence/overlay';-import { rowHeaderMarker } from '../markers.stylex';-import { openCheckRejectModal } from '../Review/CheckRejectModal';-import type { CheckProposal } from '../Review/proposal';-import { classifyProposalEdit } from '../Review/proposal';-import ProposalCard from '../Review/ProposalCard';-import {- AcceptedNote,- collectEvidenceById,- FeedbackCard,- IgnoredNote,- IterationTimeline,-} from './CheckHistory';-import { shouldCollapseAfterReview, userReviewState } from './checkState';+import { checkDecision } from './checkDecision';+import { collectEvidenceById } from './CheckHistory';+import { CheckRowEvidence } from './CheckRowEvidence';+import { CheckRowHeader } from './CheckRowHeader';+import { CheckRowSide } from './CheckRowSide';+import { userReviewState } from './checkState';import { STATE_META } from './checkStatus';-import { readCheckDispute } from './dispute';-import DisputeNote from './DisputeNote';-import FoldedText from './FoldedText';-import { hasCheckHistory, splitCheckReviews } from './readPresentation';+import PhoneDecisionBar from './PhoneDecisionBar';+import { splitCheckReviews } from './readPresentation';import { checkRowDisclosure } from './rowDisclosure';import { styles } from './styles';import type { AcceptanceCheck, CheckReviewInput, ProposalDismissInput } from './types';--const EVIDENCE_BADGES = [- { icon: Images, key: 'image', labelKey: 'acceptance.evidence.image' },- { icon: Film, key: 'video', labelKey: 'acceptance.evidence.video' },- { icon: AudioLines, key: 'audio', labelKey: 'acceptance.evidence.audio' },- { icon: FileText, key: 'file', labelKey: 'acceptance.evidence.file' },-] as const;+import { useCheckReviewActions } from './useCheckReviewActions';export const AcceptanceCheckRow = memo<{canReview: boolean;@@ -117,11 +63,6 @@ export const AcceptanceCheckRow = memo<{const { md: desktop = true } = useResponsive();// The judging narrative stays collapsed: level one is title + evidence.const [historyOpen, setHistoryOpen] = useState(false);- const [seqCopied, setSeqCopied] = useState(false);- const [accepting, setAccepting] = useState(false);- const [ignoring, setIgnoring] = useState(false);- const [rejecting, setRejecting] = useState(false);- const [reviewComment, setReviewComment] = useState('');// The proposal starts folded: it is a suggestion, and an open panel on every// unreviewed check would push the evidence the reviewer came for below the fold.const [proposalOpen, setProposalOpen] = useState(false);@@ -134,7 +75,6 @@ export const AcceptanceCheckRow = memo<{const title = checkDisplayTitle(check.title, t('acceptance.checks.holisticTitle'));const counts = evidenceCounts(check.evidence);const visualization = readVisualizationManifest(check.result?.metadata);- const dispute = readCheckDispute(check.result?.metadata);// An upheld `invalid_criterion` dispute takes the check out of the rollup,// so its failed mark must not keep reading as a blocker.const waived = isCheckWaivedByDispute(check.result?.metadata);@@ -161,19 +101,21 @@ export const AcceptanceCheckRow = memo<{});return map.size > 0 ? map : undefined;}, [proposalOpen, check.prediction]);- const hasHistory = hasCheckHistory(check, historyReviews);- const {- comments,- checkThreads,- staleThreads,- commentOverlays,- canResolveThread,- commentActions,- canCommentEvidence,- openEvidenceComment,- refreshEvidenceUrl,- } = useCheckComments(check, proposalOverlays);+ const checkComments = useCheckComments(check, proposalOverlays);+ const { checkThreads, staleThreads, canCommentEvidence, openEvidenceComment } = checkComments;++ const review = useCheckReviewActions({+ activeReview,+ check,+ expanded,+ onDismissProposal,+ onReview,+ onToggle,+ refreshEvidenceUrl: checkComments.refreshEvidenceUrl,+ title,+ });+ const { openReject } = review;// Comments and review decisions have distinct entry points for every role.const shortcut = evidenceShortcut({@@ -182,718 +124,123 @@ export const AcceptanceCheckRow = memo<{// EvidenceList turns a phone reviewer's tap into the same marking.tapMarks: !desktop && canReview,});- const floatingComment =- shortcut === 'comment'- ? { label: t('acceptance.comments.commentMedia'), open: openEvidenceComment }- : shortcut === 'annotate'- ? {- label: t('acceptance.review.annotate'),- open: (id: string) => openReject(undefined, id),- }- : undefined;-- /**- * @param fromProposal - when set, the modal opens prefilled with the- * model's note and regions, and the submitted result is diffed against it- * so the signal records WHICH part of the proposal was wrong.- */- const openReject = (fromProposal?: CheckProposal, initialEvidenceId?: string) =>- openCheckRejectModal({- initialEvidenceId,- previousAttachments:- activeReview?.action === 'reject'- ? activeReview.attachments- ?.filter((item) => item.url)- .map((item) => ({ id: item.id, name: item.name, url: item.url! }))- : undefined,- previousAnnotations:- activeReview?.action === 'reject' ? activeReview.annotations : undefined,- previousComment: activeReview?.action === 'reject' ? activeReview.comment : undefined,- refreshEvidenceUrl,- checkDescription: check.planItem?.description,- checkTitle: `C${check.seq} · ${title}`,- draftKey: `${check.result?.id ?? 'unexecuted'}:${check.id}`,- evidence: check.evidence.filter(isRejectable).map((item) => ({- chapters: item.type === 'video' ? readEvidenceChapters(item.metadata) : undefined,- fileUrl: item.fileUrl!,- id: item.id,- type: item.type,- })),- initialAnnotations: fromProposal?.annotations ?? undefined,- initialComment: fromProposal?.comment ?? reviewComment,- onConfirm: async ({ annotations, comment, fileIds }) => {- const ok = await onReview({- action: 'reject',- annotations: annotations.length > 0 ? annotations : undefined,- checkItemIds: [check.id],- comment: comment || undefined,- fileIds: fileIds.length > 0 ? fileIds : undefined,- ...(fromProposal- ? {- proposal: {- adjudication: 'confirmed' as const,- edit: classifyProposalEdit(fromProposal, { annotations, comment }),- predictionId: fromProposal.id,- },- }- : {}),- });- if (ok) {- setReviewComment('');- if (shouldCollapseAfterReview(ok, expanded)) onToggle();- }- return ok;- },- });-- /**- * Dismissing a proposal is NOT a review of the check — the check stays- * pending and the reviewer still has to judge it. Only the model's opinion- * is being answered, so this writes the outcome without touching- * `user_decision`.- */- const handleAdjudicate = async (adjudication: 'not-an-issue' | 'misidentified') => {- if (!check.prediction) return;- await onDismissProposal?.({- adjudication,- checkItemId: check.id,- predictionId: check.prediction.id,- });- };-- // Accepting settles the check — the row folds itself away once the write- // lands, so the reviewer's eye moves on to what still needs judgment.- const handleAccept = async (event: { stopPropagation: () => void }) => {- event.stopPropagation();- setAccepting(true);- const comment = reviewComment.trim();- const ok = await onReview({- action: 'accept',- checkItemIds: [check.id],- comment: comment || undefined,- });- setAccepting(false);- if (ok) setReviewComment('');- if (shouldCollapseAfterReview(ok, expanded)) onToggle();- };-- const handleReject = async (event: { stopPropagation: () => void }) => {- event.stopPropagation();- const comment = reviewComment.trim();- if (!comment) return;- setRejecting(true);- const ok = await onReview({- action: 'reject',- checkItemIds: [check.id],- comment,- });- setRejecting(false);- if (ok) setReviewComment('');- if (shouldCollapseAfterReview(ok, expanded)) onToggle();- };-- const handleIgnore = async (event: { stopPropagation: () => void }) => {- event.stopPropagation();- setIgnoring(true);- const ok = await onReview({ action: 'ignore', checkItemIds: [check.id] });- setIgnoring(false);- if (shouldCollapseAfterReview(ok, expanded)) onToggle();- };-- // The user's standing verdict owns the head slot: a reject replaces the- // verifier's mark outright (that check IS sent back, whatever the verifier- // said); passed + user-accepted merges into the double-check receipt.- const headIcon =- reviewState === 'rejected'- ? MessageSquareX- : reviewState === 'ignored'- ? Ban- : waived- ? Scale- : check.state === 'passed' && reviewState === 'accepted'- ? CheckCheck- : meta.icon;- const headColor =- reviewState === 'rejected'- ? cssVar.colorError- : reviewState === 'ignored' || waived- ? cssVar.colorTextQuaternary- : meta.color;-- const headIconNode = (- <Icon- color={headColor}- icon={headIcon}- size={16}- style={{ alignSelf: 'flex-start', flex: 'none', marginBlockStart: 3 }}- />- );+ const floatingComment = (() => {+ switch (shortcut) {+ case 'comment': {+ return { label: t('acceptance.comments.commentMedia'), open: openEvidenceComment };+ }+ case 'annotate': {+ return {+ label: t('acceptance.review.annotate'),+ open: (id: string) => openReject(undefined, id),+ };+ }+ default: {+ return undefined;+ }+ }+ })();++ // The head slot is the verifier's verdict and nothing else; the reviewer's+ // own decision reads from the label at the row's far end, so one glyph+ // never has to mean two things.+ const headIcon = waived ? Scale : meta.icon;+ const headColor = waived ? cssVar.colorTextQuaternary : meta.color;+ const verdictLabel = `${t('acceptance.focus.judgeLabel')} · ${t(+ `report.verdict.${check.state === 'not_executed' ? 'notExecuted' : check.state}`,+ )}`;++ const hasEvidenceColumn =+ check.evidence.length > 0 ||+ Boolean(visualization) ||+ staleThreads.length > 0 ||+ check.state === 'not_executed';+ const fillStage = Boolean(detailMode) && desktop && counts.image > 0;+ const phoneBar = Boolean(detailMode) && !desktop && reviewable && !activeReview;return (- <Flexbox data-check-row={check.id} {...stylex.props(detailMode ? undefined : styles.row)}>+ <Flexbox+ data-check-row={check.id}+ {...stylex.props(detailMode ? styles.detailContainer : styles.row)}+ >{!detailMode && (- <Flexbox- horizontal- align={'flex-start'}- aria-expanded={ariaExpanded}- data-expanded={open ? '' : undefined}- gap={10}- role={'button'}- tabIndex={0}- {...stylex.props(styles.rowHeader, !open && styles.rowHeaderCollapsed, rowHeaderMarker)}- onClick={activate}- onKeyDown={(event) => {- if (- event.target === event.currentTarget &&- (event.key === 'Enter' || event.key === ' ')- ) {- event.preventDefault();- activate();- }- }}- >- {reviewState === 'rejected' ? (- <Tooltip title={t('acceptance.review.rejectedHint')}>{headIconNode}</Tooltip>- ) : (- headIconNode- )}- <Tooltip- title={seqCopied ? t('acceptance.checks.copied') : t('acceptance.checks.copySeq')}- >- <span- {...stylex.props(styles.seqChip, styles.seqChipClickable)}- onClick={(event) => {- event.stopPropagation();- void copyToClipboard(`C${check.seq}`);- setSeqCopied(true);- setTimeout(() => setSeqCopied(false), 1500);- }}- >- C{check.seq}- </span>- </Tooltip>- <Flexbox- horizontal- align={'center'}- {...sx(styles.rowTitle, { minWidth: 0 })}- flex={1}- gap={8}- wrap={open ? 'wrap' : 'nowrap'}- >- <Text- {...sx(open || !desktop ? null : styles.titleEllipsis, {- fontSize: desktop ? 13 : 14,- minWidth: 0,- })}- >- {title}- </Text>- {!check.required && (- <Tooltip title={t('acceptance.checks.notRequiredHint')}>- <Tag size={'small'}>{t('acceptance.checks.notRequired')}</Tag>- </Tooltip>- )}- {waived && (- <Tooltip title={t('acceptance.checks.waivedHint')}>- <Tag size={'small'}>{t('acceptance.checks.waived')}</Tag>- </Tooltip>- )}- {/* The verdict pair travels WITH the title, not adrift at the row's- far right: the claim you judge and the judgement you give land in- one glance, so a long checklist needs no eye round-trip across the- row (and no mis-click onto a neighbour's buttons). */}- {desktop && reviewable && reviewState === 'pending' && (- <Flexbox- horizontal- align={'center'}- // A running accept/ignore spinner stays visible after the pointer leaves.- data-busy={accepting || ignoring ? '' : undefined}- gap={2}- {...sx(styles.rowActions, !(accepting || ignoring) && styles.rowActionsIdle, {- flex: 'none',- })}- >- <ActionIcon- disabled={reviewPending && !accepting}- icon={Check}- loading={accepting}- size={'small'}- title={t('acceptance.review.accept')}- onClick={handleAccept}- />- <ActionIcon- disabled={reviewPending && !ignoring}- icon={Ban}- loading={ignoring}- size={'small'}- title={t('acceptance.review.ignore')}- onClick={handleIgnore}- />- <ActionIcon- disabled={reviewPending}- icon={MessageSquareX}- size={'small'}- title={t('acceptance.review.reject')}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- />- </Flexbox>- )}- </Flexbox>- <Flexbox horizontal align={'center'} gap={6} {...stylex.props(styles.rowMeta)}>- {/* An accept on a NON-passed verdict can't merge into the head icon- (the failed/uncertain mark must stay visible) — mark it here. */}- {reviewState === 'accepted' && check.state !== 'passed' && (- <Tooltip- title={t('acceptance.review.acceptedNote', {- time: dayjs(check.userReview!.createdAt).format('MM-DD HH:mm'),- })}- >- <Icon color={cssVar.colorTextQuaternary} icon={BadgeCheck} size={14} />- </Tooltip>- )}- {visualization && <VisualizationDeltaBadge manifest={visualization} />}- {EVIDENCE_BADGES.map(({ icon, key, labelKey }) =>- counts[key] ? (- <Tooltip key={key} title={t(labelKey, { count: counts[key] })}>- <Flexbox- horizontal- align={'center'}- gap={3}- style={{ color: cssVar.colorTextTertiary, fontSize: 11 }}- >- <Icon icon={icon} size={13} />- {counts[key] > 1 ? counts[key] : null}- </Flexbox>- </Tooltip>- ) : null,- )}- {checkThreads.length > 0 && (- <Tooltip- title={t('acceptance.comments.regionCount', { count: checkThreads.length })}- >- <Flexbox- horizontal- align={'center'}- gap={3}- style={{ color: cssVar.colorTextTertiary, fontSize: 11 }}- >- <Icon icon={MessageSquare} size={13} />- {checkThreads.length}- </Flexbox>- </Tooltip>- )}- {/* The iteration mark stays compact — [↻ N]; the words (verified N- rounds · introduced in round X) live in its tooltip. Clicking- jumps to the round the concern first appeared in. */}- {onRound && check.revisions > 1 && (- <Tooltip- title={[- check.titleChanged- ? t('acceptance.checks.iterated', { count: check.revisions })- : t('acceptance.checks.rerun', { count: check.revisions }),- check.resultRound !== undefined &&- check.resultRound !== null &&- check.introducedAtRound !== check.resultRound- ? t('acceptance.checks.introduced', { round: check.introducedAtRound })- : null,- ]- .filter(Boolean)- .join(' · ')}- >- <span- {...stylex.props(styles.chip, styles.chipClickable)}- onClick={(event) => {- event.stopPropagation();- onRound(check.introducedAtRound);- }}- >- <Icon icon={Repeat} size={10} /> {check.revisions}- </span>- </Tooltip>- )}- {onRound && check.resultRound !== undefined && check.resultRound !== null && (- <Tooltip title={t('acceptance.checks.finalRoundHint')}>- <span- {...stylex.props(styles.chip, styles.chipClickable)}- onClick={(event) => {- event.stopPropagation();- onRound(check.resultRound!);- }}- >- {t('acceptance.round', { round: check.resultRound })}- </span>- </Tooltip>- )}- </Flexbox>- <Flexbox align={'center'} height={22} {...stylex.props(styles.rowChevron)}>- <Icon- color={cssVar.colorTextQuaternary}- icon={ChevronRight}- size={14}- style={{- transform: open ? 'rotate(90deg)' : 'none',- transition: 'transform 0.2s',- }}- />- </Flexbox>- </Flexbox>+ <CheckRowHeader+ activate={activate}+ ariaExpanded={ariaExpanded}+ check={check}+ checkThreadCount={checkThreads.length}+ counts={counts}+ decision={checkDecision(check)}+ desktop={desktop}+ headColor={headColor}+ headIcon={headIcon}+ open={open}+ review={review}+ reviewPending={reviewPending}+ showQuickActions={desktop && !open && reviewable && reviewState === 'pending'}+ title={title}+ verdictLabel={verdictLabel}+ visualization={visualization}+ waived={waived}+ onRound={onRound}+ />)}{open && (- <Flexbox- gap={10}- paddingBlock={detailMode ? 0 : '0 14px'}- paddingInline={detailMode ? 0 : 16}- >- {/* The model's proposal leads the detail: it is a claim about this- check that the reviewer is being asked to rule on, so it belongs- above the verifier's narrative rather than buried under it.- Suppressed once a verdict exists — see the bundle read, which- already drops it; this guard covers the optimistic window. */}- {check.prediction && reviewable && !activeReview && (- <ProposalCard- open={proposalOpen}- pending={reviewPending}- proposal={check.prediction}- onAdjudicate={handleAdjudicate}- onConfirm={() => openReject(check.prediction ?? undefined)}- onToggle={setProposalOpen}- />- )}- {/* The verifier's account of what it saw. Folded to one line that- opens in place: shown in full, it and the reasoning below turned an- expanded check into a wall of text; an earlier clamp failed because- it had no way to open. */}- {check.result?.toulmin?.evidence && (- <FoldedText secondary text={check.result.toulmin.evidence} />- )}- {/* An agent judge's argument is its run, not a paragraph — link the- trace instead of trying to summarize it inline. `onOpenTrace`- gates the render, not just the click: a caller that forgets to- pass it would otherwise get a button whose optional call silently- does nothing — exactly how this shipped dead in the portal. */}- {check.planItem?.verifierType === 'agent' &&- check.result?.verifierOperationId &&- onOpenTrace && (- <Flexbox horizontal>- <Button- icon={<Icon icon={Route} />}- size={'small'}- type={'text'}- onClick={(event) => {- event.stopPropagation();- void onOpenTrace(check.result!.verifierOperationId!);- }}- >- {t('acceptance.checks.viewTrace')}- </Button>- </Flexbox>- )}- {visualization && <VisualizationRenderer manifest={visualization} />}- <EvidenceList- evidence={check.evidence}- overlays={commentOverlays}- reviewNotes={activeReview?.action === 'reject' ? activeReview.annotations : undefined}- onComment={floatingComment}- onRefreshEvidenceUrl={refreshEvidenceUrl}- onReviewEvidence={canReview ? (id) => openReject(undefined, id) : undefined}- />- {staleThreads.length > 0 && (- <Flexbox gap={10} {...stylex.props(styles.staleRegions)}>- <Text fontSize={12} type={'secondary'}>- {t('acceptance.comments.historicalRegions', { count: staleThreads.length })}- </Text>- <HistoricalComments- canComment={comments.canComment}- canResolveThread={canResolveThread}- evidenceById={evidenceById}- overlays={commentOverlays}- threads={staleThreads}- timeline={check.timeline}- onRefreshEvidenceUrl={refreshEvidenceUrl}- {...commentActions}- />- </Flexbox>- )}- {check.state === 'not_executed' && (- <Flexbox- horizontal- align={'center'}- gap={8}- paddingBlock={8}- paddingInline={10}- style={{- background: cssVar.colorFillQuaternary,- borderRadius: cssVar.borderRadius,- width: '100%',- }}- >- <Icon- color={cssVar.colorTextQuaternary}- icon={CircleDashed}- size={15}- style={{ flex: 'none' }}- />- <Text fontSize={12} type={'secondary'}>- {t('acceptance.focus.verifierDescription.notExecuted')}- </Text>- </Flexbox>- )}-- {/* The verifier's record slot. An LLM judge's whole product IS its- reasoning, so when it exists it IS the record shown here — in the- same slot the empty-evidence note otherwise occupies (the two are- the same statement: "here is what the verifier left behind"). An- executed check with neither still SAYS so — a silent blank under- the verdict reads as a rendering bug, not as a fact. */}- {check.state !== 'not_executed' &&- check.result &&- (check.result.toulmin?.reasoning ? (- <Flexbox- paddingBlock={6}- paddingInline={10}- style={{- background: cssVar.colorFillQuaternary,- borderRadius: cssVar.borderRadius,- width: '100%',- }}- >- <FoldedText- label={t('acceptance.checks.judgeReason')}- text={check.result.toulmin.reasoning}- />- </Flexbox>- ) : !hasRenderableEvidence(check.evidence.length, visualization) ? (- <Flexbox- paddingBlock={6}- paddingInline={10}- style={{- background: cssVar.colorFillQuaternary,- borderRadius: cssVar.borderRadius,- width: '100%',- }}- >- <Text fontSize={12} type={'secondary'}>- {t('acceptance.evidence.empty')}- </Text>- </Flexbox>- ) : null)}- {/* The builder's objection sits under the verdict it argues with. */}- {dispute && <DisputeNote dispute={dispute} />}-- {/* The user's standing feedback hangs right under the evidence it- judges. BOTH verdicts keep an undo path — a mis-click is the most- likely way either happens, and a send-back the user didn't mean- otherwise costs a whole repair round to walk back. */}- {activeReview &&- (activeReview.action === 'accept' ? (- <Flexbox horizontal align={'center'} gap={8}>- <AcceptedNote review={activeReview} />- {reviewable && (- <Button- disabled={reviewPending}- size={'small'}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- >- {t('acceptance.review.revertToReject')}- </Button>- )}- </Flexbox>- ) : activeReview.action === 'ignore' ? (- <Flexbox horizontal align={'center'} gap={8}>- <IgnoredNote review={activeReview} />- {reviewable && (- <>- <Button- disabled={reviewPending}- size={'small'}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- >- {t('acceptance.review.revertToReject')}- </Button>- <Button- disabled={reviewPending && !accepting}- loading={accepting}- size={'small'}- type={'text'}- onClick={handleAccept}- >- {t('acceptance.review.revertToAccept')}- </Button>- </>- )}- </Flexbox>- ) : (- <Flexbox gap={6}>- <FeedbackCard evidenceById={evidenceById} review={activeReview} />- {/* The mirror of the accept escape: take the send-back back.- A fresh accept supersedes the reject, so the check leaves- 待修复 and the feedback drops out of the next round's input. */}- {reviewable && (- <Flexbox horizontal>- <Button- disabled={reviewPending && !accepting}- loading={accepting}- size={'small'}- type={'text'}- onClick={handleAccept}- >- {t('acceptance.review.revertToAccept')}- </Button>- </Flexbox>- )}- </Flexbox>- ))}-- {/* Circling the evidence belongs WITH the evidence, above the- history — it is another way of looking at what was delivered,- not a verdict. The rounds this check already went through then- sit between that and the verdict buttons: context for the- decision, never an appendix to one already made. */}- {detailMode && reviewable && !activeReview && canMarkEvidence(check, desktop) && (- <Button- outdent- icon={<Icon icon={Images} />}- style={{ alignSelf: 'flex-start' }}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- >- {t('acceptance.review.annotate')}- </Button>+ <div+ {...stylex.props(+ styles.body,+ !detailMode && styles.bodyInList,+ !hasEvidenceColumn && styles.bodySingle,)}- {hasHistory && (- <span- {...stylex.props(styles.historyToggle)}- onClick={() => setHistoryOpen((open) => !open)}- >- <Icon- icon={ChevronRight}- size={12}- style={{- transform: historyOpen ? 'rotate(90deg)' : 'none',- transition: 'transform 0.2s',- }}- />- {t('acceptance.checks.iterationHistory', { count: check.revisions })}- </span>- )}- {historyOpen && hasHistory && (- <IterationTimeline+ >+ {hasEvidenceColumn && (+ <CheckRowEvidence+ activeReview={activeReview}check={check}+ checkComments={checkComments}evidenceById={evidenceById}- historyReviews={historyReviews}- onRound={onRound}+ fillStage={fillStage}+ floatingComment={floatingComment}+ visualization={visualization}+ onReviewEvidence={canReview ? (id) => openReject(undefined, id) : undefined}/>)}- {/* One row closes the check: looking harder on the left, deciding on- the right. Circling the evidence is another way of reading what- was delivered rather than a verdict, so it keeps its quiet text- styling and the left edge — but it sits ON the same line as the- buttons instead of stacking a half-empty row above them. */}- {(canCommentEvidence || (reviewable && !activeReview && !detailMode)) && (- <Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>- {canCommentEvidence ? (- <Button- outdent- icon={<Icon icon={MessageSquare} />}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openEvidenceComment();- }}- >- {t('acceptance.comments.evidenceModalTitle')}- </Button>- ) : (- <span />- )}- {reviewable && !activeReview && !detailMode && (- <Flexbox horizontal gap={4} justify={'flex-end'}>- <Button- disabled={reviewPending && !ignoring}- loading={ignoring}- size={'small'}- type={'text'}- onClick={handleIgnore}- >- {t('acceptance.review.ignore')}- </Button>- <Button- disabled={reviewPending}- size={'small'}- type={'text'}- onClick={(event) => {- event.stopPropagation();- openReject();- }}- >- {t('acceptance.review.reject')}- </Button>- <Button- disabled={reviewPending && !accepting}- icon={<Icon icon={Check} />}- loading={accepting}- size={'small'}- type={'fill'}- onClick={handleAccept}- >- {t('acceptance.review.accept')}- </Button>- </Flexbox>- )}- </Flexbox>- )}- {/* The phone keeps its own stacked shape: a comment box over two- full-width buttons, which no single row can hold. */}- {reviewable && !activeReview && detailMode && (- <Flexbox gap={10} style={{ marginBlockStart: 6 }}>- <TextArea- autoSize={{ maxRows: 8, minRows: 3 }}- placeholder={t('acceptance.review.detailPlaceholder')}- value={reviewComment}- onChange={(event) => setReviewComment(event.target.value)}- />- <Flexbox horizontal gap={8}>- <Button- block- disabled={reviewPending || !reviewComment.trim()}- loading={rejecting}- size={'large'}- style={{ flex: 1 }}- onClick={handleReject}- >- {t('acceptance.review.reject')}- </Button>- <Button- block- disabled={reviewPending && !accepting}- icon={<Icon icon={Check} />}- loading={accepting}- size={'large'}- style={{ flex: 1 }}- type={'fill'}- onClick={handleAccept}- >- {t('acceptance.review.accept')}- </Button>- </Flexbox>- </Flexbox>- )}- </Flexbox>+ <CheckRowSide+ activeReview={activeReview}+ check={check}+ desktop={desktop}+ detailMode={detailMode}+ evidenceById={evidenceById}+ headColor={headColor}+ headIcon={headIcon}+ historyOpen={historyOpen}+ historyReviews={historyReviews}+ phoneBar={phoneBar}+ proposalOpen={proposalOpen}+ review={review}+ reviewPending={reviewPending}+ reviewable={reviewable}+ verdictLabel={verdictLabel}+ visualization={visualization}+ onCommentEvidence={canCommentEvidence ? () => openEvidenceComment() : undefined}+ onHistoryToggle={() => setHistoryOpen((open) => !open)}+ onOpenTrace={onOpenTrace}+ onProposalToggle={setProposalOpen}+ onRound={onRound}+ />+ </div>+ )}+ {phoneBar && (+ <PhoneDecisionBar+ accepting={review.accepting}+ ignoring={review.ignoring}+ reviewPending={reviewPending}+ onAccept={review.handleAccept}+ onComment={canCommentEvidence ? () => openEvidenceComment() : undefined}+ onIgnore={review.handleIgnore}+ onReject={() => openReject()}+ />)}</Flexbox>);diff --git a/src/features/Acceptance/Viewer/Checks/CheckRowEvidence.tsx b/src/features/Acceptance/Viewer/Checks/CheckRowEvidence.tsxnew file mode 100644index 00000000000..6f157dbe9eb--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckRowEvidence.tsx@@ -0,0 +1,108 @@+import { cssVar, Flexbox, Icon, Text } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import { CircleDashed } from 'lucide-react';+import type { ComponentProps } from 'react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { sx } from '@/styles/sx';++import type { readVisualizationManifest } from '../../Report/visualization';+import { VisualizationRenderer } from '../../Report/VisualizationRenderer';+import { HistoricalComments } from '../Comments/HistoricalComments';+import type { useCheckComments } from '../Comments/useCheckComments';+import { EvidenceList } from '../Evidence/EvidenceList';+import { styles } from './styles';+import type { AcceptanceCheck, AcceptanceCheckReviewEntry, AcceptanceEvidence } from './types';++interface CheckRowEvidenceProps {+ activeReview?: AcceptanceCheckReviewEntry;+ check: AcceptanceCheck;+ checkComments: ReturnType<typeof useCheckComments>;+ evidenceById: Map<string, AcceptanceEvidence>;+ fillStage: boolean;+ floatingComment: ComponentProps<typeof EvidenceList>['onComment'];+ onReviewEvidence?: (evidenceId: string) => void;+ visualization: ReturnType<typeof readVisualizationManifest>;+}++export const CheckRowEvidence = memo<CheckRowEvidenceProps>(+ ({+ activeReview,+ check,+ checkComments,+ evidenceById,+ fillStage,+ floatingComment,+ onReviewEvidence,+ visualization,+ }) => {+ const { t } = useTranslation('verify');+ const {+ canResolveThread,+ commentActions,+ commentOverlays,+ comments,+ refreshEvidenceUrl,+ staleThreads,+ } = checkComments;++ return (+ <Flexbox gap={12} {...sx(fillStage && styles.detailEvidence, { minWidth: 0 })}>+ {visualization && <VisualizationRenderer manifest={visualization} />}+ <EvidenceList+ evidence={check.evidence}+ overlays={commentOverlays}+ reviewNotes={activeReview?.action === 'reject' ? activeReview.annotations : undefined}+ stageSize={fillStage ? 'fill' : undefined}+ onComment={floatingComment}+ onRefreshEvidenceUrl={refreshEvidenceUrl}+ onReviewEvidence={onReviewEvidence}+ />+ {staleThreads.length > 0 && (+ <Flexbox gap={10} {...stylex.props(styles.staleRegions)}>+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.comments.historicalRegions', { count: staleThreads.length })}+ </Text>+ <HistoricalComments+ canComment={comments.canComment}+ canResolveThread={canResolveThread}+ evidenceById={evidenceById}+ overlays={commentOverlays}+ threads={staleThreads}+ timeline={check.timeline}+ onRefreshEvidenceUrl={refreshEvidenceUrl}+ {...commentActions}+ />+ </Flexbox>+ )}+ {check.state === 'not_executed' && (+ <Flexbox+ horizontal+ align={'center'}+ gap={8}+ paddingBlock={8}+ paddingInline={10}+ style={{+ background: cssVar.colorFillQuaternary,+ borderRadius: cssVar.borderRadius,+ width: '100%',+ }}+ >+ <Icon+ color={cssVar.colorTextQuaternary}+ icon={CircleDashed}+ size={15}+ style={{ flex: 'none' }}+ />+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.focus.verifierDescription.notExecuted')}+ </Text>+ </Flexbox>+ )}+ </Flexbox>+ );+ },+);++CheckRowEvidence.displayName = 'AcceptanceCheckRowEvidence';diff --git a/src/features/Acceptance/Viewer/Checks/CheckRowHeader.tsx b/src/features/Acceptance/Viewer/Checks/CheckRowHeader.tsxnew file mode 100644index 00000000000..671c452c258--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckRowHeader.tsx@@ -0,0 +1,226 @@+import {+ ActionIcon,+ copyToClipboard,+ cssVar,+ Flexbox,+ Icon,+ Tag,+ Text,+ Tooltip,+} from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import type { LucideIcon } from 'lucide-react';+import { Ban, Check, ChevronRight, MessageSquareX } from 'lucide-react';+import { memo, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { sx } from '@/styles/sx';++import type { readVisualizationManifest } from '../../Report/visualization';+import type { evidenceCounts } from '../Evidence/evidence';+import { rowHeaderMarker } from '../markers.stylex';+import type { CheckDecision } from './checkDecision';+import { CheckRowMeta } from './CheckRowMeta';+import { styles } from './styles';+import type { AcceptanceCheck } from './types';+import type { CheckReviewActions } from './useCheckReviewActions';++const QuickActions = memo<{ review: CheckReviewActions; reviewPending: boolean }>(+ ({ review, reviewPending }) => {+ const { t } = useTranslation('verify');+ const { accepting, handleAccept, handleIgnore, ignoring, openReject } = review;++ return (+ <Flexbox+ horizontal+ align={'center'}+ // A running accept/ignore spinner stays visible after the pointer leaves.+ data-busy={accepting || ignoring ? '' : undefined}+ gap={2}+ {...sx(styles.rowActions, !(accepting || ignoring) && styles.rowActionsIdle, {+ flex: 'none',+ })}+ >+ <ActionIcon+ disabled={reviewPending && !accepting}+ icon={Check}+ loading={accepting}+ size={'small'}+ title={t('acceptance.review.accept')}+ onClick={handleAccept}+ />+ <ActionIcon+ disabled={reviewPending && !ignoring}+ icon={Ban}+ loading={ignoring}+ size={'small'}+ title={t('acceptance.review.ignore')}+ onClick={handleIgnore}+ />+ <ActionIcon+ disabled={reviewPending}+ icon={MessageSquareX}+ size={'small'}+ title={t('acceptance.review.reject')}+ onClick={(event) => {+ event.stopPropagation();+ openReject();+ }}+ />+ </Flexbox>+ );+ },+);++QuickActions.displayName = 'AcceptanceCheckRowQuickActions';++interface CheckRowHeaderProps {+ activate: () => void;+ ariaExpanded?: boolean;+ check: AcceptanceCheck;+ checkThreadCount: number;+ counts: ReturnType<typeof evidenceCounts>;+ decision: CheckDecision;+ desktop: boolean;+ headColor: string;+ headIcon: LucideIcon;+ onRound?: (round: number) => void;+ open: boolean;+ review: CheckReviewActions;+ reviewPending: boolean;+ showQuickActions: boolean;+ title: string;+ verdictLabel: string;+ visualization: ReturnType<typeof readVisualizationManifest>;+ waived: boolean;+}++export const CheckRowHeader = memo<CheckRowHeaderProps>(+ ({+ activate,+ ariaExpanded,+ check,+ checkThreadCount,+ counts,+ decision,+ desktop,+ headColor,+ headIcon,+ onRound,+ open,+ review,+ reviewPending,+ showQuickActions,+ title,+ verdictLabel,+ visualization,+ waived,+ }) => {+ const { t } = useTranslation('verify');+ const [seqCopied, setSeqCopied] = useState(false);++ return (+ <Flexbox+ horizontal+ align={'flex-start'}+ aria-expanded={ariaExpanded}+ data-expanded={open ? '' : undefined}+ gap={10}+ role={'button'}+ tabIndex={0}+ {...stylex.props(styles.rowHeader, !open && styles.rowHeaderCollapsed, rowHeaderMarker)}+ onClick={activate}+ onKeyDown={(event) => {+ if (+ event.target === event.currentTarget &&+ (event.key === 'Enter' || event.key === ' ')+ ) {+ event.preventDefault();+ activate();+ }+ }}+ >+ <Tooltip title={verdictLabel}>+ <Icon+ color={headColor}+ icon={headIcon}+ size={16}+ style={{ alignSelf: 'flex-start', flex: 'none', marginBlockStart: 3 }}+ />+ </Tooltip>+ <Tooltip title={seqCopied ? t('acceptance.checks.copied') : t('acceptance.checks.copySeq')}>+ <span+ {...stylex.props(styles.seqChip, styles.seqChipClickable)}+ onClick={(event) => {+ event.stopPropagation();+ void copyToClipboard(`C${check.seq}`);+ setSeqCopied(true);+ setTimeout(() => setSeqCopied(false), 1500);+ }}+ >+ C{check.seq}+ </span>+ </Tooltip>+ <Flexbox+ horizontal+ align={'center'}+ {...sx(styles.rowTitle, { minWidth: 0 })}+ flex={1}+ gap={8}+ wrap={open ? 'wrap' : 'nowrap'}+ >+ <Text+ {...sx(+ open || !desktop ? null : styles.titleEllipsis,+ decision === 'accepted' || decision === 'ignored' ? styles.titleSettled : null,+ { fontSize: 14, minWidth: 0 },+ )}+ >+ {title}+ </Text>+ {!check.required && (+ <Tooltip title={t('acceptance.checks.notRequiredHint')}>+ <Tag size={'small'}>{t('acceptance.checks.notRequired')}</Tag>+ </Tooltip>+ )}+ {waived && (+ <Tooltip title={t('acceptance.checks.waivedHint')}>+ <Tag size={'small'}>{t('acceptance.checks.waived')}</Tag>+ </Tooltip>+ )}+ {/* The verdict pair travels WITH the title, not adrift at the row's+ far right: the claim you judge and the judgement you give land in+ one glance, so a long checklist needs no eye round-trip across the+ row (and no mis-click onto a neighbour's buttons). */}+ {showQuickActions && <QuickActions review={review} reviewPending={reviewPending} />}+ </Flexbox>+ <CheckRowMeta+ check={check}+ checkThreadCount={checkThreadCount}+ counts={counts}+ decision={decision}+ visualization={visualization}+ onRound={onRound}+ />+ <Flexbox+ align={'center'}+ height={22}+ justify={'center'}+ {...stylex.props(styles.rowChevron)}+ >+ <Icon+ color={cssVar.colorTextQuaternary}+ icon={ChevronRight}+ size={14}+ style={{+ transform: open ? 'rotate(90deg)' : 'none',+ transition: 'transform 0.2s',+ }}+ />+ </Flexbox>+ </Flexbox>+ );+ },+);++CheckRowHeader.displayName = 'AcceptanceCheckRowHeader';diff --git a/src/features/Acceptance/Viewer/Checks/CheckRowMeta.tsx b/src/features/Acceptance/Viewer/Checks/CheckRowMeta.tsxnew file mode 100644index 00000000000..e6ed9061ba4--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckRowMeta.tsx@@ -0,0 +1,138 @@+import { cssVar, Flexbox, Icon, Tooltip } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import dayjs from 'dayjs';+import { AudioLines, FileText, Film, Images, MessageSquare, Repeat } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import type { readVisualizationManifest } from '../../Report/visualization';+import { VisualizationDeltaBadge } from '../../Report/VisualizationRenderer';+import type { evidenceCounts } from '../Evidence/evidence';+import type { CheckDecision } from './checkDecision';+import { DECISION_ICON, DECISION_LABEL_KEY } from './checkDecision';+import { styles } from './styles';+import type { AcceptanceCheck } from './types';++const EVIDENCE_BADGES = [+ { icon: Images, key: 'image', labelKey: 'acceptance.evidence.image' },+ { icon: Film, key: 'video', labelKey: 'acceptance.evidence.video' },+ { icon: AudioLines, key: 'audio', labelKey: 'acceptance.evidence.audio' },+ { icon: FileText, key: 'file', labelKey: 'acceptance.evidence.file' },+] as const;++interface CheckRowMetaProps {+ check: AcceptanceCheck;+ checkThreadCount: number;+ counts: ReturnType<typeof evidenceCounts>;+ decision: CheckDecision;+ onRound?: (round: number) => void;+ visualization: ReturnType<typeof readVisualizationManifest>;+}++export const CheckRowMeta = memo<CheckRowMetaProps>(+ ({ check, checkThreadCount, counts, decision, onRound, visualization }) => {+ const { t } = useTranslation('verify');+ const DecisionIcon = DECISION_ICON[decision];++ const decisionHint = () => {+ if (decision === 'needsFix') return t('acceptance.review.rejectedHint');+ if (decision === 'accepted' && check.userReview)+ return t('acceptance.review.acceptedNote', {+ time: dayjs(check.userReview.createdAt).format('MM-DD HH:mm'),+ });+ return undefined;+ };++ return (+ <Flexbox horizontal align={'center'} gap={6} {...stylex.props(styles.rowMeta)}>+ {visualization && <VisualizationDeltaBadge manifest={visualization} />}+ {EVIDENCE_BADGES.map(({ icon, key, labelKey }) =>+ counts[key] ? (+ <Tooltip key={key} title={t(labelKey, { count: counts[key] })}>+ <Flexbox+ horizontal+ align={'center'}+ gap={3}+ style={{ color: cssVar.colorTextTertiary, fontSize: 12 }}+ >+ <Icon icon={icon} size={13} />+ {counts[key] > 1 ? counts[key] : null}+ </Flexbox>+ </Tooltip>+ ) : null,+ )}+ {checkThreadCount > 0 && (+ <Tooltip title={t('acceptance.comments.regionCount', { count: checkThreadCount })}>+ <Flexbox+ horizontal+ align={'center'}+ gap={3}+ style={{ color: cssVar.colorTextTertiary, fontSize: 12 }}+ >+ <Icon icon={MessageSquare} size={13} />+ {checkThreadCount}+ </Flexbox>+ </Tooltip>+ )}+ {/* The iteration mark stays compact — [↻ N]; the words (verified N+ rounds · introduced in round X) live in its tooltip. Clicking+ jumps to the round the concern first appeared in. */}+ {onRound && check.revisions > 1 && (+ <Tooltip+ title={[+ check.titleChanged+ ? t('acceptance.checks.iterated', { count: check.revisions })+ : t('acceptance.checks.rerun', { count: check.revisions }),+ check.resultRound !== undefined &&+ check.resultRound !== null &&+ check.introducedAtRound !== check.resultRound+ ? t('acceptance.checks.introduced', { round: check.introducedAtRound })+ : null,+ ]+ .filter(Boolean)+ .join(' · ')}+ >+ <span+ {...stylex.props(styles.chip, styles.chipClickable)}+ onClick={(event) => {+ event.stopPropagation();+ onRound(check.introducedAtRound);+ }}+ >+ <Icon icon={Repeat} size={12} /> {check.revisions}+ </span>+ </Tooltip>+ )}+ {onRound && check.resultRound !== undefined && check.resultRound !== null && (+ <Tooltip title={t('acceptance.checks.finalRoundHint')}>+ <span+ {...stylex.props(styles.chip, styles.chipClickable)}+ onClick={(event) => {+ event.stopPropagation();+ onRound(check.resultRound!);+ }}+ >+ {t('acceptance.round', { round: check.resultRound })}+ </span>+ </Tooltip>+ )}+ <Tooltip title={decisionHint()}>+ <span+ data-decision={decision}+ {...stylex.props(+ styles.decision,+ decision === 'accepted' && styles.decisionAccepted,+ decision === 'needsFix' && styles.decisionNeedsFix,+ decision === 'notRun' && styles.decisionNotRun,+ )}+ >+ {DecisionIcon && <Icon icon={DecisionIcon} size={14} />}+ {t(DECISION_LABEL_KEY[decision])}+ </span>+ </Tooltip>+ </Flexbox>+ );+ },+);++CheckRowMeta.displayName = 'AcceptanceCheckRowMeta';diff --git a/src/features/Acceptance/Viewer/Checks/CheckRowSide.tsx b/src/features/Acceptance/Viewer/Checks/CheckRowSide.tsxnew file mode 100644index 00000000000..a69ed6c76b2--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckRowSide.tsx@@ -0,0 +1,296 @@+import { Button, cssVar, Flexbox, Icon, Text, TextArea } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import type { LucideIcon } from 'lucide-react';+import { Check, ChevronRight, Images, Route } from 'lucide-react';+import type { ReactNode } from 'react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import type { readVisualizationManifest } from '../../Report/visualization';+import { hasRenderableEvidence } from '../../Report/visualization';+import { canMarkEvidence } from '../Evidence/evidence';+import ProposalCard from '../Review/ProposalCard';+import { IterationTimeline } from './CheckHistory';+import { CheckRowSideActions } from './CheckRowSideActions';+import { readCheckDispute } from './dispute';+import DisputeNote from './DisputeNote';+import FoldedText from './FoldedText';+import { hasCheckHistory } from './readPresentation';+import StandingDecision from './StandingDecision';+import { styles } from './styles';+import type { AcceptanceCheck, AcceptanceCheckReviewEntry, AcceptanceEvidence } from './types';+import type { CheckReviewActions } from './useCheckReviewActions';++const RecordBox = ({ children }: { children: ReactNode }) => (+ <Flexbox+ paddingBlock={6}+ paddingInline={10}+ style={{+ background: cssVar.colorFillQuaternary,+ borderRadius: cssVar.borderRadius,+ width: '100%',+ }}+ >+ {children}+ </Flexbox>+);++const VerifierRecord = memo<{+ check: AcceptanceCheck;+ visualization: ReturnType<typeof readVisualizationManifest>;+}>(({ check, visualization }) => {+ const { t } = useTranslation('verify');++ if (check.state === 'not_executed' || !check.result) return null;+ if (check.result.toulmin?.reasoning)+ return (+ <RecordBox>+ <FoldedText+ label={t('acceptance.checks.judgeReason')}+ text={check.result.toulmin.reasoning}+ />+ </RecordBox>+ );+ if (hasRenderableEvidence(check.evidence.length, visualization)) return null;++ return (+ <RecordBox>+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.evidence.empty')}+ </Text>+ </RecordBox>+ );+});++VerifierRecord.displayName = 'AcceptanceCheckVerifierRecord';++interface CheckRowSideProps {+ activeReview?: AcceptanceCheckReviewEntry;+ check: AcceptanceCheck;+ desktop: boolean;+ detailMode?: boolean;+ evidenceById: Map<string, AcceptanceEvidence>;+ headColor: string;+ headIcon: LucideIcon;+ historyOpen: boolean;+ historyReviews: AcceptanceCheckReviewEntry[];+ onCommentEvidence?: () => void;+ onHistoryToggle: () => void;+ onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;+ onProposalToggle: (open: boolean) => void;+ onRound?: (round: number) => void;+ phoneBar: boolean;+ proposalOpen: boolean;+ review: CheckReviewActions;+ reviewable: boolean;+ reviewPending: boolean;+ verdictLabel: string;+ visualization: ReturnType<typeof readVisualizationManifest>;+}++export const CheckRowSide = memo<CheckRowSideProps>(+ ({+ activeReview,+ check,+ desktop,+ detailMode,+ evidenceById,+ headColor,+ headIcon,+ historyOpen,+ historyReviews,+ onCommentEvidence,+ onHistoryToggle,+ onOpenTrace,+ onProposalToggle,+ onRound,+ phoneBar,+ proposalOpen,+ review,+ reviewable,+ reviewPending,+ verdictLabel,+ visualization,+ }) => {+ const { t } = useTranslation('verify');+ const {+ accepting,+ handleAccept,+ handleAdjudicate,+ handleReject,+ openReject,+ rejecting,+ reviewComment,+ setReviewComment,+ } = review;+ const dispute = readCheckDispute(check.result?.metadata);+ const hasHistory = hasCheckHistory(check, historyReviews);+ const canDecide = reviewable && !activeReview;++ return (+ <Flexbox gap={12} {...stylex.props(styles.side)}>+ {/* The model's proposal leads the side column: it is a claim about+ this check that the reviewer is being asked to rule on, so it sits+ above the verifier's verdict rather than buried under it.+ Suppressed once a verdict exists — see the bundle read, which+ already drops it; this guard covers the optimistic window. */}+ {check.prediction && canDecide && (+ <ProposalCard+ open={proposalOpen}+ pending={reviewPending}+ proposal={check.prediction}+ onAdjudicate={handleAdjudicate}+ onConfirm={() => openReject(check.prediction ?? undefined)}+ onToggle={onProposalToggle}+ />+ )}+ {!detailMode && (+ <Flexbox horizontal align={'center'} gap={8}>+ <Icon color={headColor} icon={headIcon} size={16} style={{ flex: 'none' }} />+ <Text weight={500}>{verdictLabel}</Text>+ </Flexbox>+ )}+ {/* The verifier's account of what it saw. Folded to one line that+ opens in place: shown in full, it and the reasoning below turned an+ expanded check into a wall of text; an earlier clamp failed because+ it had no way to open. */}+ {check.result?.toulmin?.evidence && (+ <FoldedText secondary text={check.result.toulmin.evidence} />+ )}+ {/* An agent judge's argument is its run, not a paragraph — link the+ trace instead of trying to summarize it inline. `onOpenTrace`+ gates the render, not just the click: a caller that forgets to+ pass it would otherwise get a button whose optional call silently+ does nothing — exactly how this shipped dead in the portal. */}+ {check.planItem?.verifierType === 'agent' &&+ check.result?.verifierOperationId &&+ onOpenTrace && (+ <Flexbox horizontal>+ <Button+ icon={<Icon icon={Route} />}+ size={'small'}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ void onOpenTrace(check.result!.verifierOperationId!);+ }}+ >+ {t('acceptance.checks.viewTrace')}+ </Button>+ </Flexbox>+ )}+ {/* The verifier's record slot. An LLM judge's whole product IS its+ reasoning, so when it exists it IS the record shown here — in the+ same slot the empty-evidence note otherwise occupies (the two are+ the same statement: "here is what the verifier left behind"). An+ executed check with neither still SAYS so — a silent blank under+ the verdict reads as a rendering bug, not as a fact. */}+ <VerifierRecord check={check} visualization={visualization} />+ {/* The builder's objection sits under the verdict it argues with. */}+ {dispute && <DisputeNote dispute={dispute} />}++ {/* Circling the evidence belongs WITH the evidence, above the+ history — it is another way of looking at what was delivered,+ not a verdict. The rounds this check already went through then+ sit between that and the verdict buttons: context for the+ decision, never an appendix to one already made. */}+ {detailMode && desktop && canDecide && canMarkEvidence(check, desktop) && (+ <Button+ outdent+ icon={<Icon icon={Images} />}+ style={{ alignSelf: 'flex-start' }}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ openReject();+ }}+ >+ {t('acceptance.review.annotate')}+ </Button>+ )}+ {hasHistory && (+ <span {...stylex.props(styles.historyToggle)} onClick={onHistoryToggle}>+ <Icon+ icon={ChevronRight}+ size={12}+ style={{+ transform: historyOpen ? 'rotate(90deg)' : 'none',+ transition: 'transform 0.2s',+ }}+ />+ {t('acceptance.checks.iterationHistory', { count: check.revisions })}+ </span>+ )}+ {historyOpen && hasHistory && (+ <IterationTimeline+ check={check}+ evidenceById={evidenceById}+ historyReviews={historyReviews}+ onRound={onRound}+ />+ )}+ {/* Both verdicts keep an undo path: a mis-click is the likeliest way+ either happens, and an unintended send-back costs a repair round. */}+ {activeReview && (+ <StandingDecision+ accepting={accepting}+ evidenceById={evidenceById}+ review={activeReview}+ reviewPending={reviewPending}+ onAccept={reviewable ? handleAccept : undefined}+ onReject={reviewable ? () => openReject() : undefined}+ />+ )}+ {/* One row closes the check: looking harder on the left, deciding on+ the right. Circling the evidence is another way of reading what+ was delivered rather than a verdict, so it keeps its quiet text+ styling and the left edge — but it sits ON the same line as the+ buttons instead of stacking a half-empty row above them. */}+ {!phoneBar && (Boolean(onCommentEvidence) || (canDecide && !detailMode)) && (+ <CheckRowSideActions+ review={review}+ reviewPending={reviewPending}+ showDecision={canDecide && !detailMode}+ onCommentEvidence={onCommentEvidence}+ />+ )}+ {canDecide && detailMode && desktop && (+ <Flexbox gap={10} style={{ marginBlockStart: 6 }}>+ <TextArea+ autoSize={{ maxRows: 8, minRows: 3 }}+ placeholder={t('acceptance.review.detailPlaceholder')}+ value={reviewComment}+ onChange={(event) => setReviewComment(event.target.value)}+ />+ <div {...stylex.props(styles.detailStack)}>+ <Button+ block+ className={stylex.props(styles.detailStackItem).className}+ disabled={reviewPending || !reviewComment.trim()}+ loading={rejecting}+ size={'large'}+ onClick={handleReject}+ >+ {t('acceptance.review.reject')}+ </Button>+ <Button+ block+ className={stylex.props(styles.detailStackItem).className}+ disabled={reviewPending && !accepting}+ icon={<Icon icon={Check} />}+ loading={accepting}+ size={'large'}+ type={'primary'}+ onClick={handleAccept}+ >+ {t('acceptance.review.accept')}+ </Button>+ </div>+ </Flexbox>+ )}+ </Flexbox>+ );+ },+);++CheckRowSide.displayName = 'AcceptanceCheckRowSide';diff --git a/src/features/Acceptance/Viewer/Checks/CheckRowSideActions.tsx b/src/features/Acceptance/Viewer/Checks/CheckRowSideActions.tsxnew file mode 100644index 00000000000..65cf5e5dc4b--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/CheckRowSideActions.tsx@@ -0,0 +1,76 @@+import { Button, Icon } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import { Check, MessageSquare, MessageSquareX } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { styles } from './styles';+import type { CheckReviewActions } from './useCheckReviewActions';++interface CheckRowSideActionsProps {+ onCommentEvidence?: () => void;+ review: CheckReviewActions;+ reviewPending: boolean;+ showDecision: boolean;+}++export const CheckRowSideActions = memo<CheckRowSideActionsProps>(+ ({ onCommentEvidence, review, reviewPending, showDecision }) => {+ const { t } = useTranslation('verify');+ const { accepting, handleAccept, handleIgnore, ignoring, openReject } = review;++ return (+ <div {...stylex.props(styles.sideActions)}>+ {onCommentEvidence ? (+ <Button+ outdent+ icon={<Icon icon={MessageSquare} />}+ style={{ alignSelf: 'flex-start' }}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ onCommentEvidence();+ }}+ >+ {t('acceptance.comments.evidenceModalTitle')}+ </Button>+ ) : (+ <span />+ )}+ {showDecision && (+ <div {...stylex.props(styles.decisionStack)}>+ <Button+ disabled={reviewPending && !accepting}+ icon={<Icon icon={Check} />}+ loading={accepting}+ type={'primary'}+ onClick={handleAccept}+ >+ {t('acceptance.review.accept')}+ </Button>+ <Button+ disabled={reviewPending}+ icon={<Icon icon={MessageSquareX} />}+ onClick={(event) => {+ event.stopPropagation();+ openReject();+ }}+ >+ {t('acceptance.review.reject')}+ </Button>+ <Button+ disabled={reviewPending && !ignoring}+ loading={ignoring}+ type={'text'}+ onClick={handleIgnore}+ >+ {t('acceptance.review.ignore')}+ </Button>+ </div>+ )}+ </div>+ );+ },+);++CheckRowSideActions.displayName = 'AcceptanceCheckRowSideActions';diff --git a/src/features/Acceptance/Viewer/Checks/DisputeNote.tsx b/src/features/Acceptance/Viewer/Checks/DisputeNote.tsxindex b799354545f..120fc75dbff 100644--- a/src/features/Acceptance/Viewer/Checks/DisputeNote.tsx+++ b/src/features/Acceptance/Viewer/Checks/DisputeNote.tsx@@ -47,12 +47,12 @@ const DisputeNote = memo<{ dispute: VerifyCheckDispute }>(({ dispute }) => {><Flexbox horizontal align={'center'} gap={6} wrap={'wrap'}><Icon color={cssVar.colorTextTertiary} icon={Scale} size={13} />- <Text fontSize={11} type={'secondary'}>+ <Text fontSize={12} type={'secondary'}>{t('acceptance.dispute.title')} · {t(`acceptance.dispute.kind.${dispute.kind}`)}</Text>{dispute.kind === 'invalid_criterion' && (<Text- fontSize={11}+ fontSize={12}style={{color: arbitration ? OUTCOME_COLOR[arbitration.outcome] : cssVar.colorTextTertiary,}}@@ -90,7 +90,7 @@ const DisputeNote = memo<{ dispute: VerifyCheckDispute }>(({ dispute }) => {size={12}style={{ transform: votesOpen ? 'rotate(90deg)' : 'none', transition: '0.2s' }}/>- <Text fontSize={11} type={'secondary'}>+ <Text fontSize={12} type={'secondary'}>{t('acceptance.dispute.tally', { judged: tally.judged, upheld: tally.upheld })}</Text></Flexbox>diff --git a/src/features/Acceptance/Viewer/Checks/FoldedText.tsx b/src/features/Acceptance/Viewer/Checks/FoldedText.tsxindex c0fa35286a5..e6a2817d9d5 100644--- a/src/features/Acceptance/Viewer/Checks/FoldedText.tsx+++ b/src/features/Acceptance/Viewer/Checks/FoldedText.tsx@@ -60,7 +60,7 @@ const FoldedText = memo<FoldedTextProps>(({ label, secondary, text }) => {type={secondary ? 'secondary' : undefined}>{label && (- <Text as={'span'} fontSize={11} style={{ marginInlineEnd: 6 }} type={'secondary'}>+ <Text as={'span'} fontSize={12} style={{ marginInlineEnd: 6 }} type={'secondary'}>{label}</Text>)}diff --git a/src/features/Acceptance/Viewer/Checks/PhoneDecisionBar.tsx b/src/features/Acceptance/Viewer/Checks/PhoneDecisionBar.tsxnew file mode 100644index 00000000000..a2e4ca6aa26--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/PhoneDecisionBar.tsx@@ -0,0 +1,107 @@+import { Button, DropdownMenu, Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { Ban, Check, Ellipsis, MessageSquare } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++const styles = stylex.create({+ bar: {+ position: 'sticky',+ zIndex: 2,+ insetBlockEnd: 0,+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ marginBlockStart: 'auto',+ marginBlockEnd: '-16px',+ marginInline: '-16px',+ paddingBlock: '8px',+ paddingInline: '16px',+ borderBlockStartWidth: '1px',+ borderBlockStartStyle: 'solid',+ borderBlockStartColor: cssVar.colorBorderSecondary,+ backgroundColor: cssVar.colorBgContainer,+ },+ more: {+ flex: 'none',+ minWidth: '44px',+ minHeight: '44px',+ },+ action: {+ flex: '1',+ minHeight: '44px',+ },+});++interface PhoneDecisionBarProps {+ accepting: boolean;+ ignoring: boolean;+ onAccept: (event: { stopPropagation: () => void }) => void;+ onComment?: () => void;+ onIgnore: (event: { stopPropagation: () => void }) => void;+ onReject: () => void;+ reviewPending: boolean;+}++const PhoneDecisionBar = memo<PhoneDecisionBarProps>(+ ({ accepting, ignoring, onAccept, onComment, onIgnore, onReject, reviewPending }) => {+ const { t } = useTranslation('verify');+ const busy = reviewPending || accepting || ignoring;++ return (+ <div data-phone-decision-bar {...stylex.props(styles.bar)}>+ <DropdownMenu+ placement={'topLeft'}+ items={[+ {+ disabled: busy,+ icon: <Icon icon={Ban} />,+ key: 'ignore',+ label: t('acceptance.review.ignore'),+ onClick: () => onIgnore({ stopPropagation: () => {} }),+ },+ ...(onComment+ ? [+ {+ icon: <Icon icon={MessageSquare} />,+ key: 'comment',+ label: t('acceptance.comments.evidenceModalTitle'),+ onClick: onComment,+ },+ ]+ : []),+ ]}+ >+ <Button+ aria-label={t('acceptance.review.more')}+ className={stylex.props(styles.more).className}+ icon={<Icon icon={Ellipsis} />}+ loading={ignoring}+ />+ </DropdownMenu>+ <Button+ className={stylex.props(styles.action).className}+ disabled={busy}+ onClick={onReject}+ >+ {t('acceptance.review.reject')}+ </Button>+ <Button+ className={stylex.props(styles.action).className}+ disabled={reviewPending && !accepting}+ icon={<Icon icon={Check} />}+ loading={accepting}+ type={'primary'}+ onClick={onAccept}+ >+ {t('acceptance.review.accept')}+ </Button>+ </div>+ );+ },+);++PhoneDecisionBar.displayName = 'AcceptancePhoneDecisionBar';++export default PhoneDecisionBar;diff --git a/src/features/Acceptance/Viewer/Checks/StandingDecision.tsx b/src/features/Acceptance/Viewer/Checks/StandingDecision.tsxnew file mode 100644index 00000000000..afb6427cbf8--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/StandingDecision.tsx@@ -0,0 +1,135 @@+import { Button, Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import dayjs from 'dayjs';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { useIsHydrated } from '@/hooks/useIsHydrated';++import type { CheckDecision } from './checkDecision';+import { DECISION_ICON, DECISION_LABEL_KEY } from './checkDecision';+import { FeedbackCard } from './CheckHistory';+import type { AcceptanceCheckReviewEntry, AcceptanceEvidence } from './types';++const styles = stylex.create({+ record: {+ display: 'flex',+ flexDirection: 'column',+ gap: '8px',+ paddingBlockStart: '12px',+ borderBlockStartWidth: '1px',+ borderBlockStartStyle: 'solid',+ borderBlockStartColor: cssVar.colorBorderSecondary,+ },+ head: {+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ },+ label: {+ display: 'inline-flex',+ gap: '4px',+ alignItems: 'center',+ fontSize: '12px',+ fontWeight: 500,+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ accepted: { color: cssVar.colorSuccessText },+ needsFix: { color: cssVar.colorErrorText },+ time: {+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,+ },+ undo: {+ display: 'flex',+ gap: '16px',+ alignItems: 'center',+ },+});++const REVIEW_DECISION = {+ accept: 'accepted',+ ignore: 'ignored',+ reject: 'needsFix',+} as const satisfies Record<AcceptanceCheckReviewEntry['action'], CheckDecision>;++interface StandingDecisionProps {+ accepting: boolean;+ evidenceById: Map<string, AcceptanceEvidence>;+ onAccept?: (event: { stopPropagation: () => void }) => void;+ onReject?: () => void;+ review: AcceptanceCheckReviewEntry;+ reviewPending: boolean;+}++const StandingDecision = memo<StandingDecisionProps>(+ ({ accepting, evidenceById, onAccept, onReject, review, reviewPending }) => {+ const { t } = useTranslation('verify');+ const hydrated = useIsHydrated();+ const decision = REVIEW_DECISION[review.action];+ const DecisionIcon = DECISION_ICON[decision];+ const canAccept = Boolean(onAccept) && review.action !== 'accept';+ const canReject = Boolean(onReject) && review.action !== 'reject';++ return (+ <div data-standing-decision={decision} {...stylex.props(styles.record)}>+ <div {...stylex.props(styles.head)}>+ <span+ {...stylex.props(+ styles.label,+ decision === 'accepted' && styles.accepted,+ decision === 'needsFix' && styles.needsFix,+ )}+ >+ {DecisionIcon && <Icon icon={DecisionIcon} size={14} />}+ {t(DECISION_LABEL_KEY[decision])}+ </span>+ <span {...stylex.props(styles.time)}>+ {hydrated ? dayjs(review.createdAt).format('MM-DD HH:mm') : null}+ </span>+ </div>+ {review.action === 'reject' && (+ <FeedbackCard hideHeader evidenceById={evidenceById} review={review} />+ )}+ {(canAccept || canReject) && (+ <div {...stylex.props(styles.undo)}>+ {canReject && (+ <Button+ outdent+ disabled={reviewPending}+ size={'small'}+ type={'text'}+ onClick={(event) => {+ event.stopPropagation();+ onReject?.();+ }}+ >+ {t('acceptance.review.revertToReject')}+ </Button>+ )}+ {canAccept && (+ <Button+ outdent+ disabled={reviewPending && !accepting}+ loading={accepting}+ size={'small'}+ type={'text'}+ onClick={onAccept}+ >+ {t('acceptance.review.revertToAccept')}+ </Button>+ )}+ </div>+ )}+ </div>+ );+ },+);++StandingDecision.displayName = 'AcceptanceStandingDecision';++export default StandingDecision;diff --git a/src/features/Acceptance/Viewer/Checks/checkDecision.test.ts b/src/features/Acceptance/Viewer/Checks/checkDecision.test.tsnew file mode 100644index 00000000000..1149df61a4c--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/checkDecision.test.ts@@ -0,0 +1,75 @@+import { describe, expect, it } from 'vitest';++import { checkDecision, decisionSections, decisionSegments } from './checkDecision';+import type { AcceptanceCheck } from './types';++const check = (partial: Partial<AcceptanceCheck>) =>+ ({+ result: { id: 'r' },+ reviews: [],+ state: 'passed',+ userReview: null,+ ...partial,+ }) as AcceptanceCheck;++const review = (action: string, stale = false) =>+ ({ action, stale }) as unknown as AcceptanceCheck['userReview'];++describe('checkDecision', () => {+ it('reads an unreviewed executed check as pending whatever the verifier said', () => {+ expect(checkDecision(check({ state: 'failed' }))).toBe('pending');+ expect(checkDecision(check({ state: 'passed' }))).toBe('pending');+ });++ it('reads a check with no result as not run instead of awaiting review', () => {+ expect(checkDecision(check({ result: null, state: 'not_executed' }))).toBe('notRun');+ });++ it('keeps the reviewer decision apart from the verifier verdict', () => {+ expect(checkDecision(check({ state: 'failed', userReview: review('accept') }))).toBe(+ 'accepted',+ );+ expect(checkDecision(check({ state: 'passed', userReview: review('reject') }))).toBe(+ 'needsFix',+ );+ expect(checkDecision(check({ userReview: review('ignore') }))).toBe('ignored');+ });++ it('treats a stale review as pending again', () => {+ expect(checkDecision(check({ userReview: review('accept', true) }))).toBe('pending');+ });+});++describe('decisionSegments', () => {+ it('orders settled checks first so the strip fills from the start', () => {+ expect(+ decisionSegments([+ check({}),+ check({ userReview: review('reject') }),+ check({ userReview: review('accept') }),+ check({ userReview: review('ignore') }),+ check({ result: null, state: 'not_executed' }),+ ]),+ ).toEqual(['accepted', 'needsFix', 'ignored', 'pending', 'pending']);+ });+});++describe('decisionSections', () => {+ it('puts what still needs a decision first and keeps each section in list order', () => {+ const a = check({ id: 'a', userReview: review('accept') });+ const b = check({ id: 'b' });+ const c = check({ id: 'c', result: null, state: 'not_executed' });+ const d = check({ id: 'd', userReview: review('reject') });++ expect(+ decisionSections([a, b, c, d]).map((section) => [+ section.key,+ section.checks.map((item) => item.id),+ ]),+ ).toEqual([+ ['pending', ['b', 'c']],+ ['needsFix', ['d']],+ ['accepted', ['a']],+ ]);+ });+});diff --git a/src/features/Acceptance/Viewer/Checks/checkDecision.ts b/src/features/Acceptance/Viewer/Checks/checkDecision.tsnew file mode 100644index 00000000000..a0b70d81d30--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/checkDecision.ts@@ -0,0 +1,50 @@+import { BadgeCheck, Ban, RotateCcw } from 'lucide-react';++import { userReviewState } from './checkState';+import type { AcceptanceCheck } from './types';++export type CheckDecision = 'accepted' | 'ignored' | 'needsFix' | 'notRun' | 'pending';+export type DecisionSegment = Exclude<CheckDecision, 'notRun'>;++export const checkDecision = (check: AcceptanceCheck): CheckDecision => {+ const review = userReviewState(check);+ if (review === 'accepted') return 'accepted';+ if (review === 'ignored') return 'ignored';+ if (review === 'rejected') return 'needsFix';+ return check.result ? 'pending' : 'notRun';+};++export const DECISION_ICON: Partial<Record<CheckDecision, typeof BadgeCheck>> = {+ accepted: BadgeCheck,+ ignored: Ban,+ needsFix: RotateCcw,+};++export const DECISION_LABEL_KEY = {+ accepted: 'acceptance.focus.state.accepted',+ ignored: 'acceptance.focus.state.ignored',+ needsFix: 'acceptance.focus.state.needsFix',+ notRun: 'acceptance.decision.notRun',+ pending: 'acceptance.focus.state.pending',+} as const satisfies Record<CheckDecision, string>;++const SEGMENT_ORDER: DecisionSegment[] = ['accepted', 'needsFix', 'ignored', 'pending'];++export const decisionSegments = (checks: AcceptanceCheck[]): DecisionSegment[] =>+ checks+ .map((check): DecisionSegment => {+ const decision = checkDecision(check);+ return decision === 'notRun' ? 'pending' : decision;+ })+ .sort((a, b) => SEGMENT_ORDER.indexOf(a) - SEGMENT_ORDER.indexOf(b));++const SECTION_ORDER: DecisionSegment[] = ['pending', 'needsFix', 'accepted', 'ignored'];++export const decisionSections = (checks: AcceptanceCheck[]) =>+ SECTION_ORDER.map((key) => ({+ checks: checks.filter((check) => {+ const decision = checkDecision(check);+ return (decision === 'notRun' ? 'pending' : decision) === key;+ }),+ key,+ })).filter((section) => section.checks.length > 0);diff --git a/src/features/Acceptance/Viewer/Checks/styles.ts b/src/features/Acceptance/Viewer/Checks/styles.tsindex 300e9c44f35..95a7098eaf4 100644--- a/src/features/Acceptance/Viewer/Checks/styles.ts+++ b/src/features/Acceptance/Viewer/Checks/styles.ts@@ -1,16 +1,10 @@import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import { groupHeaderMarker, rowHeaderMarker } from '../markers.stylex';--const celebratePop = stylex.keyframes({- '0%': { opacity: 0, transform: 'scale(0.6)' },- '60%': { transform: 'scale(1.15)' },- '100%': { opacity: 1, transform: 'scale(1)' },-});+import { rowHeaderMarker } from '../markers.stylex';const compact = '@media (width <= 767px)';-const hoverable = '@media (hover: hover) and (pointer: fine)';+const wideRow = '@container (inline-size >= 720px)';const rowReveal = stylex.keyframes({ from: { opacity: 0 }, to: { opacity: 1 } });export const styles = stylex.create({@@ -31,8 +25,8 @@ export const styles = stylex.create({chip: {paddingInline: '6px',borderRadius: '4px',- fontSize: '11px',- lineHeight: '18px',+ fontSize: '12px',+ lineHeight: '20px',color: cssVar.colorTextTertiary,whiteSpace: 'nowrap',backgroundColor: cssVar.colorFillTertiary,@@ -42,33 +36,45 @@ export const styles = stylex.create({color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },backgroundColor: { 'default': cssVar.colorFillTertiary, ':hover': cssVar.colorFillSecondary },},- emptyCard: {- paddingBlock: '48px',+ emptyState: {+ display: 'flex',+ flexDirection: 'column',+ gap: '4px',+ alignItems: 'flex-start',+ paddingBlock: '24px',paddingInline: '16px',- borderWidth: '1px',- borderStyle: 'solid',- borderColor: cssVar.colorBorderSecondary,- borderRadius: cssVar.borderRadiusLG,- backgroundColor: cssVar.colorBgContainer,},- celebrateIcon: {- animationName: celebratePop,- animationDuration: '0.45s',- animationTimingFunction: 'cubic-bezier(0.34, 1.56, 0.64, 1)',- animationFillMode: 'both',+ emptyTitle: {+ fontSize: '14px',+ fontWeight: 500,+ lineHeight: '22px',+ color: cssVar.colorText,},- groupCard: {- backgroundColor: cssVar.colorBgContainer,+ emptyDesc: {+ marginBlockEnd: '8px',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,},- groupHeader: {- cursor: 'pointer',- paddingBlock: '10px',- paddingInline: '16px',- backgroundColor: cssVar.colorFillQuaternary,+ sectionHeader: {+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ paddingBlockStart: '20px',+ paddingBlockEnd: '8px',+ paddingInline: { default: '16px', [compact]: 0 },+ fontSize: '12px',+ lineHeight: '20px',+ fontWeight: 500,+ color: cssVar.colorTextSecondary,+ },+ sectionCount: {+ fontVariantNumeric: 'tabular-nums',+ fontWeight: 400,+ color: cssVar.colorTextTertiary,},- groupActions: {- opacity: { default: 0, [stylex.when.ancestor(':hover', groupHeaderMarker)]: 1 },- transition: 'opacity 0.2s',+ groupCard: {+ backgroundColor: cssVar.colorBgContainer,},historyToggle: {cursor: 'pointer',@@ -80,6 +86,7 @@ export const styles = stylex.create({color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },},row: {+ containerType: 'inline-size',borderBlockStartWidth: '1px',// The list opens flush with the content above it. Grouped lists are// unaffected: their first child is the group header, so rows are never@@ -90,7 +97,7 @@ export const styles = stylex.create({seqChip: {flex: 'none',fontFamily: cssVar.fontFamilyCode,- fontSize: '11px',+ fontSize: '12px',lineHeight: '22px',color: cssVar.colorTextSecondary,letterSpacing: '0.02em',@@ -126,13 +133,79 @@ export const styles = stylex.create({display: {default: null,[compact]: { 'default': null, ':empty': 'none' },- [hoverable]: {- default: null,- [stylex.when.ancestor(':not([data-expanded], :hover, :focus-within)', rowHeaderMarker)]:- 'none',- },},},+ decision: {+ display: 'inline-flex',+ flex: 'none',+ gap: '4px',+ alignItems: 'center',+ minWidth: { default: '88px', [compact]: 0 },+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ whiteSpace: 'nowrap',+ },+ decisionAccepted: { color: cssVar.colorSuccessText },+ decisionNeedsFix: { color: cssVar.colorErrorText },+ decisionNotRun: { color: cssVar.colorTextTertiary },+ titleSettled: { color: cssVar.colorTextSecondary },+ body: {+ display: 'grid',+ gridTemplateColumns: { default: 'minmax(0, 1fr)', [wideRow]: 'minmax(0, 1fr) 280px' },+ columnGap: '24px',+ rowGap: '12px',+ },+ bodySingle: {+ gridTemplateColumns: 'minmax(0, 560px)',+ },+ bodyInList: {+ paddingBlockEnd: '16px',+ paddingInlineStart: { default: '16px', [wideRow]: '60px', [compact]: 0 },+ paddingInlineEnd: { default: '16px', [compact]: 0 },+ },+ // Evidence can run several screens long; the verdict and the decision stay+ // beside whichever part of it is on screen.+ side: {+ position: { default: null, [wideRow]: 'sticky' },+ insetBlockStart: { default: null, [wideRow]: '16px' },+ alignSelf: { default: null, [wideRow]: 'start' },+ minWidth: 0,+ },+ sideActions: {+ display: 'flex',+ flexDirection: { default: 'row', [wideRow]: 'column-reverse' },+ flexWrap: { default: 'wrap', [wideRow]: 'nowrap' },+ gap: '8px',+ alignItems: { default: 'center', [wideRow]: 'stretch' },+ justifyContent: 'space-between',+ paddingBlockStart: { default: null, [wideRow]: '16px' },+ borderBlockStartWidth: { default: null, [wideRow]: '1px' },+ borderBlockStartStyle: { default: null, [wideRow]: 'solid' },+ borderBlockStartColor: { default: null, [wideRow]: cssVar.colorBorderSecondary },+ },+ detailContainer: {+ flexGrow: '1',+ flexShrink: '0',+ flexBasis: 'auto',+ containerType: 'inline-size',+ },+ detailEvidence: {+ minHeight: { default: 'min(480px, 70dvh)', [wideRow]: 'max(420px, calc(100dvh - 216px))' },+ },+ detailStack: {+ display: 'flex',+ flexDirection: { default: 'row', [wideRow]: 'column-reverse' },+ gap: '8px',+ },+ detailStackItem: {+ flex: { default: '1', [wideRow]: 'none' },+ },+ decisionStack: {+ display: 'flex',+ flexDirection: { default: 'row-reverse', [wideRow]: 'column' },+ gap: '8px',+ },rowTitle: {gridArea: { default: null, [compact]: '2 / 1 / auto / -1' },},diff --git a/src/features/Acceptance/Viewer/Checks/useCheckReviewActions.ts b/src/features/Acceptance/Viewer/Checks/useCheckReviewActions.tsnew file mode 100644index 00000000000..159890208f5--- /dev/null+++ b/src/features/Acceptance/Viewer/Checks/useCheckReviewActions.ts@@ -0,0 +1,163 @@+import { readEvidenceChapters } from '@lobechat/const/verify';+import { useState } from 'react';++import { isRejectable } from '../Evidence/evidence';+import { openCheckRejectModal } from '../Review/CheckRejectModal';+import type { CheckProposal } from '../Review/proposal';+import { classifyProposalEdit } from '../Review/proposal';+import { shouldCollapseAfterReview } from './checkState';+import type {+ AcceptanceCheck,+ AcceptanceCheckReviewEntry,+ CheckReviewInput,+ ProposalDismissInput,+} from './types';++interface StoppableEvent {+ stopPropagation: () => void;+}++interface UseCheckReviewActionsParams {+ activeReview?: AcceptanceCheckReviewEntry;+ check: AcceptanceCheck;+ expanded: boolean;+ onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;+ onReview: (input: CheckReviewInput) => Promise<boolean>;+ onToggle: () => void;+ refreshEvidenceUrl: Parameters<typeof openCheckRejectModal>[0]['refreshEvidenceUrl'];+ title: string;+}++export const useCheckReviewActions = ({+ activeReview,+ check,+ expanded,+ onDismissProposal,+ onReview,+ onToggle,+ refreshEvidenceUrl,+ title,+}: UseCheckReviewActionsParams) => {+ const [accepting, setAccepting] = useState(false);+ const [ignoring, setIgnoring] = useState(false);+ const [rejecting, setRejecting] = useState(false);+ const [reviewComment, setReviewComment] = useState('');++ // With `fromProposal` the modal opens prefilled with the model's note and+ // regions, and the submitted result is diffed against it so the signal+ // records WHICH part of the proposal was wrong.+ const openReject = (fromProposal?: CheckProposal, initialEvidenceId?: string) =>+ openCheckRejectModal({+ initialEvidenceId,+ previousAttachments:+ activeReview?.action === 'reject'+ ? activeReview.attachments+ ?.filter((item) => item.url)+ .map((item) => ({ id: item.id, name: item.name, url: item.url! }))+ : undefined,+ previousAnnotations: activeReview?.action === 'reject' ? activeReview.annotations : undefined,+ previousComment: activeReview?.action === 'reject' ? activeReview.comment : undefined,+ refreshEvidenceUrl,+ checkDescription: check.planItem?.description,+ checkTitle: `C${check.seq} · ${title}`,+ draftKey: `${check.result?.id ?? 'unexecuted'}:${check.id}`,+ evidence: check.evidence.filter(isRejectable).map((item) => ({+ chapters: item.type === 'video' ? readEvidenceChapters(item.metadata) : undefined,+ fileUrl: item.fileUrl!,+ id: item.id,+ type: item.type,+ })),+ initialAnnotations: fromProposal?.annotations ?? undefined,+ initialComment: fromProposal?.comment ?? reviewComment,+ onConfirm: async ({ annotations, comment, fileIds }) => {+ const ok = await onReview({+ action: 'reject',+ annotations: annotations.length > 0 ? annotations : undefined,+ checkItemIds: [check.id],+ comment: comment || undefined,+ fileIds: fileIds.length > 0 ? fileIds : undefined,+ ...(fromProposal+ ? {+ proposal: {+ adjudication: 'confirmed' as const,+ edit: classifyProposalEdit(fromProposal, { annotations, comment }),+ predictionId: fromProposal.id,+ },+ }+ : {}),+ });+ if (ok) {+ setReviewComment('');+ if (shouldCollapseAfterReview(ok, expanded)) onToggle();+ }+ return ok;+ },+ });++ // Dismissing a proposal is NOT a review of the check — the check stays+ // pending and the reviewer still has to judge it. Only the model's opinion+ // is being answered, so this writes the outcome without touching+ // `user_decision`.+ const handleAdjudicate = async (adjudication: 'not-an-issue' | 'misidentified') => {+ if (!check.prediction) return;+ await onDismissProposal?.({+ adjudication,+ checkItemId: check.id,+ predictionId: check.prediction.id,+ });+ };++ // Accepting settles the check — the row folds itself away once the write+ // lands, so the reviewer's eye moves on to what still needs judgment.+ const handleAccept = async (event: StoppableEvent) => {+ event.stopPropagation();+ setAccepting(true);+ const comment = reviewComment.trim();+ const ok = await onReview({+ action: 'accept',+ checkItemIds: [check.id],+ comment: comment || undefined,+ });+ setAccepting(false);+ if (ok) setReviewComment('');+ if (shouldCollapseAfterReview(ok, expanded)) onToggle();+ };++ const handleReject = async (event: StoppableEvent) => {+ event.stopPropagation();+ const comment = reviewComment.trim();+ if (!comment) return;+ setRejecting(true);+ const ok = await onReview({+ action: 'reject',+ checkItemIds: [check.id],+ comment,+ });+ setRejecting(false);+ if (ok) setReviewComment('');+ if (shouldCollapseAfterReview(ok, expanded)) onToggle();+ };++ const handleIgnore = async (event: StoppableEvent) => {+ event.stopPropagation();+ setIgnoring(true);+ const ok = await onReview({ action: 'ignore', checkItemIds: [check.id] });+ setIgnoring(false);+ if (shouldCollapseAfterReview(ok, expanded)) onToggle();+ };++ return {+ accepting,+ handleAccept,+ handleAdjudicate,+ handleIgnore,+ handleReject,+ ignoring,+ openReject,+ rejecting,+ reviewComment,+ setReviewComment,+ };+};++export type CheckReviewActions = ReturnType<typeof useCheckReviewActions>;diff --git a/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx b/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsxindex 293aae577fa..4fa9b5ea6e5 100644--- a/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx+++ b/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx@@ -1,19 +1,21 @@'use client';import type { AcceptanceCommentThread } from '@lobechat/types';-import { Button, Flexbox, Text } from '@lobehub/ui';+import { Button, Flexbox, Icon, Text } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import { BadgeCheck, Undo2 } from 'lucide-react';+import { BadgeCheck, Info, MessagesSquare, RefreshCw, Undo2 } from 'lucide-react';import { nanoid } from 'nanoid';import { memo, useCallback, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';import { useUserStore } from '@/store/user';import { authSelectors, userProfileSelectors } from '@/store/user/selectors';+import { useVerifyStore } from '@/store/verify';import { buildAuthReturnUrl, currentReturnPath } from '@/utils/authReturnUrl';import { useAcceptanceScope } from '../AcceptanceScope';+import QuietState from '../QuietState';import { useAcceptanceBundle } from '../useAcceptanceBundle';import AccessRequestEntry from './AccessRequestEntry';import { commentAnchorId, useCommentAnchor } from './anchor';@@ -71,11 +73,6 @@ const local = stylex.create({marginBlockStart: '12px',marginBlockEnd: '4px',},- empty: {- paddingBlock: '16px',- fontSize: '13px',- color: cssVar.colorTextTertiary,- },feed: {flex: '1',minWidth: 0,@@ -324,9 +321,24 @@ const AcceptanceDiscussion = memo<{ onOpenChecks?: () => void }>(({ onOpenChecks</Flexbox>) : error ? (// A read that failed says nothing about permission.- <Text fontSize={13} type={'secondary'}>- {t('acceptance.comments.loadFailed')}- </Text>+ <QuietState+ icon={Info}+ title={t('acceptance.comments.loadFailedTitle')}+ tone={'warning'}+ action={+ <Button+ icon={<Icon icon={RefreshCw} />}+ onClick={() =>+ void useVerifyStore+ .getState()+ .refreshAcceptanceComments(acceptanceId)+ .catch(() => undefined)+ }+ >+ {t('report.actions.retry')}+ </Button>+ }+ />) : isLoading ? null : isSignedIn ? ( // Neither line below is true yet while the answer is in flight.<Text fontSize={13} type={'secondary'}>{t('acceptance.comments.readOnly')}@@ -341,8 +353,8 @@ const AcceptanceDiscussion = memo<{ onOpenChecks?: () => void }>(({ onOpenChecks<div {...stylex.props(local.container)}><div {...stylex.props(local.layout)}><Flexbox {...stylex.props(local.feed)}>- {timeline.length === 0 && (- <span {...stylex.props(local.empty)}>{t('acceptance.comments.empty')}</span>+ {timeline.length === 0 && !error && (+ <QuietState icon={MessagesSquare} title={t('acceptance.comments.emptyTitle')} />)}{ungrouped ? (<>diff --git a/src/features/Acceptance/Viewer/Comments/AccessRequestEntry.tsx b/src/features/Acceptance/Viewer/Comments/AccessRequestEntry.tsxindex d274074369f..123dbf2e73e 100644--- a/src/features/Acceptance/Viewer/Comments/AccessRequestEntry.tsx+++ b/src/features/Acceptance/Viewer/Comments/AccessRequestEntry.tsx@@ -21,7 +21,7 @@ const styles = stylex.create({borderInlineStartStyle: 'solid',borderInlineStartWidth: 2,color: cssVar.colorText,- fontSize: 13,+ fontSize: 14,lineHeight: 1.65,overflowWrap: 'anywhere',paddingBlock: 6,diff --git a/src/features/Acceptance/Viewer/Comments/CollaborationRequestBanner.tsx b/src/features/Acceptance/Viewer/Comments/CollaborationRequestBanner.tsxindex 78c870e6248..f342287f30a 100644--- a/src/features/Acceptance/Viewer/Comments/CollaborationRequestBanner.tsx+++ b/src/features/Acceptance/Viewer/Comments/CollaborationRequestBanner.tsx@@ -136,7 +136,7 @@ const CollaborationRequestBanner = () => {size={16}/><Flexbox flex={1} gap={2} style={{ minWidth: 200 }}>- <Text fontSize={13} weight={500}>+ <Text fontSize={14} weight={500}>{pending ? t('acceptance.access.pendingTitle') : t('acceptance.access.title')}</Text><span {...stylex.props(styles.description)}>diff --git a/src/features/Acceptance/Viewer/Comments/CommentCard.tsx b/src/features/Acceptance/Viewer/Comments/CommentCard.tsxindex 1d5c881837c..866de12cc77 100644--- a/src/features/Acceptance/Viewer/Comments/CommentCard.tsx+++ b/src/features/Acceptance/Viewer/Comments/CommentCard.tsx@@ -161,7 +161,7 @@ const CommentCard = memo<CommentCardProps>({variant === 'plain' && <CommentAvatar comment={comment} size={18} />}{variant === 'feed' && <CommentAvatar comment={comment} size={TIMELINE_NODE} />}<Text- fontSize={13}+ fontSize={14}weight={600}{...stylex.props(nameOverride ? styles.headline : styles.authorName)}>diff --git a/src/features/Acceptance/Viewer/Comments/CommentReactions.tsx b/src/features/Acceptance/Viewer/Comments/CommentReactions.tsxindex 9f5dd8c2f8a..1d870315ac0 100644--- a/src/features/Acceptance/Viewer/Comments/CommentReactions.tsx+++ b/src/features/Acceptance/Viewer/Comments/CommentReactions.tsx@@ -34,7 +34,7 @@ const styles = stylex.create({borderStyle: 'solid',borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },borderRadius: '999px',- fontSize: '13px',+ fontSize: '14px',lineHeight: 1,backgroundColor: cssVar.colorFillQuaternary,},diff --git a/src/features/Acceptance/Viewer/Comments/CommentWorkspace.tsx b/src/features/Acceptance/Viewer/Comments/CommentWorkspace.tsxindex 060e6cbca0f..bdcfcec2214 100644--- a/src/features/Acceptance/Viewer/Comments/CommentWorkspace.tsx+++ b/src/features/Acceptance/Viewer/Comments/CommentWorkspace.tsx@@ -121,7 +121,7 @@ const styles = stylex.create({width: 18,height: 18,borderRadius: '50%',- fontSize: 11,+ fontSize: 12,fontWeight: 600,lineHeight: '18px',color: cssVar.colorTextLightSolid,diff --git a/src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsx b/src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsxindex 6cce5be061d..cdbf48a7dcf 100644--- a/src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsx+++ b/src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsx@@ -11,6 +11,7 @@ import {Text,toast,useModalContext,+ useResponsive,} from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';@@ -26,6 +27,7 @@ import { userProfileSelectors } from '@/store/user/selectors';import type { AcceptanceEvidence } from '../Checks/types';import { AnnotationCanvas } from '../Evidence/Annotation';import { isCommentableEvidence } from '../Evidence/evidence';+import { EvidenceStage } from '../Evidence/EvidenceStage';import {CommentWorkspace,DraftEmpty,@@ -121,7 +123,7 @@ const styles = stylex.create({height: '16px',paddingInline: '4px',borderRadius: '8px',- fontSize: '11px',+ fontSize: '12px',fontWeight: 600,lineHeight: '16px',color: cssVar.colorBgContainer,@@ -194,6 +196,7 @@ const ImageCommentEditor = ({}: EditorProps) => {const { t } = useTranslation('verify');const { close, setCanDismissByClickOutside } = useModalContext();+ const { md = true } = useResponsive();const key = evidenceCommentDraftKey(userId, acceptanceId, active.id);const [draft, setDraft] = useState<EvidenceCommentDraft>(() =>@@ -245,10 +248,18 @@ const ImageCommentEditor = ({if (!rect) status = t('acceptance.comments.draftNeedsRegion');else if (!trimmed) status = t('acceptance.comments.draftNeedsText', { index: 1 });+ const canvas = {+ annotations: rect ? [{ comment: '', rect }] : [],+ onDraw: (next: AcceptanceReviewAnnotation['rect']) => update({ rect: next }),+ onRemove: () => update({ rect: null }),+ onUpdate: (_index: number, next: AcceptanceReviewAnnotation['rect']) => update({ rect: next }),+ src: active.fileUrl!,+ };+return (<CommentWorkspaceinert={submitting}- stageMode={'scroll'}+ stageMode={md ? 'fit' : 'scroll'}strip={strip}footer={<DraftFooter@@ -284,13 +295,13 @@ const ImageCommentEditor = ({</>}stage={- <AnnotationCanvas- annotations={rect ? [{ comment: '', rect }] : []}- src={active.fileUrl!}- onDraw={(next) => update({ rect: next })}- onRemove={() => update({ rect: null })}- onUpdate={(_index, next) => update({ rect: next })}- />+ // A phone gives the stage no height of its own to fit into, so the+ // picture keeps the full width there and the page scrolls.+ md ? (+ <EvidenceStage contain drawing zoom={1} {...canvas} />+ ) : (+ <AnnotationCanvas {...canvas} />+ )}/>);diff --git a/src/features/Acceptance/Viewer/Comments/styles.ts b/src/features/Acceptance/Viewer/Comments/styles.tsindex f4f37e36e7c..71fb8ef2bde 100644--- a/src/features/Acceptance/Viewer/Comments/styles.ts+++ b/src/features/Acceptance/Viewer/Comments/styles.ts@@ -105,7 +105,7 @@ export const styles = stylex.create({},event: {paddingBlock: '2px',- fontSize: '13px',+ fontSize: '14px',color: cssVar.colorTextSecondary,},eventDot: {@@ -148,7 +148,7 @@ export const styles = stylex.create({},panelBody: {paddingBlockStart: '6px',- fontSize: '13px',+ fontSize: '14px',lineHeight: 1.65,overflowWrap: 'anywhere',whiteSpace: 'pre-wrap',@@ -175,7 +175,7 @@ export const styles = stylex.create({width: '100%',padding: 0,borderStyle: 'none',- fontSize: '13px',+ fontSize: '14px',color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorTextSecondary },textAlign: 'start',backgroundColor: 'transparent',diff --git a/src/features/Acceptance/Viewer/Conversation/CollaboratorTopicPanel.tsx b/src/features/Acceptance/Viewer/Conversation/CollaboratorTopicPanel.tsxindex 88ce732690e..a3e2cd13e05 100644--- a/src/features/Acceptance/Viewer/Conversation/CollaboratorTopicPanel.tsx+++ b/src/features/Acceptance/Viewer/Conversation/CollaboratorTopicPanel.tsx@@ -40,7 +40,7 @@ const styles = stylex.create({},empty: {color: cssVar.colorTextTertiary,- fontSize: 13,+ fontSize: 14,paddingBlock: 24,paddingInline: 16,},@@ -194,7 +194,7 @@ const CollaboratorTopicPanel = ({ onCollapse }: { onCollapse: () => void }) => {background={collaboration.agent.backgroundColor ?? undefined}size={20}/>- <Text ellipsis strong style={{ flex: 1, fontSize: 13, minWidth: 0 }}>+ <Text ellipsis strong style={{ flex: 1, fontSize: 14, minWidth: 0 }}>{collaboration.topicTitle ?? agentName}</Text><ActionIcondiff --git a/src/features/Acceptance/Viewer/Conversation/TopicPanel.tsx b/src/features/Acceptance/Viewer/Conversation/TopicPanel.tsxindex 987e0004704..98ced95043e 100644--- a/src/features/Acceptance/Viewer/Conversation/TopicPanel.tsx+++ b/src/features/Acceptance/Viewer/Conversation/TopicPanel.tsx@@ -36,7 +36,7 @@ const TopicPanel = memo<OriginTopicPanelProps>(background={agentBackgroundColor ?? undefined}size={20}/>- <Text ellipsis strong style={{ flex: 1, minWidth: 0, fontSize: 13 }}>+ <Text ellipsis strong style={{ flex: 1, minWidth: 0, fontSize: 14 }}>{title}</Text><ActionIcondiff --git a/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx b/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsxindex 145a5611b02..9f8a11633c2 100644--- a/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx+++ b/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx@@ -1,164 +1,190 @@'use client';-import { Empty, Flexbox, Icon, Image, Text, useResponsive } from '@lobehub/ui';+import { isDraftVerifyRun } from '@lobechat/const/verify';+import { Button, Select } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import dayjs from 'dayjs';-import { FileText, Film, Paperclip, SquareTerminal } from 'lucide-react';+import { Paperclip } from 'lucide-react';+import { useState } from 'react';import { useTranslation } from 'react-i18next';import { useIsHydrated } from '@/hooks/useIsHydrated';import { useAcceptanceScope } from '../AcceptanceScope';-import { checksForTurn } from '../turnChecks';+import QuietState from '../QuietState';import { useAcceptanceBundle } from '../useAcceptanceBundle';import { useAcceptanceTurn } from '../useAcceptanceTurn';+import {+ collectResources,+ countResources,+ filterResources,+ RESOURCE_FILTERS,+ type ResourceFilter,+ type ResourceItem,+} from './resources';+import ResourceTile from './ResourceTile';++const narrow = '@container (width < 720px)';+const single = '@container (width < 440px)';const styles = stylex.create({- column: { display: 'flex', flex: '1', flexDirection: 'column', gap: '12px', minInlineSize: '0' },- grid: { display: 'flex', gap: '12px', alignItems: 'flex-start' },- item: {- cursor: 'pointer',- overflow: 'hidden',- inlineSize: '100%',- borderWidth: '1px',- borderStyle: 'solid',- borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },- borderRadius: cssVar.borderRadiusLG,- backgroundColor: cssVar.colorBgContainer,- backgroundImage: 'none',- },- meta: { paddingBlock: '8px', paddingInline: '10px' },- nonVisual: {+ root: { containerType: 'inline-size', display: 'flex', flexDirection: 'column', gap: '16px' },+ toolbar: {display: 'flex',+ flexWrap: 'wrap',+ gap: '8px',+ alignItems: 'center',+ minHeight: '28px',+ },+ filters: { display: 'flex', flex: '1', gap: '4px', alignItems: 'center', minWidth: 0 },+ filter: {+ cursor: 'pointer',+ display: 'inline-flex',gap: '8px',alignItems: 'center',- paddingBlock: '18px',+ height: '28px',+ margin: '0',+ paddingBlock: 0,paddingInline: '12px',- backgroundColor: cssVar.colorFillQuaternary,+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '6px',+ font: 'inherit',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ whiteSpace: 'nowrap',+ appearance: 'none',+ backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },backgroundImage: 'none',+ outlineWidth: { 'default': null, ':focus-visible': '2px' },+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimary },+ outlineOffset: { 'default': null, ':focus-visible': '2px' },+ },+ filterOn: {+ fontWeight: 500,+ color: cssVar.colorText,+ backgroundColor: { 'default': cssVar.colorFillSecondary, ':hover': cssVar.colorFillSecondary },+ },+ filterCount: { fontWeight: 400, color: cssVar.colorTextTertiary },+ roundSelect: { width: '128px' },+ grid: {+ display: 'grid',+ gridTemplateColumns: {+ default: 'repeat(3, minmax(0, 1fr))',+ [narrow]: 'repeat(2, minmax(0, 1fr))',+ [single]: 'minmax(0, 1fr)',+ },+ gap: '16px',},});-const isVisual = (type: string) => type === 'screenshot' || type === 'gif';+const FILTER_LABEL_KEY = {+ all: 'acceptance.resources.filter.all',+ other: 'acceptance.resources.filter.other',+ recording: 'acceptance.resources.filter.recording',+ screenshot: 'acceptance.resources.filter.screenshot',+} as const satisfies Record<ResourceFilter, string>;-/**- * 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, embedded } = useAcceptanceScope();- const { turn } = useAcceptanceTurn(embedded);+ const { setTurn, turn } = useAcceptanceTurn(embedded);const { data } = useAcceptanceBundle(acceptanceId);+ const [kind, setKind] = useState<ResourceFilter>('all');if (!data) return null;- const seen = new Set<string>();- const items = checksForTurn(data, turn)- .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)+ const rounds = data.rounds ?? [];+ const all = collectResources(data.checks ?? []);+ if (all.length === 0)return (- <Flexbox paddingBlock={32}>- <Empty description={t('acceptance.resources.empty')} icon={Paperclip} />- </Flexbox>+ <QuietState+ description={t('acceptance.resources.emptyDescription')}+ icon={Paperclip}+ title={t('acceptance.resources.emptyTitle')}+ />);- const columnCount = lg ? 3 : md ? 2 : 1;- const columns: (typeof items)[] = Array.from({ length: columnCount }, () => []);- items.forEach((entry, index) => columns[index % columnCount]!.push(entry));+ const counts = countResources(filterResources(all, { kind: 'all', round: turn }));+ const visible = filterResources(all, { kind, round: turn });- return (- <div {...stylex.props(styles.grid)}>- {columns.map((column, columnIndex) => (- <div {...stylex.props(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);+ const detailOf = (item: ResourceItem) =>+ [+ `C${item.checkSeq}`,+ item.roundIndex === null ? null : t('acceptance.round', { round: item.roundIndex }),+ hydrated && item.evidence.capturedAt+ ? dayjs(item.evidence.capturedAt).format('MM-DD HH:mm')+ : null,+ ]+ .filter(Boolean)+ .join(' · ');- return (- <div- {...stylex.props(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 {...stylex.props(styles.nonVisual)}>- <Icon- size={16}- style={{ color: cssVar.colorTextTertiary }}- icon={- evidence.type === 'video'- ? Film- : evidence.type === 'terminal'- ? SquareTerminal- : FileText- }- />- <Text ellipsis fontSize={13}>- {name}- </Text>- </div>- )}- <Flexbox className={stylex.props(styles.meta).className} gap={2}>- <Text ellipsis fontSize={12}>- {name}- </Text>- <Text ellipsis fontSize={11} type={'secondary'}>- {[check, captured].filter(Boolean).join(' · ')}- </Text>- </Flexbox>- </div>- );- })}+ return (+ <div {...stylex.props(styles.root)}>+ <div {...stylex.props(styles.toolbar)}>+ <div+ aria-label={t('acceptance.resources.filterLabel')}+ role={'group'}+ {...stylex.props(styles.filters)}+ >+ {RESOURCE_FILTERS.map((filter) => (+ <button+ aria-pressed={kind === filter}+ key={filter}+ type={'button'}+ {...stylex.props(styles.filter, kind === filter && styles.filterOn)}+ onClick={() => setKind(filter)}+ >+ {t(FILTER_LABEL_KEY[filter])}+ <span {...stylex.props(styles.filterCount)}>{counts[filter]}</span>+ </button>+ ))}+ </div>+ {rounds.length > 1 && (+ <Select+ aria-label={t('acceptance.resources.roundLabel')}+ className={stylex.props(styles.roundSelect).className}+ value={turn === null ? 'all' : String(turn)}+ variant={'filled'}+ options={[+ { label: t('acceptance.filter.roundAll'), value: 'all' },+ ...[...rounds].reverse().map((round) => ({+ label: isDraftVerifyRun(round.run)+ ? t('flow.pendingPlan')+ : t('acceptance.round', { round: round.run.roundIndex }),+ value: String(round.run.roundIndex),+ })),+ ]}+ onChange={(value) => setTurn(value === 'all' ? null : Number(value))}+ />+ )}+ </div>+ {visible.length === 0 ? (+ <QuietState+ icon={Paperclip}+ title={t('acceptance.resources.noMatch')}+ action={+ <Button+ onClick={() => {+ setKind('all');+ if (turn !== null) setTurn(null);+ }}+ >+ {t('acceptance.resources.showAll', { count: all.length })}+ </Button>+ }+ />+ ) : (+ <div {...stylex.props(styles.grid)}>+ {visible.map((item) => (+ <ResourceTile detail={detailOf(item)} item={item} key={item.key} />+ ))}</div>- ))}+ )}</div>);};diff --git a/src/features/Acceptance/Viewer/Evidence/Annotation.tsx b/src/features/Acceptance/Viewer/Evidence/Annotation.tsxindex 46d16655e83..8915f9d8319 100644--- a/src/features/Acceptance/Viewer/Evidence/Annotation.tsx+++ b/src/features/Acceptance/Viewer/Evidence/Annotation.tsx@@ -27,15 +27,15 @@ const coarse = '@media (pointer: coarse)';const styles = stylex.create({badge: {position: 'absolute',- insetBlockStart: '-9px',- insetInlineStart: '-9px',+ insetBlockStart: '-10px',+ insetInlineStart: '-10px',display: 'inline-flex',alignItems: 'center',justifyContent: 'center',- width: '18px',- height: '18px',+ width: '20px',+ height: '20px',borderRadius: '50%',- fontSize: '11px',+ fontSize: '12px',fontWeight: 600,lineHeight: 1,color: cssVar.colorTextLightSolid,@@ -48,13 +48,13 @@ const styles = stylex.create({badgeDelete: {cursor: 'pointer',position: 'absolute',- insetBlockStart: { default: '-9px', [coarse]: '-12px' },- insetInlineEnd: { default: '-9px', [coarse]: '-12px' },+ insetBlockStart: { default: '-10px', [coarse]: '-12px' },+ insetInlineEnd: { default: '-10px', [coarse]: '-12px' },display: 'inline-flex',alignItems: 'center',justifyContent: 'center',- width: { default: '18px', [coarse]: '24px' },- height: { default: '18px', [coarse]: '24px' },+ width: { default: '20px', [coarse]: '24px' },+ height: { default: '20px', [coarse]: '24px' },borderStyle: 'none',borderRadius: '50%',color: cssVar.colorTextLightSolid,@@ -211,6 +211,7 @@ interface AnnotationCanvasProps {*/imageWidth?: number;onDraw: (rect: Rect) => void;+ onLoad?: React.ReactEventHandler<HTMLImageElement>;onRemove: (index: number) => void;/** Reposition / resize an existing region. */onUpdate: (index: number, rect: Rect) => void;@@ -222,7 +223,7 @@ interface AnnotationCanvasProps {* corner handle to resize; each region carries its own note.*/export const AnnotationCanvas = memo<AnnotationCanvasProps>(- ({ annotations, drawing = true, imageWidth, onDraw, onRemove, onUpdate, src }) => {+ ({ annotations, drawing = true, imageWidth, onDraw, onLoad, onRemove, onUpdate, src }) => {const { draft, handlers, imageRef, startEdit } = useAnnotationGesture({drawing,onDraw,@@ -246,6 +247,7 @@ export const AnnotationCanvas = memo<AnnotationCanvasProps>(draggable={false}ref={imageRef}src={src}+ onLoad={onLoad}// Zoomed width comes from the host (viewport × zoom); the frame// shrink-wraps the image, so overlays track exactly.{...sx(styles.image, imageWidth ? { maxWidth: 'none', width: imageWidth } : undefined)}diff --git a/src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsx b/src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsxindex 8723b69a2d0..6236a6896d1 100644--- a/src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsx+++ b/src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsx@@ -4,18 +4,14 @@ import { ActionIcon, Button, Flexbox, Icon, Text, TextArea } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { Film, ZoomIn, ZoomOut } from 'lucide-react';-import { memo, useRef } from 'react';+import { memo } from 'react';import { useTranslation } from 'react-i18next';-import { sx } from '@/styles/sx';-import { ZOOM_STEPS } from '../Review/rejectDraft';import type { RejectReviewModel } from '../Review/useRejectReview';import { AttachmentStrip, AttachmentUploadButton } from './attachments';import { EvidenceStage } from './EvidenceStage';import { RegionNotes } from './RegionNotes';-import { VideoNotes } from './Video/VideoNotes';-import type { VideoReviewStageHandle } from './Video/VideoReviewStage';import { VideoReviewStage } from './Video/VideoReviewStage';const styles = stylex.create({@@ -24,59 +20,88 @@ const styles = stylex.create({display: 'flex',flex: '1',flexDirection: 'column',+ gap: '12px',minHeight: 0,},footer: {+ display: 'flex',flex: 'none',+ flexDirection: 'column',+ gap: '8px',paddingBlockStart: '12px',borderBlockStartWidth: '1px',borderBlockStartStyle: 'solid',borderBlockStartColor: cssVar.colorBorderSecondary,},+ strip: {+ overflowX: 'auto',+ display: 'flex',+ flex: 'none',+ gap: '8px',+ },// Stage and notes side by side — the pointer that circles a region is the// same one that types about it, so neither should scroll the other away.stageRow: {- display: 'flex',+ display: 'grid',+ gridTemplateColumns: 'minmax(0, 1fr) 320px',+ gridTemplateRows: 'minmax(0, 1fr)',flex: '1',gap: '16px',minHeight: 0,},+ stageCell: {+ display: 'flex',+ minWidth: 0,+ minHeight: 0,+ },+ stageCellWide: {+ gridColumnStart: 1,+ gridColumnEnd: -1,+ },notes: {overflowY: 'auto',display: 'flex',- flex: 'none',flexDirection: 'column',gap: '12px',- width: '320px',minWidth: 0,+ minHeight: 0,},thumb: {cursor: 'pointer',overflow: 'hidden',+ flex: 'none',width: '72px',- height: '48px',- borderWidth: '2px',+ aspectRatio: '16 / 10',+ padding: 0,+ borderWidth: '1px',borderStyle: 'solid',- borderColor: 'transparent',- borderRadius: cssVar.borderRadius,+ borderColor: cssVar.colorBorder,+ borderRadius: cssVar.borderRadiusSM,+ backgroundColor: cssVar.colorFillTertiary,+ backgroundImage: 'none',},thumbImage: {display: 'block',width: '100%',height: '100%',objectFit: 'cover',+ objectPosition: 'top',},// A video has no poster to thumbnail without decoding it — an icon tile says what it is.videoThumb: {display: 'flex',alignItems: 'center',justifyContent: 'center',+ height: '100%',color: '#fff',backgroundColor: '#000',backgroundImage: 'none',},thumbActive: {- borderColor: cssVar.colorPrimary,+ outlineWidth: '2px',+ outlineStyle: 'solid',+ outlineColor: cssVar.colorPrimary,+ outlineOffset: '-2px',},// The zoom pill floats bottom-center over the stage — controls live with// the thing they control, not in a detached toolbar row.@@ -89,12 +114,9 @@ const styles = stylex.create({display: 'flex',gap: '4px',alignItems: 'center',- paddingBlock: '4px',+ height: '36px',paddingInline: '8px',- borderWidth: '1px',- borderStyle: 'solid',- borderColor: cssVar.colorBorderSecondary,- borderRadius: '99px',+ borderRadius: '999px',backgroundColor: cssVar.colorBgElevated,backgroundImage: 'none',boxShadow: cssVar.boxShadowSecondary,@@ -103,9 +125,21 @@ const styles = stylex.create({minWidth: '44px',fontSize: '12px',fontVariantNumeric: 'tabular-nums',- color: cssVar.colorTextSecondary,+ color: cssVar.colorText,textAlign: 'center',},+ actions: {+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ },+ attachments: {+ display: 'flex',+ flex: '1',+ gap: '8px',+ alignItems: 'center',+ minWidth: 0,+ },});interface DesktopEvidenceReviewProps {@@ -129,129 +163,107 @@ export const DesktopEvidenceReview = memo<DesktopEvidenceReviewProps>(({ model }evidence,failed,handlePaste,- hasEvidence,loading,uploading,zoom,} = model;- const videoStage = useRef<VideoReviewStageHandle>(null);const isVideo = activeEvidence?.type === 'video';return (<div {...stylex.props(styles.body)}>- {activeEvidence && (- <Flexbox flex={1} gap={12} style={{ minHeight: 0 }}>- <Flexbox gap={12} height={'100%'} style={{ minHeight: 0 }}>- {evidence.length > 1 && (- <Flexbox horizontal gap={8} style={{ overflowX: 'auto', flex: 'none' }}>- {evidence.map((item, index) => (- <button- aria-pressed={item.id === activeEvidence.id}- key={item.id}- type={'button'}- aria-label={t('acceptance.review.imageNumber', {- current: index + 1,- total: evidence.length,- })}- {...sx(styles.thumb, item.id === activeEvidence.id && styles.thumbActive, {- flexShrink: 0,- })}- onClick={() => model.selectEvidence(index)}- >- {item.type === 'video' ? (- <span {...sx(styles.videoThumb, { height: '100%' })}>- <Icon icon={Film} size={18} />- </span>- ) : (- <img alt={''} src={item.fileUrl} {...stylex.props(styles.thumbImage)} />- )}- </button>- ))}- </Flexbox>- )}- <div {...sx(styles.stageRow, { position: 'relative' })}>- {isVideo ? (- <VideoReviewStage- chapters={activeEvidence.chapters ?? []}- handleRef={videoStage}- key={activeEvidence.id}- notes={activeAnnotations}- src={activeEvidence.fileUrl}- onAddNote={model.addVideoNote}- onSelectNote={model.setActiveNoteKey}- onRefreshSource={- model.refreshEvidenceUrl- ? () => model.refreshEvidenceUrl!(activeEvidence.id)- : undefined- }- />+ {activeEvidence && evidence.length > 1 && (+ <div {...stylex.props(styles.strip)}>+ {evidence.map((item, index) => (+ <button+ aria-pressed={item.id === activeEvidence.id}+ key={item.id}+ type={'button'}+ aria-label={t('acceptance.review.imageNumber', {+ current: index + 1,+ total: evidence.length,+ })}+ {...stylex.props(styles.thumb, item.id === activeEvidence.id && styles.thumbActive)}+ onClick={() => model.selectEvidence(index)}+ >+ {item.type === 'video' ? (+ <span {...stylex.props(styles.videoThumb)}>+ <Icon icon={Film} size={18} />+ </span>) : (- <EvidenceStage- drawing- annotations={activeAnnotations}- src={activeEvidence.fileUrl}- zoom={zoom}- onDraw={canvas.onDraw}- onRemove={canvas.onRemove}- onUpdate={canvas.onUpdate}- />+ <img alt={''} src={item.fileUrl} {...stylex.props(styles.thumbImage)} />)}- {!isVideo && (- <div {...stylex.props(styles.zoomBar)}>- <ActionIcon- disabled={zoom <= ZOOM_STEPS[0]}- icon={ZoomOut}- size={'small'}- title={t('acceptance.review.zoomOut')}- onClick={() => model.stepZoom(-1)}- />- <span {...stylex.props(styles.zoomLabel)}>{Math.round(zoom * 100)}%</span>- <ActionIcon- disabled={zoom >= ZOOM_STEPS.at(-1)!}- icon={ZoomIn}- size={'small'}- title={t('acceptance.review.zoomIn')}- onClick={() => model.stepZoom(1)}- />- </div>- )}- <div {...stylex.props(styles.notes)}>- <Flexbox gap={2}>- <Text strong fontSize={13}>- {t('acceptance.review.regionComments')}- </Text>- <Text fontSize={12} type={'secondary'}>- {isVideo- ? t('acceptance.video.annotateHint')- : t('acceptance.review.annotateHint')}- </Text>- </Flexbox>- {activeAnnotations.length === 0 && (- <Text fontSize={12} type={'secondary'}>- {isVideo- ? t('acceptance.video.notesEmpty')- : t('acceptance.review.regionCommentsEmpty')}- </Text>- )}- {isVideo ? (- <VideoNotes- activeNoteKey={model.activeNoteKey}- notes={activeAnnotations}- onChange={model.editAnnotation}- onFocusNote={(note) => videoStage.current?.focusNote(note)}- onRemove={model.removeAnnotation}- />- ) : (- <RegionNotes- annotations={activeAnnotations}- onChange={model.editAnnotation}- onRemove={model.removeAnnotation}- />- )}- </div>+ </button>+ ))}+ </div>+ )}+ {activeEvidence && (+ <div {...stylex.props(styles.stageRow)}>+ <div {...stylex.props(styles.stageCell, isVideo && styles.stageCellWide)}>+ {isVideo ? (+ <VideoReviewStage+ activeNoteKey={model.activeNoteKey}+ chapters={activeEvidence.chapters ?? []}+ key={activeEvidence.id}+ notes={activeAnnotations}+ src={activeEvidence.fileUrl}+ onAddNote={model.addVideoNote}+ onChangeNote={model.editAnnotation}+ onRemoveNote={model.removeAnnotation}+ onSelectNote={model.setActiveNoteKey}+ onRefreshSource={+ model.refreshEvidenceUrl+ ? () => model.refreshEvidenceUrl!(activeEvidence.id)+ : undefined+ }+ />+ ) : (+ <EvidenceStage+ contain+ drawing+ annotations={activeAnnotations}+ src={activeEvidence.fileUrl}+ zoom={zoom}+ controls={+ <div {...stylex.props(styles.zoomBar)}>+ <ActionIcon+ disabled={zoom <= ZOOM_STEPS[0]}+ icon={ZoomOut}+ size={'small'}+ title={t('acceptance.review.zoomOut')}+ onClick={() => model.stepZoom(-1)}+ />+ <span {...stylex.props(styles.zoomLabel)}>{Math.round(zoom * 100)}%</span>+ <ActionIcon+ disabled={zoom >= ZOOM_STEPS.at(-1)!}+ icon={ZoomIn}+ size={'small'}+ title={t('acceptance.review.zoomIn')}+ onClick={() => model.stepZoom(1)}+ />+ </div>+ }+ onDraw={canvas.onDraw}+ onRemove={canvas.onRemove}+ onUpdate={canvas.onUpdate}+ />+ )}+ </div>+ {!isVideo && (+ <div {...stylex.props(styles.notes)}>+ <Flexbox>+ <Text strong>{t('acceptance.review.regionComments')}</Text>+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.review.annotateHint')}+ </Text>+ </Flexbox>+ <RegionNotes+ annotations={activeAnnotations}+ onChange={model.editAnnotation}+ onRemove={model.removeAnnotation}+ /></div>- </Flexbox>- </Flexbox>+ )}+ </div>)}<div {...stylex.props(styles.footer)}>{failed && (@@ -259,43 +271,39 @@ export const DesktopEvidenceReview = memo<DesktopEvidenceReviewProps>(({ model }{t('acceptance.review.submitFailed')}</Text>)}- <Flexbox gap={10} style={{ width: '100%' }}>- <Text fontSize={12} type={'secondary'}>- {/* The modal title already names the check; repeating it here reads as an echo. */}- {hasEvidence- ? t('acceptance.review.supplement')- : t('acceptance.review.rejectFeedbackHint')}- </Text>- <TextArea- autoSize={{ maxRows: 5, minRows: 2 }}- placeholder={t('acceptance.review.rejectPlaceholder')}- value={comment}- onChange={(event) => model.setComment(event.target.value)}- onPaste={handlePaste}- />- <Flexbox horizontal align={'flex-start'} gap={8}>- <Flexbox horizontal flex={1} gap={8}>- <AttachmentUploadButton disabled={loading} onFiles={model.uploadFiles} />- <AttachmentStrip- attachments={attachments}- disabled={loading}- uploading={uploading}- onRemove={model.removeAttachment}- />- </Flexbox>- <Button disabled={loading} onClick={close}>- {t('acceptance.actions.cancel')}- </Button>- <Button- disabled={!canSubmit}- loading={loading}- type={'primary'}- onClick={model.submitReject}- >- {t('acceptance.review.confirmReject')}- </Button>- </Flexbox>- </Flexbox>+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.review.rejectFeedbackHint')}+ </Text>+ <TextArea+ autoSize={{ maxRows: 5, minRows: 2 }}+ placeholder={t('acceptance.review.rejectPlaceholder')}+ value={comment}+ variant={'filled'}+ onChange={(event) => model.setComment(event.target.value)}+ onPaste={handlePaste}+ />+ <div {...stylex.props(styles.actions)}>+ <div {...stylex.props(styles.attachments)}>+ <AttachmentUploadButton disabled={loading} onFiles={model.uploadFiles} />+ <AttachmentStrip+ attachments={attachments}+ disabled={loading}+ uploading={uploading}+ onRemove={model.removeAttachment}+ />+ </div>+ <Button disabled={loading} type={'text'} onClick={close}>+ {t('acceptance.actions.cancel')}+ </Button>+ <Button+ disabled={!canSubmit}+ loading={loading}+ type={'primary'}+ onClick={model.submitReject}+ >+ {t('acceptance.review.confirmReject')}+ </Button>+ </div></div></div>);diff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceGallery.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceGallery.tsxnew file mode 100644index 00000000000..4475c6fac3e--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceGallery.tsx@@ -0,0 +1,209 @@+'use client';++import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { memo, type ReactNode, useState } from 'react';+import { useTranslation } from 'react-i18next';+import { useLocation } from 'react-router';++import { meaningfulEvidenceCaption } from '../../Report/EvidenceComparisonCard';+import { useOptionalAcceptanceScope } from '../AcceptanceScope';+import type { AcceptanceEvidence } from '../Checks/types';+import { commentIdFromHash } from '../Comments/anchor';+import { EvidenceImageStage, type EvidenceStageSize } from './EvidenceImageStage';+import type { EvidenceOverlayMap } from './overlay';++const styles = stylex.create({+ root: {+ display: 'flex',+ flexDirection: 'column',+ gap: '8px',+ minWidth: 0,+ },+ rootFill: {+ flex: '1',+ minHeight: 0,+ },+ strip: {+ display: 'flex',+ flex: 'none',+ gap: '8px',+ alignItems: 'center',+ minWidth: 0,+ },+ thumbs: {+ overflowX: 'auto',+ display: 'flex',+ flexGrow: '0',+ flexShrink: '1',+ flexBasis: 'auto',+ gap: '8px',+ minWidth: 0,+ padding: '3px',+ margin: '-3px',+ },+ thumb: {+ cursor: 'pointer',+ position: 'relative',+ overflow: 'hidden',+ flex: 'none',+ width: '72px',+ aspectRatio: '16 / 10',+ padding: 0,+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: cssVar.colorBorder,+ borderRadius: cssVar.borderRadiusSM,+ backgroundColor: cssVar.colorFillTertiary,+ backgroundImage: 'none',+ outlineWidth: { 'default': null, ':focus-visible': '2px' },+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimaryBorder },+ outlineOffset: { 'default': null, ':focus-visible': '1px' },+ },+ thumbActive: {+ outlineWidth: { 'default': '2px', ':focus-visible': '2px' },+ outlineStyle: { 'default': 'solid', ':focus-visible': 'solid' },+ outlineColor: { 'default': cssVar.colorPrimary, ':focus-visible': cssVar.colorPrimary },+ outlineOffset: { 'default': '1px', ':focus-visible': '1px' },+ },+ thumbImage: {+ display: 'block',+ width: '100%',+ height: '100%',+ objectFit: 'cover',+ objectPosition: 'top',+ },+ thumbCount: {+ position: 'absolute',+ insetBlockStart: '2px',+ insetInlineEnd: '2px',+ minWidth: '16px',+ height: '16px',+ paddingInline: '4px',+ borderRadius: '8px',+ fontSize: '12px',+ fontWeight: 600,+ lineHeight: '16px',+ color: cssVar.colorBgContainer,+ backgroundColor: cssVar.colorText,+ },+ caption: {+ overflow: 'hidden',+ flex: '1',+ minWidth: 0,+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,+ textAlign: 'end',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ },+ captionAlone: {+ flex: 'none',+ textAlign: 'center',+ whiteSpace: 'normal',+ },+});++interface EvidenceGalleryProps {+ action?: (item: AcceptanceEvidence) => ReactNode;+ items: AcceptanceEvidence[];+ overlays?: EvidenceOverlayMap;+ size?: EvidenceStageSize;+}++const altOf = (item: AcceptanceEvidence) => item.description ?? item.fileName ?? item.type;++export const EvidenceGallery = memo<EvidenceGalleryProps>(({ action, items, overlays, size }) => {+ const { t } = useTranslation('verify');+ const { hash } = useLocation();+ const scope = useOptionalAcceptanceScope();+ const addressed = scope?.embedded ? undefined : commentIdFromHash(hash);+ const addressedId = addressed+ ? items.find((item) =>+ overlays+ ?.get(item.id)+ ?.some((note) => note.threadId === addressed || note.commentIds?.includes(addressed)),+ )?.id+ : undefined;+ const [activeId, setActiveId] = useState(items[0]?.id);+ const [handled, setHandled] = useState<string>();++ if (addressedId && addressed !== handled) {+ setHandled(addressed);+ setActiveId(addressedId);+ }++ const activeIndex = Math.max(+ items.findIndex((item) => item.id === activeId),+ 0,+ );+ const active = items[activeIndex];+ if (!active?.fileUrl) return null;++ const description = meaningfulEvidenceCaption(active.description);+ const several = items.length > 1;+ const position = t('acceptance.stage.imagePosition', {+ current: activeIndex + 1,+ total: items.length,+ });++ return (+ <div {...stylex.props(styles.root, size === 'fill' && styles.rootFill)}>+ <EvidenceImageStage+ action={action?.(active)}+ alt={altOf(active)}+ annotations={overlays?.get(active.id)}+ fileHeight={active.fileHeight}+ fileWidth={active.fileWidth}+ key={active.id}+ size={size}+ src={active.fileUrl}+ />+ {several && (+ <div {...stylex.props(styles.strip)}>+ <div {...stylex.props(styles.thumbs)}>+ {items.map((item, index) => {+ const open =+ overlays?.get(item.id)?.filter((note) => note.comment && !note.resolved).length ??+ 0;+ return (+ <button+ aria-pressed={item.id === active.id}+ key={item.id}+ type={'button'}+ aria-label={t('acceptance.review.imageNumber', {+ current: index + 1,+ total: items.length,+ })}+ title={+ open > 0 ? t('acceptance.stage.openComments', { count: open }) : altOf(item)+ }+ {...stylex.props(styles.thumb, item.id === active.id && styles.thumbActive)}+ onClick={() => setActiveId(item.id)}+ >+ <img+ alt={''}+ loading={'lazy'}+ src={item.fileUrl!}+ {...stylex.props(styles.thumbImage)}+ />+ {open > 0 && <span {...stylex.props(styles.thumbCount)}>{open}</span>}+ </button>+ );+ })}+ </div>+ <span {...stylex.props(styles.caption)}>+ {description ? `${position} · ${description}` : position}+ </span>+ </div>+ )}+ {!several && description && (+ <span {...stylex.props(styles.caption, styles.captionAlone)}>{description}</span>+ )}+ </div>+ );+});++EvidenceGallery.displayName = 'AcceptanceEvidenceGallery';diff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceImageStage.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceImageStage.tsxnew file mode 100644index 00000000000..8bbec31e624--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceImageStage.tsx@@ -0,0 +1,265 @@+'use client';++import { Button, Icon, Image } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { Check, MoveHorizontal, MoveVertical } from 'lucide-react';+import { memo, type ReactNode, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { sx } from '@/styles/sx';++import { useOptionalAcceptanceScope } from '../AcceptanceScope';+import { commentAnchorId } from '../Comments/anchor';+import { floatingActionHostMarker } from '../markers.stylex';+import { AnnotationFace, OverlayNoteContent, OverlayRect } from './EvidenceOverlays';+import { type EvidenceOverlay, overlayColor } from './overlay';+import { resolveStageFit, stageContentBox, type StageSize } from './stageFit';+import { useImageThreads } from './useImageThreads';+import { useMeasuredWidth } from './useMeasuredWidth';++export type EvidenceStageSize = 'capped' | 'fill';++const STAGE_PADDING = { bottom: 16, left: 16, right: 16, top: 16 };++const styles = stylex.create({+ root: {+ position: 'relative',+ overflow: 'hidden',+ flex: 'none',+ width: '100%',+ height: 'min(480px, 70dvh)',+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: cssVar.colorBorderSecondary,+ borderRadius: '12px',+ backgroundColor: cssVar.colorFillQuaternary,+ backgroundImage: 'none',+ },+ rootFill: {+ flex: '1',+ height: 'auto',+ minHeight: '240px',+ },+ viewport: {+ position: 'absolute',+ insetBlock: 0,+ insetInline: 0,+ overflow: 'auto',+ display: 'flex',+ padding: '16px',+ },+ imageBox: {+ position: 'relative',+ flex: 'none',+ margin: 'auto',+ borderRadius: cssVar.borderRadius,+ boxShadow: `0 0 0 1px ${cssVar.colorBorder}`,+ },+ pendingBox: {+ display: 'flex',+ maxWidth: '100%',+ maxHeight: '100%',+ margin: 'auto',+ },+ clip: {+ overflow: 'hidden',+ width: '100%',+ height: '100%',+ borderRadius: cssVar.borderRadius,+ },+ fade: {+ pointerEvents: 'none',+ position: 'absolute',+ insetBlockEnd: 0,+ insetInline: 0,+ height: '56px',+ backgroundImage: `linear-gradient(to bottom, transparent, ${cssVar.colorBgContainer})`,+ },+ toggle: {+ position: 'absolute',+ zIndex: 3,+ insetBlockEnd: '12px',+ insetInlineEnd: '12px',+ },+ note: {+ position: 'absolute',+ zIndex: 5,+ insetBlockStart: '12px',+ insetInlineEnd: '12px',+ overflowY: 'auto',+ width: 'min(280px, calc(100% - 24px))',+ maxHeight: 'calc(100% - 24px)',+ padding: '12px',+ paddingInlineEnd: '32px',+ borderRadius: cssVar.borderRadiusLG,+ backgroundColor: cssVar.colorBgElevated,+ backgroundImage: 'none',+ boxShadow: cssVar.boxShadowSecondary,+ },+ pin: {+ cursor: 'pointer',+ position: 'absolute',+ zIndex: 4,+ insetInlineEnd: '-14px',+ display: 'inline-flex',+ alignItems: 'center',+ justifyContent: 'center',+ width: '24px',+ height: '24px',+ borderStyle: 'none',+ borderTopLeftRadius: '50%',+ borderTopRightRadius: '50%',+ borderBottomRightRadius: '50%',+ borderBottomLeftRadius: '2px',+ color: cssVar.colorTextLightSolid,+ boxShadow: cssVar.boxShadowTertiary,+ filter: { 'default': null, ':hover': 'brightness(1.12)' },+ },+});++interface EvidenceImageStageProps {+ action?: ReactNode;+ alt: string;+ annotations?: EvidenceOverlay[];+ fileHeight?: number | null;+ fileWidth?: number | null;+ size?: EvidenceStageSize;+ src: string;+}++export const EvidenceImageStage = memo<EvidenceImageStageProps>(+ ({ action, alt, annotations, fileHeight, fileWidth, size = 'capped', src }) => {+ const { t } = useTranslation('verify');+ const { height, ref, width } = useMeasuredWidth<HTMLDivElement>();+ const [loaded, setLoaded] = useState<StageSize>();+ const [fitHeight, setFitHeight] = useState(false);+ const scope = useOptionalAcceptanceScope();+ const { openedNote, toggleNote, close } = useImageThreads(annotations, scope?.embedded);++ const natural = fileWidth && fileHeight ? { height: fileHeight, width: fileWidth } : loaded;+ const fit = resolveStageFit({+ fitHeight,+ natural,+ stage: stageContentBox({ height, width }, STAGE_PADDING),+ });+ const numbered =+ (annotations?.length ?? 0) > 1 || annotations?.some((item) => item.label !== undefined);+ const opened = openedNote === undefined ? undefined : annotations?.[openedNote];++ return (+ <div+ {...stylex.props(+ styles.root,+ size === 'fill' && styles.rootFill,+ action ? floatingActionHostMarker : null,+ )}+ >+ <div ref={ref} {...stylex.props(styles.viewport)}>+ {fit ? (+ // Regions and pins hang off the image box, never the stage: the+ // side bands change with every layout, the picture's own box does not.+ <div {...sx(styles.imageBox, { height: fit.height, width: fit.width })}>+ <div {...stylex.props(styles.clip)}>+ <Image+ alt={alt}+ height={'100%'}+ loading={'lazy'}+ maxHeight={'none'}+ maxWidth={'none'}+ objectFit={'contain'}+ src={src}+ style={{ borderRadius: 0, height: '100%', width: '100%' }}+ variant={'borderless'}+ width={'100%'}+ styles={{+ image: { height: '100%', width: '100%' },+ wrapper: { height: '100%', width: '100%' },+ }}+ />+ </div>+ {annotations?.map((annotation, index) => (+ <OverlayRect+ annotation={annotation}+ index={index}+ key={index}+ numbered={Boolean(numbered)}+ opened={openedNote === index}+ rect={annotation.rect}+ onToggle={toggleNote}+ />+ ))}+ {openedNote === undefined &&+ annotations?.map((annotation, index) =>+ annotation.comment ? (+ <button+ key={index}+ title={annotation.authorName}+ type={'button'}+ {...sx(styles.pin, {+ background: overlayColor(annotation),+ insetBlockStart: `${Math.min(Math.max(annotation.rect.y, 0), 0.86) * 100}%`,+ })}+ onClick={() => toggleNote(index)}+ >+ {annotation.resolved ? (+ <Icon icon={Check} size={12} />+ ) : (+ <AnnotationFace+ name={annotation.authorName}+ src={annotation.authorAvatar}+ />+ )}+ </button>+ ) : null,+ )}+ </div>+ ) : (+ <div {...stylex.props(styles.pendingBox)}>+ <Image+ alt={alt}+ loading={'lazy'}+ objectFit={'contain'}+ src={src}+ style={{ borderRadius: 0, maxHeight: '100%', maxWidth: '100%' }}+ variant={'borderless'}+ onLoad={(event) =>+ setLoaded({+ height: event.currentTarget.naturalHeight,+ width: event.currentTarget.naturalWidth,+ })+ }+ />+ </div>+ )}+ </div>+ {fit?.mode === 'scroll' && <span {...stylex.props(styles.fade)} />}+ {opened && (+ <div+ id={opened.threadId ? commentAnchorId(opened.threadId) : undefined}+ {...stylex.props(styles.note)}+ >+ <OverlayNoteContent+ label={numbered ? (opened.label ?? openedNote! + 1) : undefined}+ opened={opened}+ onClose={close}+ />+ </div>+ )}+ {action}+ {fit?.tall && (+ <Button+ icon={<Icon icon={fitHeight ? MoveHorizontal : MoveVertical} />}+ size={'small'}+ {...stylex.props(styles.toggle)}+ onClick={() => setFitHeight((value) => !value)}+ >+ {t(fitHeight ? 'acceptance.stage.fitWidth' : 'acceptance.stage.fitHeight')}+ </Button>+ )}+ </div>+ );+ },+);++EvidenceImageStage.displayName = 'AcceptanceEvidenceImageStage';diff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsxindex d951be0733e..fa9d66cabb1 100644--- a/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx@@ -27,9 +27,12 @@ import { AnnotatedImage } from '../Evidence/Annotation';import { ScreenshotTiles } from '../Evidence/ScreenshotTiles';import { floatingActionHostMarker } from '../markers.stylex';import { IMAGE_EVIDENCE, imageRatio, isAnnotatable, isVisual } from './evidence';+import { EvidenceGallery } from './EvidenceGallery';+import type { EvidenceStageSize } from './EvidenceImageStage';import FloatingCommentAction from './FloatingCommentAction';import type { EvidenceOverlayMap } from './overlay';import { styles } from './styles';+import { TapToReviewImage } from './TapToReviewImage';import { VideoEvidenceDiscussion } from './Video/VideoEvidenceDiscussion';/** Flat media for a comparison side — the card frames it, so no own border/radius. */@@ -94,279 +97,284 @@ export const EvidenceList = memo<{onRefreshEvidenceUrl?: (evidenceId: string) => Promise<string | undefined>;/** The standing reject's notes — video ones are pinned to the player's timeline. */reviewNotes?: AcceptanceReviewAnnotation[];-}>(({ evidence, overlays, onComment, onRefreshEvidenceUrl, onReviewEvidence, reviewNotes }) => {- const { md = true } = useResponsive();- const commentAction = (item: AcceptanceEvidence) =>- onComment && isAnnotatable(item) ? (- <FloatingCommentAction title={onComment.label} onClick={() => onComment.open(item.id)} />- ) : undefined;- const sorted = [...evidence].sort((a, b) => (isVisual(b) ? 1 : 0) - (isVisual(a) ? 1 : 0));- if (sorted.length === 0) return null;+ // 'fill' needs a host that lays this list out in a height-bounded flex column.+ stageSize?: EvidenceStageSize;+}>(+ ({+ evidence,+ overlays,+ onComment,+ onRefreshEvidenceUrl,+ onReviewEvidence,+ reviewNotes,+ stageSize,+ }) => {+ const { md = true } = useResponsive();+ const commentAction = (item: AcceptanceEvidence, inside?: boolean) =>+ onComment && isAnnotatable(item) ? (+ <FloatingCommentAction+ inside={inside}+ title={onComment.label}+ onClick={() => onComment.open(item.id)}+ />+ ) : undefined;+ const sorted = [...evidence].sort((a, b) => (isVisual(b) ? 1 : 0) - (isVisual(a) ? 1 : 0));+ if (sorted.length === 0) return null;- // Before/after pairs render as one fused comparison card (same component as- // the verify report). Only complete pairs fuse; a lone half stays a plain- // artifact, matching the ingest CLI's warning semantics.- const groups = new Map<string, Partial<Record<'after' | 'before', AcceptanceEvidence>>>();- for (const item of sorted) {- // Two runs of one command pair like two captures of one view.- if (!isVisual(item) && item.type !== 'terminal') continue;- const comparison = readEvidenceComparison(item.metadata);- if (!comparison) continue;- const group = groups.get(comparison.id) ?? {};- group[comparison.role] = item;- groups.set(comparison.id, group);- }- const pairedIds = new Set(- [...groups.values()]- .filter((group) => group.before && group.after)- .flatMap((group) => [group.before!.id, group.after!.id]),- );+ // Before/after pairs render as one fused comparison card (same component as+ // the verify report). Only complete pairs fuse; a lone half stays a plain+ // artifact, matching the ingest CLI's warning semantics.+ const groups = new Map<string, Partial<Record<'after' | 'before', AcceptanceEvidence>>>();+ for (const item of sorted) {+ // Two runs of one command pair like two captures of one view.+ if (!isVisual(item) && item.type !== 'terminal') continue;+ const comparison = readEvidenceComparison(item.metadata);+ if (!comparison) continue;+ const group = groups.get(comparison.id) ?? {};+ group[comparison.role] = item;+ groups.set(comparison.id, group);+ }+ const pairedIds = new Set(+ [...groups.values()].flatMap((group) =>+ group.before && group.after ? [group.before.id, group.after.id] : [],+ ),+ );- const videoContent = (item: AcceptanceEvidence, caption?: ReactNode) => (- <VideoEvidenceDiscussion- caption={caption}- chapters={readEvidenceChapters(item.metadata)}- evidenceId={item.id}- notes={reviewNotes?.filter((note) => note.evidenceId === item.id)}- overlays={overlays?.get(item.id)}- src={item.fileUrl!}- onComment={onComment ? (time) => onComment.open(item.id, time) : undefined}- onRefreshSource={onRefreshEvidenceUrl ? () => onRefreshEvidenceUrl(item.id) : undefined}- />- );+ const videoContent = (item: AcceptanceEvidence, caption?: ReactNode) => (+ <VideoEvidenceDiscussion+ caption={caption}+ chapters={readEvidenceChapters(item.metadata)}+ evidenceId={item.id}+ notes={reviewNotes?.filter((note) => note.evidenceId === item.id)}+ overlays={overlays?.get(item.id)}+ src={item.fileUrl!}+ onComment={onComment ? (time) => onComment.open(item.id, time) : undefined}+ onRefreshSource={onRefreshEvidenceUrl ? () => onRefreshEvidenceUrl(item.id) : undefined}+ />+ );- const comparisonSide = (item: AcceptanceEvidence) => ({- caption:- readEvidenceComparison(item.metadata)?.label ??- meaningfulEvidenceCaption(item.description) ??- undefined,- content: comparisonContent(- item,- commentAction(item),- item.type === 'video' ? videoContent(item) : undefined,- ),- });+ const comparisonSide = (item: AcceptanceEvidence) => ({+ caption:+ readEvidenceComparison(item.metadata)?.label ??+ meaningfulEvidenceCaption(item.description) ??+ undefined,+ content: comparisonContent(+ item,+ commentAction(item),+ item.type === 'video' ? videoContent(item) : undefined,+ ),+ });- const consumedScreenshotIds = new Set<string>();+ const consumedScreenshotIds = new Set<string>();+ const galleryItems = md+ ? sorted.filter(+ (item) => item.fileUrl && IMAGE_EVIDENCE.has(item.type) && !pairedIds.has(item.id),+ )+ : [];- return (- <Flexbox gap={12}>- {sorted.map((item) => {- if (consumedScreenshotIds.has(item.id)) return null;- if (pairedIds.has(item.id) && (md || !onReviewEvidence)) {- const comparison = readEvidenceComparison(item.metadata)!;- // The pair renders once, anchored at its `before` half.- if (comparison.role !== 'before') return null;- const group = groups.get(comparison.id)!;- return (- <EvidenceComparisonCard- after={comparisonSide(group.after!)}- before={comparisonSide(group.before!)}- key={comparison.id}- layout={comparison.layout}- />- );- }+ return (+ <Flexbox gap={12} {...stylex.props(stageSize === 'fill' && styles.listFill)}>+ {sorted.map((item) => {+ if (consumedScreenshotIds.has(item.id)) return null;+ if (pairedIds.has(item.id) && (md || !onReviewEvidence)) {+ const comparison = readEvidenceComparison(item.metadata)!;+ // The pair renders once, anchored at its `before` half.+ if (comparison.role !== 'before') return null;+ const group = groups.get(comparison.id)!;+ return (+ <EvidenceComparisonCard+ after={comparisonSide(group.after!)}+ before={comparisonSide(group.before!)}+ key={comparison.id}+ layout={comparison.layout}+ />+ );+ }- const description = meaningfulEvidenceCaption(item.description);- const caption = description && <span {...stylex.props(styles.caption)}>{description}</span>;- if (item.fileUrl && item.type === 'video')- return <div key={item.id}>{videoContent(item, caption)}</div>;- if (item.fileUrl && item.type === 'audio')- return (- <Flexbox gap={4} key={item.id} width={'100%'}>- {/* The conversation's own waveform player — one audio dialect across- the product, with the download the reviewer needs to keep the clip. */}- <AudioPlayer- fullWidth- alt={item.description ?? item.fileName ?? item.type}- downloadFileName={item.fileName ?? 'audio'}- url={item.fileUrl}+ if (galleryItems.includes(item)) {+ if (item !== galleryItems[0]) return null;+ return (+ <EvidenceGallery+ action={(shot) => commentAction(shot, true)}+ items={galleryItems}+ key={item.id}+ overlays={overlays}+ size={stageSize}/>- {caption}- </Flexbox>+ );+ }++ const description = meaningfulEvidenceCaption(item.description);+ const caption = description && (+ <span {...stylex.props(styles.caption)}>{description}</span>);- const overlay = overlays?.get(item.id);- // Posted screenshot threads must remain readable on touch screens too.- const hasImageThreads =- item.type === 'screenshot' && overlay?.some((note) => note.threadId);- if (- !md &&- onReviewEvidence &&- item.fileUrl &&- IMAGE_EVIDENCE.has(item.type) &&- !hasImageThreads- ) {- const action = commentAction(item);- // The tap reviews; the comment shortcut sits beside the button rather- // than inside it, since a button cannot hold another one.- return (- <div- key={item.id}- {...sx(action && floatingActionHostMarker, {- position: 'relative',- width: '100%',- })}- >- <button- type={'button'}- style={{- padding: 0,- width: '100%',- border: 0,- background: 'none',- textAlign: 'start',- cursor: 'pointer',- }}- onClick={() => onReviewEvidence(item.id)}- >- <img+ if (item.fileUrl && item.type === 'video')+ return <div key={item.id}>{videoContent(item, caption)}</div>;+ if (item.fileUrl && item.type === 'audio')+ return (+ <Flexbox gap={4} key={item.id} width={'100%'}>+ {/* The conversation's own waveform player — one audio dialect across+ the product, with the download the reviewer needs to keep the clip. */}+ <AudioPlayer+ fullWidthalt={item.description ?? item.fileName ?? item.type}- loading={'lazy'}- src={item.fileUrl}- style={{- display: 'block',- maxWidth: '100%',- width: '100%',- height: 180,- objectFit: 'cover',- objectPosition: 'top',- borderRadius: 8,- }}+ downloadFileName={item.fileName ?? 'audio'}+ url={item.fileUrl}/>{caption}- </button>- {action}- </div>- );- }- if (item.fileUrl && item.type === 'screenshot') {- const run = [item];- const start = sorted.indexOf(item);- for (let index = start + 1; index < sorted.length; index++) {- const next = sorted[index]!;- if (pairedIds.has(next.id) || !next.fileUrl || next.type !== 'screenshot') break;- if (!md && onReviewEvidence && !overlays?.get(next.id)?.some((note) => note.threadId))- break;- run.push(next);- consumedScreenshotIds.add(next.id);+ </Flexbox>+ );+ const overlay = overlays?.get(item.id);+ // Posted screenshot threads must remain readable on touch screens too.+ const hasImageThreads =+ item.type === 'screenshot' && overlay?.some((note) => note.threadId);+ if (+ !md &&+ onReviewEvidence &&+ item.fileUrl &&+ IMAGE_EVIDENCE.has(item.type) &&+ !hasImageThreads+ ) {+ return (+ <TapToReviewImage+ action={commentAction(item)}+ alt={item.description ?? item.fileName ?? item.type}+ caption={caption}+ key={item.id}+ src={item.fileUrl}+ onReview={() => onReviewEvidence(item.id)}+ />+ );}- return (- <Flexbox- horizontal- align={'flex-start'}- gap={12}- key={item.id}- style={{ maxWidth: '100%' }}- wrap={'wrap'}- >- {run.map((shot) => {- const shotCaption = meaningfulEvidenceCaption(shot.description);- return (- <ScreenshotTiles- action={commentAction(shot)}- alt={shot.description ?? shot.fileName ?? shot.type}- annotations={overlays?.get(shot.id)}- fileHeight={shot.fileHeight}- fileWidth={shot.fileWidth}- key={shot.id}- src={shot.fileUrl!}- caption={- shotCaption ? (- <span {...stylex.props(styles.caption)}>{shotCaption}</span>- ) : undefined- }- />- );- })}- </Flexbox>- );- }- if (item.fileUrl && IMAGE_EVIDENCE.has(item.type)) {- const action = commentAction(item);- return (- <Flexbox- gap={4}- key={item.id}- {...sx(action && floatingActionHostMarker, {- maxWidth: '100%',- position: 'relative',- width: 'fit-content',- })}- >- {action}- {overlay?.length ? (- <AnnotatedImage- annotations={overlay}- showComments={false}- src={item.fileUrl}- imageStyle={- item.fileWidth && item.fileHeight- ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }- : undefined- }- />- ) : (- <Flexbox- {...sx(- styles.evidenceImage,- item.fileWidth && item.fileHeight- ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }- : undefined,- )}- >- <Image- alt={item.description ?? item.fileName ?? item.type}- loading={'lazy'}+ if (item.fileUrl && item.type === 'screenshot') {+ const run = [item];+ const start = sorted.indexOf(item);+ for (let index = start + 1; index < sorted.length; index++) {+ const next = sorted[index]!;+ if (pairedIds.has(next.id) || !next.fileUrl || next.type !== 'screenshot') break;+ if (!md && onReviewEvidence && !overlays?.get(next.id)?.some((note) => note.threadId))+ break;+ run.push(next);+ consumedScreenshotIds.add(next.id);+ }+ return (+ <Flexbox+ horizontal+ align={'flex-start'}+ gap={12}+ key={item.id}+ style={{ maxWidth: '100%' }}+ wrap={'wrap'}+ >+ {run.map((shot) => {+ const shotCaption = meaningfulEvidenceCaption(shot.description);+ return (+ <ScreenshotTiles+ action={commentAction(shot)}+ alt={shot.description ?? shot.fileName ?? shot.type}+ annotations={overlays?.get(shot.id)}+ fileHeight={shot.fileHeight}+ fileWidth={shot.fileWidth}+ key={shot.id}+ src={shot.fileUrl!}+ caption={+ shotCaption ? (+ <span {...stylex.props(styles.caption)}>{shotCaption}</span>+ ) : undefined+ }+ />+ );+ })}+ </Flexbox>+ );+ }+ if (item.fileUrl && IMAGE_EVIDENCE.has(item.type)) {+ const action = commentAction(item);+ return (+ <Flexbox+ gap={4}+ key={item.id}+ {...sx(action && floatingActionHostMarker, {+ maxWidth: '100%',+ position: 'relative',+ width: 'fit-content',+ })}+ >+ {action}+ {overlay?.length ? (+ <AnnotatedImage+ annotations={overlay}+ showComments={false}src={item.fileUrl}- variant={'borderless'}- style={{- borderRadius: 0,- maxWidth: '100%',- width: item.fileWidth && item.fileHeight ? '100%' : undefined,- }}+ imageStyle={+ item.fileWidth && item.fileHeight+ ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }+ : undefined+ }/>- </Flexbox>- )}- {caption}- </Flexbox>- );- }- // A command execution: the record first, then its output — whether the- // row carries its transcript inline or as a file.- if (item.type === 'terminal') return <TerminalEvidenceCard evidence={item} key={item.id} />;- if (item.content && markdownTextEvidenceTypes.has(item.type))- return (- // An authored alt/description becomes the fold row's title itself —- // the supplement below the row duplicated it one line later.- <CollapsibleMarkdownEvidence- fileName={item.fileName}- key={item.id}- markdown={rendersAsMarkdown(item)}- title={item.description?.trim() || item.fileName?.trim() || undefined}- >- {item.content}- </CollapsibleMarkdownEvidence>- );- if (item.content)- return (- <Flexbox gap={4} key={item.id}>- <div {...stylex.props(styles.evidenceText)}>{item.content}</div>- {caption}- </Flexbox>- );- if (item.fileUrl && markdownTextEvidenceTypes.has(item.type))- return (- <EvidenceFileCard- description={item.description}- fileName={item.fileName}- key={item.id}- markdown={rendersAsMarkdown(item)}- url={item.fileUrl}- />- );- return null;- })}- </Flexbox>- );-});+ ) : (+ <Flexbox+ {...sx(+ styles.evidenceImage,+ item.fileWidth && item.fileHeight+ ? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }+ : undefined,+ )}+ >+ <Image+ alt={item.description ?? item.fileName ?? item.type}+ loading={'lazy'}+ src={item.fileUrl}+ variant={'borderless'}+ style={{+ borderRadius: 0,+ maxWidth: '100%',+ width: item.fileWidth && item.fileHeight ? '100%' : undefined,+ }}+ />+ </Flexbox>+ )}+ {caption}+ </Flexbox>+ );+ }+ // A command execution: the record first, then its output — whether the+ // row carries its transcript inline or as a file.+ if (item.type === 'terminal')+ return <TerminalEvidenceCard evidence={item} key={item.id} />;+ if (item.content && markdownTextEvidenceTypes.has(item.type))+ return (+ // An authored alt/description becomes the fold row's title itself —+ // the supplement below the row duplicated it one line later.+ <CollapsibleMarkdownEvidence+ fileName={item.fileName}+ key={item.id}+ markdown={rendersAsMarkdown(item)}+ title={item.description?.trim() || item.fileName?.trim() || undefined}+ >+ {item.content}+ </CollapsibleMarkdownEvidence>+ );+ if (item.content)+ return (+ <Flexbox gap={4} key={item.id}>+ <div {...stylex.props(styles.evidenceText)}>{item.content}</div>+ {caption}+ </Flexbox>+ );+ if (item.fileUrl && markdownTextEvidenceTypes.has(item.type))+ return (+ <EvidenceFileCard+ description={item.description}+ fileName={item.fileName}+ key={item.id}+ markdown={rendersAsMarkdown(item)}+ url={item.fileUrl}+ />+ );+ return null;+ })}+ </Flexbox>+ );+ },+);diff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceOverlays.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceOverlays.tsxnew file mode 100644index 00000000000..f0ca4ff997a--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceOverlays.tsx@@ -0,0 +1,208 @@+'use client';++import { Flexbox, Icon, Text } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { Check, MessageSquare, X } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { sx } from '@/styles/sx';++import { type EvidenceOverlay, overlayColor } from './overlay';++const styles = stylex.create({+ badge: {+ position: 'absolute',+ insetBlockStart: '-10px',+ insetInlineStart: '-10px',+ display: 'inline-flex',+ alignItems: 'center',+ justifyContent: 'center',+ width: '20px',+ height: '20px',+ borderRadius: '50%',+ fontSize: '12px',+ fontWeight: 600,+ lineHeight: 1,+ color: cssVar.colorTextLightSolid,+ },+ marker: {+ pointerEvents: 'auto',+ cursor: 'pointer',+ position: 'absolute',+ insetBlockStart: '-10px',+ insetInlineEnd: '-10px',+ display: 'inline-flex',+ alignItems: 'center',+ justifyContent: 'center',+ width: '20px',+ height: '20px',+ borderStyle: 'none',+ borderRadius: '50%',+ fontSize: '12px',+ fontWeight: 600,+ lineHeight: 1,+ color: cssVar.colorTextLightSolid,+ boxShadow: cssVar.boxShadowTertiary,+ filter: { 'default': null, ':hover': 'brightness(1.12)' },+ },+ markerActive: {+ outlineWidth: '2px',+ outlineStyle: 'solid',+ outlineColor: cssVar.colorTextLightSolid,+ },+ noteClose: {+ cursor: 'pointer',+ position: 'absolute',+ insetBlockStart: '8px',+ insetInlineEnd: '8px',+ display: 'inline-flex',+ alignItems: 'center',+ justifyContent: 'center',+ width: '20px',+ height: '20px',+ padding: '0',+ borderStyle: 'none',+ borderRadius: cssVar.borderRadius,+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },+ backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },+ backgroundImage: { 'default': 'none', ':hover': 'none' },+ transition: `all ${cssVar.motionDurationFast}`,+ },+ noteFallbackHead: { paddingBlockEnd: '4px' },+ noteBody: { fontSize: '14px', lineHeight: 1.6, overflowWrap: 'anywhere', whiteSpace: 'pre-wrap' },+ pinFace: { borderRadius: '50%', objectFit: 'cover' },+ pinInitial: { fontSize: '12px', fontWeight: 600, lineHeight: 1 },+ rect: {+ pointerEvents: 'none',+ position: 'absolute',+ borderWidth: '2px',+ borderStyle: 'solid',+ borderColor: cssVar.colorError,+ borderRadius: cssVar.borderRadiusXS,+ boxShadow: '0 0 0 1px rgb(0 0 0 / 45%),\n inset 0 0 0 1px rgb(255 255 255 / 45%)',+ },+ swatch: { flex: 'none', width: '8px', height: '8px', borderRadius: '50%' },+});++/**+ * The author inside a pin. An avatar when we have one, their initial when we+ * do not, and the speech bubble only when the author is unknown — a pin with+ * no face is indistinguishable from the next pin along.+ */+export const AnnotationFace = memo<{ name?: string; size?: number; src?: string | null }>(+ ({ name, size = 18, src }) => {+ if (src)+ return (+ <img alt={name ?? ''} src={src} {...sx(styles.pinFace, { height: size, width: size })} />+ );+ const initial = name?.trim().slice(0, 1);+ if (initial) return <span {...stylex.props(styles.pinInitial)}>{initial.toUpperCase()}</span>;+ return <Icon icon={MessageSquare} size={12} />;+ },+);++AnnotationFace.displayName = 'AcceptanceAnnotationFace';++interface OverlayRectProps {+ annotation: EvidenceOverlay;+ /** Index within the whole image, so the marker and the note agree. */+ index: number;+ numbered: boolean;+ onToggle: (index: number) => void;+ opened: boolean;+ /** Region geometry for THIS tile — a sliced screenshot clips it per tile. */+ rect: EvidenceOverlay['rect'];+}++export const OverlayRect = memo<OverlayRectProps>(+ ({ annotation, index, numbered, onToggle, opened, rect }) => {+ // A settled region keeps its place but drops its author's colour: an+ // answered note should not compete with an open one for attention.+ const color = overlayColor(annotation);+ const label = annotation.label ?? index + 1;+ return (+ <div+ {...sx(styles.rect, {+ borderColor: color,+ height: `${rect.height * 100}%`,+ left: `${rect.x * 100}%`,+ top: `${rect.y * 100}%`,+ width: `${rect.width * 100}%`,+ })}+ >+ {numbered && <span {...sx(styles.badge, { background: color })}>{label}</span>}+ {annotation.comment && (+ <button+ title={annotation.authorName}+ type={'button'}+ {...sx(styles.marker, opened && styles.markerActive, { background: color })}+ onClick={() => onToggle(index)}+ >+ {annotation.resolved ? (+ <Icon icon={Check} size={12} />+ ) : (+ <AnnotationFace+ name={annotation.authorName}+ size={16}+ src={annotation.authorAvatar}+ />+ )}+ </button>+ )}+ </div>+ );+ },+);++OverlayRect.displayName = 'AcceptanceOverlayRect';++interface OverlayNoteContentProps {+ /** The badge number when regions are numbered. */+ label?: number;+ onClose: () => void;+ opened: EvidenceOverlay;+}++export const OverlayNoteContent = memo<OverlayNoteContentProps>(({ label, onClose, opened }) => {+ const { t } = useTranslation('verify');++ return (+ <>+ {/*+ * Opening a note hides every pin, including the one that opened it, so+ * without this the only way back is the small marker on the box itself+ * — findable if you know it is there, and nowhere near where the reader+ * is looking.+ */}+ <button+ {...stylex.props(styles.noteClose)}+ title={t('acceptance.comments.collapseThread')}+ type={'button'}+ onClick={onClose}+ >+ <Icon icon={X} size={12} />+ </button>+ {opened.panel ?? (+ <Flexbox gap={4}>+ <Flexbox+ horizontal+ align={'center'}+ className={stylex.props(styles.noteFallbackHead).className}+ gap={6}+ >+ <span {...sx(styles.swatch, { background: opened.color ?? cssVar.colorError })} />+ <Text fontSize={12} type={'secondary'}>+ {label === undefined ? '' : `${label} · `}+ {opened.authorName}+ </Text>+ </Flexbox>+ <div {...stylex.props(styles.noteBody)}>{opened.comment}</div>+ </Flexbox>+ )}+ </>+ );+});++OverlayNoteContent.displayName = 'AcceptanceOverlayNoteContent';diff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsxindex c7ee55f37d2..91963e96f8f 100644--- a/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx@@ -1,25 +1,43 @@'use client';import type { AcceptanceReviewAnnotation } from '@lobechat/types';+import { Button, Icon } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import { memo, useEffect, useRef } from 'react';+import { MoveHorizontal, MoveVertical } from 'lucide-react';+import { memo, type ReactNode, useEffect, useRef, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { sx } from '@/styles/sx';import type { DraftAnnotation } from './Annotation';import { AnnotationCanvas } from './Annotation';+import { resolveStageFit, stageContentBox, type StageSize } from './stageFit';import { useMeasuredWidth } from './useMeasuredWidth';import { usePinchZoom } from './usePinchZoom';type Rect = AcceptanceReviewAnnotation['rect'];+// One pixel more than the CSS padding on every side: the canvas frame draws a+// border around the image, and the fit must leave room for it.+const CONTAINED_PADDING = { bottom: 17, left: 17, right: 17, top: 17 };+const CONTROLS_PADDING = { ...CONTAINED_PADDING, bottom: 69 };+const styles = stylex.create({+ root: {+ position: 'relative',+ display: 'flex',+ flex: '1',+ alignSelf: 'stretch',+ minWidth: '0',+ minHeight: '120px',+ },viewport: {overflow: 'auto',overscrollBehavior: 'contain',display: 'flex',flex: '1',minWidth: '0',- minHeight: '120px',borderWidth: '1px',borderStyle: 'solid',borderColor: cssVar.colorBorderSecondary,@@ -27,15 +45,41 @@ const styles = stylex.create({backgroundColor: cssVar.colorFillQuaternary,backgroundImage: 'none',},- viewportInner: { margin: 'auto' },+ contained: {+ padding: '16px',+ borderRadius: '12px',+ },+ containedControls: {+ paddingBlockEnd: '68px',+ },+ // A flex box, not a block: the inline-block canvas frame would otherwise sit+ // on a text baseline and add a few pixels under an image fitted to the height.+ viewportInner: { display: 'flex', flex: 'none', margin: 'auto' },+ toggle: {+ position: 'absolute',+ zIndex: 5,+ insetBlockEnd: '12px',+ insetInlineEnd: '12px',+ },});const SWIPE_MIN_PX = 60;/** A swipe has to be decisively horizontal, or vertical reading steals images. */const SWIPE_AXIS_RATIO = 1.5;+// With our own pinch the browser must not zoom the page on two fingers;+// without it, leave the native gesture alone.+const stageTouchAction = (ownPinch: boolean, canSwipe: boolean) => {+ if (ownPinch) return canSwipe ? 'pan-y' : 'pan-x pan-y';+ return canSwipe ? 'pan-y pinch-zoom' : undefined;+};+interface EvidenceStageProps {annotations: DraftAnnotation[];+ // Off, the image takes the stage width and the stage scrolls: the phone+ // review has no layout-given height to fit into and relies on that.+ contain?: boolean;+ controls?: ReactNode;/** Drags mark regions instead of panning. */drawing: boolean;onDraw: (rect: Rect) => void;@@ -60,66 +104,113 @@ interface EvidenceStageProps {* the moment the layout swaps (see useMeasuredWidth).*/export const EvidenceStage = memo<EvidenceStageProps>(- ({ annotations, drawing, onDraw, onRemove, onSwipe, onUpdate, onZoom, src, touch, zoom }) => {- const { node, ref, width } = useMeasuredWidth<HTMLDivElement>();+ ({+ annotations,+ contain,+ controls,+ drawing,+ onDraw,+ onRemove,+ onSwipe,+ onUpdate,+ onZoom,+ src,+ touch,+ zoom,+ }) => {+ const { t } = useTranslation('verify');+ const { height, node, ref, width } = useMeasuredWidth<HTMLDivElement>();const pinch = usePinchZoom({ node, onZoom: touch ? onZoom : undefined, zoom });const swipeStart = useRef<{ x: number; y: number } | null>(null);const canSwipe = Boolean(touch && onSwipe) && !drawing && zoom === 1;+ const [loaded, setLoaded] = useState<StageSize & { src: string }>();+ const [fitHeightSrc, setFitHeightSrc] = useState<string>();+ const fitHeight = fitHeightSrc === src;++ const fit = contain+ ? resolveStageFit({+ fitHeight,+ natural: loaded?.src === src ? loaded : undefined,+ stage: stageContentBox(+ { height, width },+ controls ? CONTROLS_PADDING : CONTAINED_PADDING,+ ),+ })+ : undefined;++ // The border eats two pixels the image must not claim back, or the+ // stage gains a scrollbar at exactly 100%.+ const fullWidth = width ? Math.max(width * zoom - 2, 0) : undefined;+ const imageWidth = contain ? (fit ? fit.width * zoom : undefined) : fullWidth;// A new image starts at the top-left; carrying the previous pan offset would// open the next screenshot scrolled to nowhere in particular.useEffect(() => {node?.scrollTo(0, 0);- }, [node, src]);+ }, [node, src, fitHeight]);return (- <div- className={stylex.props(styles.viewport).className}- ref={ref}- // With our own pinch the browser must not zoom the page on two- // fingers; without it, leave the native gesture alone.- style={{- touchAction: onZoom- ? canSwipe- ? 'pan-y'- : 'pan-x pan-y'- : canSwipe- ? 'pan-y pinch-zoom'- : undefined,- }}- onTouchCancel={pinch.handlers.onTouchCancel}- onTouchMove={pinch.handlers.onTouchMove}- onTouchEnd={(event) => {- pinch.handlers.onTouchEnd?.(event);- const start = swipeStart.current;- swipeStart.current = null;- const point = event.changedTouches[0];- if (!start || !point) return;- const dx = point.clientX - start.x;- const dy = point.clientY - start.y;- if (Math.abs(dx) > SWIPE_MIN_PX && Math.abs(dx) > Math.abs(dy) * SWIPE_AXIS_RATIO)- onSwipe?.(dx < 0 ? 1 : -1);- }}- onTouchStart={(event) => {- pinch.handlers.onTouchStart?.(event);- const point = event.touches[0];- swipeStart.current =- canSwipe && event.touches.length === 1 ? { x: point.clientX, y: point.clientY } : null;- }}- >- <div {...stylex.props(styles.viewportInner)}>- <AnnotationCanvas- annotations={annotations}- drawing={drawing}- // The border eats two pixels the image must not claim back, or the- // stage gains a scrollbar at exactly 100%.- imageWidth={width ? Math.max(width * zoom - 2, 0) : undefined}- src={src}- onDraw={onDraw}- onRemove={onRemove}- onUpdate={onUpdate}- />+ <div {...stylex.props(styles.root)}>+ <div+ ref={ref}+ {...sx(+ styles.viewport,+ contain && styles.contained,+ contain && Boolean(controls) && styles.containedControls,+ { touchAction: stageTouchAction(Boolean(onZoom), canSwipe) },+ )}+ onTouchCancel={pinch.handlers.onTouchCancel}+ onTouchMove={pinch.handlers.onTouchMove}+ onTouchEnd={(event) => {+ pinch.handlers.onTouchEnd?.(event);+ const start = swipeStart.current;+ swipeStart.current = null;+ const point = event.changedTouches[0];+ if (!start || !point) return;+ const dx = point.clientX - start.x;+ const dy = point.clientY - start.y;+ if (Math.abs(dx) > SWIPE_MIN_PX && Math.abs(dx) > Math.abs(dy) * SWIPE_AXIS_RATIO)+ onSwipe?.(dx < 0 ? 1 : -1);+ }}+ onTouchStart={(event) => {+ pinch.handlers.onTouchStart?.(event);+ const point = event.touches[0];+ swipeStart.current =+ canSwipe && event.touches.length === 1+ ? { x: point.clientX, y: point.clientY }+ : null;+ }}+ >+ <div {...stylex.props(styles.viewportInner)}>+ <AnnotationCanvas+ annotations={annotations}+ drawing={drawing}+ imageWidth={imageWidth}+ src={src}+ onDraw={onDraw}+ onRemove={onRemove}+ onUpdate={onUpdate}+ onLoad={(event) =>+ setLoaded({+ height: event.currentTarget.naturalHeight,+ src,+ width: event.currentTarget.naturalWidth,+ })+ }+ />+ </div></div>+ {controls}+ {fit?.tall && (+ <Button+ icon={<Icon icon={fitHeight ? MoveHorizontal : MoveVertical} />}+ size={'small'}+ {...stylex.props(styles.toggle)}+ onClick={() => setFitHeightSrc(fitHeight ? undefined : src)}+ >+ {t(fitHeight ? 'acceptance.stage.fitWidth' : 'acceptance.stage.fitHeight')}+ </Button>+ )}</div>);},diff --git a/src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsx b/src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsxindex f8007b48348..e27839d7268 100644--- a/src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsx+++ b/src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsx@@ -47,6 +47,11 @@ const styles = stylex.create({insetBlockEnd: { default: 0, [compact]: '8px' },insetInlineEnd: { default: '-40px', [compact]: '8px' },},+ railInside: {+ insetBlockStart: { default: '12px', [compact]: '8px' },+ insetBlockEnd: { default: '12px', [compact]: '8px' },+ insetInlineEnd: { default: '12px', [compact]: '8px' },+ },});/**@@ -57,9 +62,13 @@ const styles = stylex.create({** Render inside a positioned box carrying {@link floatingActionHostMarker}.*/-const FloatingCommentAction = memo<{ onClick: () => void; title: string }>(({ onClick, title }) => {+const FloatingCommentAction = memo<{+ inside?: boolean;+ onClick: () => void;+ title: string;+}>(({ inside, onClick, title }) => {return (- <div {...stylex.props(styles.rail)}>+ <div {...stylex.props(styles.rail, inside && styles.railInside)}><ActionIconaria-label={title}icon={MessageSquarePlus}diff --git a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.test.tsx b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.test.tsxindex 4f09eed2273..1d2d8e48a89 100644--- a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.test.tsx+++ b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.test.tsx@@ -82,46 +82,36 @@ const drawButton = () => screen.queryByRole('button', { name: 'acceptance.reviewconst doneButton = () => screen.queryByRole('button', { name: 'acceptance.review.confirmRegions' });const submitButton = () =>screen.queryByRole('button', { name: 'acceptance.review.confirmReject' });+const follows = (before: Element, after: Element) =>+ Boolean(before.compareDocumentPosition(after) & Node.DOCUMENT_POSITION_FOLLOWING);-describe('MobileEvidenceReview notes button', () => {- it('keeps the notes closed by default and opens them on tap', () => {+describe('MobileEvidenceReview notes', () => {+ it('keeps the notes field on the page, with no button to open it', () => {render(<MobileEvidenceReview model={buildModel()} />);- // Closed: the field is not on the page; the button says so itself.- expect(supplementButton()).toHaveAttribute('aria-expanded', 'false');- expect(supplementButton()).toHaveTextContent('acceptance.review.supplementButton');- expect(supplementField()).not.toBeInTheDocument();-- // Tapping the button opens the field in place.- fireEvent.click(supplementButton()!);- expect(supplementButton()).toHaveAttribute('aria-expanded', 'true');+ expect(supplementButton()).not.toBeInTheDocument();expect(supplementField()).toBeInTheDocument();+ expect(screen.getByText('acceptance.review.supplement')).toBeInTheDocument();+ expect(screen.getByText('acceptance.review.draftSaved')).toBeInTheDocument();expect(screen.getByText('upload-stub')).toBeInTheDocument();});- it('continues the reviewer action after opening: typing lands in the model', () => {+ it('sends what the reviewer types to the model', () => {const setComment = vi.fn();render(<MobileEvidenceReview model={buildModel({ setComment })} />);- fireEvent.click(supplementButton()!);fireEvent.change(supplementField()!, { target: { value: 'wrong color here' } });expect(setComment).toHaveBeenCalledWith('wrong color here');});- it('closes on a second tap, keeping the button honest about saved content', () => {+ it('shows a restored draft in the field', () => {render(<MobileEvidenceReview model={buildModel({ comment: 'already typed' })} />);- // A restored draft opens itself — never hide words the user wrote.- expect(supplementField()).toBeInTheDocument();-- fireEvent.click(supplementButton()!);- expect(supplementField()).not.toBeInTheDocument();- // The closed button names the draft instead of the plain label.- expect(supplementButton()).toHaveTextContent('acceptance.review.supplementButtonDraft');+ expect(supplementField()).toHaveValue('already typed');});- it('auto-opens when screenshots are already attached', () => {+ it('shows screenshots that are already attached', () => {render(<MobileEvidenceReviewmodel={buildModel({@@ -130,47 +120,102 @@ describe('MobileEvidenceReview notes button', () => {/>,);- expect(supplementField()).toBeInTheDocument();+ expect(screen.getByText('shot.png')).toBeInTheDocument();});- it('keeps marked regions visible without auto-opening the notes', () => {+ it('lists marked regions above the notes field', () => {render(<MobileEvidenceReviewmodel={buildModel({ annotations: [region], editableAnnotations: [region] })}/>,);- // Regions have their own always-visible section; the notes stay closed.- expect(screen.getByText('acceptance.review.regionComments')).toBeInTheDocument();- expect(supplementField()).not.toBeInTheDocument();- expect(supplementButton()).toHaveAttribute('aria-expanded', 'false');+ const regions = screen.getByText('acceptance.review.regionComments');+ expect(follows(regions, supplementField()!)).toBe(true);+ });++ it('has no region section until a region is marked', () => {+ render(<MobileEvidenceReview model={withImage()} />);++ expect(screen.queryByText('acceptance.review.regionComments')).toBeNull();+ expect(screen.queryByText('acceptance.review.mobileRegionCommentsEmpty')).toBeNull();});});describe('MobileEvidenceReview image switcher', () => {- it('keeps one full-width control under the image: arrows at the edges, zoom in the middle', () => {+ it('keeps one full-width control under the image: image steps first, zoom after them', () => {const stepZoom = vi.fn();render(<MobileEvidenceReview model={withImage({ stepZoom, zoom: 1.5 })} />);- // The control follows the stage instead of sitting above it.const stage = screen.getByText('stage-stub');+ const previous = screen.getByRole('button', { name: 'acceptance.review.previousImage' });const next = screen.getByRole('button', { name: 'acceptance.review.nextImage' });- expect(stage.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();- expect(- screen.getByRole('button', { name: 'acceptance.review.previousImage' }),- ).toBeInTheDocument();-- // The zoom sits between the arrows and reads the model's zoom, whether a- // pinch or a button set it; the buttons step from there.+ const zoomOut = screen.getByRole('button', { name: 'acceptance.review.zoomOut' });+ const zoomIn = screen.getByRole('button', { name: 'acceptance.review.zoomIn' });+ expect(follows(stage, previous)).toBe(true);+ expect(follows(previous, next)).toBe(true);+ expect(follows(next, zoomOut)).toBe(true);+ expect(follows(zoomOut, zoomIn)).toBe(true);++ // The zoom reads the model's zoom, whether a pinch or a button set it.expect(screen.getByText('150%')).toBeInTheDocument();- fireEvent.click(screen.getByRole('button', { name: 'acceptance.review.zoomIn' }));+ fireEvent.click(zoomIn);expect(stepZoom).toHaveBeenCalledWith(1);- fireEvent.click(screen.getByRole('button', { name: 'acceptance.review.zoomOut' }));+ fireEvent.click(zoomOut);expect(stepZoom).toHaveBeenCalledWith(-1);- // No explanatory copy and no image counter — the arrows say where you are.expect(screen.queryByText('acceptance.review.mobileBrowseHint')).toBeNull();- expect(screen.queryByText('acceptance.review.imageNumber')).toBeNull();+ });++ it('counts the image between the two arrows', () => {+ const second = { fileUrl: 'https://example.com/second.png', id: 'e2' };+ render(+ <MobileEvidenceReview+ model={withImage({+ activeEvidence: second,+ activeIndex: 1,+ evidence: [evidenceItem, second],+ })}+ />,+ );++ const counter = screen.getByText('2 / 2');+ expect(counter).toHaveAttribute('aria-label', 'acceptance.review.imageNumber');+ expect(+ follows(screen.getByRole('button', { name: 'acceptance.review.previousImage' }), counter),+ ).toBe(true);+ expect(+ follows(counter, screen.getByRole('button', { name: 'acceptance.review.nextImage' })),+ ).toBe(true);+ });++ it('steps between images and stops at both ends', () => {+ const selectEvidence = vi.fn();+ const second = { fileUrl: 'https://example.com/second.png', id: 'e2' };+ const { unmount } = render(+ <MobileEvidenceReview+ model={withImage({ evidence: [evidenceItem, second], selectEvidence })}+ />,+ );++ expect(screen.getByRole('button', { name: 'acceptance.review.previousImage' })).toBeDisabled();+ fireEvent.click(screen.getByRole('button', { name: 'acceptance.review.nextImage' }));+ expect(selectEvidence).toHaveBeenCalledWith(1);+ unmount();++ render(+ <MobileEvidenceReview+ model={withImage({+ activeEvidence: second,+ activeIndex: 1,+ evidence: [evidenceItem, second],+ selectEvidence,+ })}+ />,+ );+ expect(screen.getByRole('button', { name: 'acceptance.review.nextImage' })).toBeDisabled();+ fireEvent.click(screen.getByRole('button', { name: 'acceptance.review.previousImage' }));+ expect(selectEvidence).toHaveBeenCalledWith(0);});it('disables the zoom buttons at the ends of the range', () => {@@ -183,15 +228,23 @@ describe('MobileEvidenceReview image switcher', () => {expect(screen.getByRole('button', { name: 'acceptance.review.zoomIn' })).toBeDisabled();expect(screen.getByRole('button', { name: 'acceptance.review.zoomOut' })).toBeEnabled();});++ it('has no switcher when there is no image', () => {+ render(<MobileEvidenceReview model={buildModel()} />);++ expect(screen.queryByRole('button', { name: 'acceptance.review.nextImage' })).toBeNull();+ expect(screen.queryByRole('button', { name: 'acceptance.review.zoomIn' })).toBeNull();+ });});describe('MobileEvidenceReview marking mode', () => {- it('enters marking mode from the button beside the notes button', () => {+ it('enters marking mode from the button between the switcher and the notes', () => {const advance = vi.fn();render(<MobileEvidenceReview model={withImage({ advance })} />);- expect(drawButton()).toBeInTheDocument();- expect(supplementButton()).toBeInTheDocument();+ const zoomIn = screen.getByRole('button', { name: 'acceptance.review.zoomIn' });+ expect(follows(zoomIn, drawButton()!)).toBe(true);+ expect(follows(drawButton()!, supplementField()!)).toBe(true);fireEvent.click(drawButton()!);expect(advance).toHaveBeenCalledWith('toggle-draw');@@ -201,9 +254,8 @@ describe('MobileEvidenceReview marking mode', () => {const advance = vi.fn();render(<MobileEvidenceReview model={withImage({ advance, drawing: true })} />);- // The two-button row, the note and the submit all step aside.expect(drawButton()).not.toBeInTheDocument();- expect(supplementButton()).not.toBeInTheDocument();+ expect(supplementField()).not.toBeInTheDocument();expect(submitButton()).not.toBeInTheDocument();// What is left is about the regions: the list (empty so far) and the hint.@@ -238,7 +290,30 @@ describe('MobileEvidenceReview marking mode', () => {render(<MobileEvidenceReview model={buildModel()} />);expect(drawButton()).not.toBeInTheDocument();- expect(supplementButton()).toBeInTheDocument();+ expect(supplementField()).toBeInTheDocument();expect(submitButton()).toBeInTheDocument();});});++describe('MobileEvidenceReview submit', () => {+ it('submits from the bottom action once the review can be sent', () => {+ const submitReject = vi.fn();+ const { unmount } = render(<MobileEvidenceReview model={buildModel()} />);+ expect(submitButton()).toBeDisabled();+ unmount();++ render(<MobileEvidenceReview model={buildModel({ canSubmit: true, submitReject })} />);+ expect(follows(supplementField()!, submitButton()!)).toBe(true);+ fireEvent.click(submitButton()!);+ expect(submitReject).toHaveBeenCalled();+ });++ it('reports a failed submit above the button, but not while marking', () => {+ const { unmount } = render(<MobileEvidenceReview model={withImage({ failed: true })} />);+ expect(screen.getByRole('alert')).toHaveTextContent('acceptance.review.submitFailed');+ unmount();++ render(<MobileEvidenceReview model={withImage({ drawing: true, failed: true })} />);+ expect(screen.queryByRole('alert')).toBeNull();+ });+});diff --git a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsxindex 545ea121a1c..44b9aab4449 100644--- a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx+++ b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx@@ -3,8 +3,8 @@import { ActionIcon, Button, Text, TextArea } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import { ChevronLeft, ChevronRight, NotebookPen, PencilLine, ZoomIn, ZoomOut } from 'lucide-react';-import { memo, useState } from 'react';+import { ChevronLeft, ChevronRight, PencilLine, ZoomIn, ZoomOut } from 'lucide-react';+import { memo } from 'react';import { useTranslation } from 'react-i18next';import { ZOOM_STEPS } from '../Review/rejectDraft';@@ -13,6 +13,8 @@ import { AttachmentStrip, AttachmentUploadButton } from './attachments';import { EvidenceStage } from './EvidenceStage';import { MobileRegionNotes } from './RegionNotes';+const TOUCH_ICON = { blockSize: 44, size: 20 };+const styles = stylex.create({body: {display: 'flex',@@ -21,30 +23,28 @@ const styles = stylex.create({minWidth: 0,minHeight: 0,},- // The one scroll on the page — image on top, the notes it earns below it.+ // The modal shell already pads the content 12px inline; 4px more makes the+ // 16px column, and the footer's negative margin takes its rule edge to edge.scroll: {overflowY: 'auto',overscrollBehavior: 'contain',display: 'flex',flex: '1',flexDirection: 'column',- gap: '8px',+ gap: '12px',minHeight: 0,- paddingBlockEnd: '12px',+ paddingBlock: '16px',+ paddingInline: '4px',},- // The image is what the reviewer came to look at, so it takes every pixel- // the rows below it do not need. When the notes open underneath, it yields- // down to a floor that still leaves room to circle on, then the page scrolls.+ // A zero basis keeps the stage's height a matter of layout alone: the image+ // is fitted to the measured stage, so a content-sized stage would feed back.stage: {display: 'flex',flexGrow: '1',flexShrink: '1',- flexBasis: 'auto',- minHeight: '40dvh',+ flexBasis: '0px',+ minHeight: 'min(340px, 45dvh)',},- // One full-width control under the image: the image arrows at the two- // edges where a thumb lands, the zoom (minus, percentage, plus) between- // them. Two fingers set the zoom too; the buttons show where it landed.switcher: {display: 'flex',flex: 'none',@@ -56,63 +56,104 @@ const styles = stylex.create({borderColor: cssVar.colorBorderSecondary,borderRadius: cssVar.borderRadius,},- zoom: {- display: 'flex',+ counter: {+ flex: 'none',+ minWidth: '32px',+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ textAlign: 'center',+ whiteSpace: 'nowrap',+ },+ spacer: {flex: '1',- gap: '4px',- alignItems: 'center',- justifyContent: 'center',},- // Two equal thumb-sized buttons: what to do next with the image, and where- // the written note goes.- actions: {- display: 'flex',+ zoomValue: {flex: 'none',- gap: '8px',+ minWidth: '44px',+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',+ color: cssVar.colorText,+ textAlign: 'center',},- actionButton: {- flex: '1',+ drawButton: {+ flex: 'none',+ width: '100%',minHeight: '44px',},- editor: {+ section: {display: 'flex',flex: 'none',flexDirection: 'column',- gap: '16px',- paddingBlockStart: '4px',+ },+ sectionTitle: {+ fontSize: '14px',+ fontWeight: 600,+ lineHeight: '22px',+ color: cssVar.colorText,+ },+ regionList: {+ display: 'flex',+ flexDirection: 'column',+ gap: '12px',+ marginBlockStart: '8px',+ },+ regionEmpty: {+ marginBlockStart: '4px',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ label: {+ marginBlockEnd: '4px',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ caption: {+ marginBlockStart: '4px',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,+ },+ attachments: {+ display: 'flex',+ flexDirection: 'column',+ gap: '8px',},footer: {display: 'flex',flex: 'none',flexDirection: 'column',gap: '8px',- paddingBlockStart: '8px',+ marginInline: '-12px',+ paddingBlockStart: '12px',+ paddingBlockEnd: '4px',+ paddingInline: '16px',borderBlockStartWidth: '1px',borderBlockStartStyle: 'solid',borderBlockStartColor: cssVar.colorBorderSecondary,},footerButton: {+ width: '100%',minHeight: '44px',},+ alert: {+ fontSize: '12px',+ lineHeight: '20px',+ },});-/**- * Phone review on one page: look at the image, circle what is wrong, and write- * the note right where the circle landed.- *- * Marking is a mode of its own. While it is on, everything under the image is- * about the regions — the list of circled comments and a Done button — so the- * reviewer is never asked to type a general note or submit halfway through a- * drag. Leaving the mode brings back the two-button row and the submit.- */export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model }) => {const { t } = useTranslation('verify');const {activeAnnotations,activeEvidence,activeIndex,- // Only what this phone can edit — videos' notes are kept in the model and- // submitted untouched, but have no stage here to point back to.+ // Videos' notes stay in the model and are submitted untouched; the phone+ // has no stage to point them back to, so it lists only what it can edit.editableAnnotations: annotations,attachments,canSubmit,@@ -127,35 +168,28 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ modelzoom,} = model;- // The supplement stays closed until asked for — the reject's substance is the- // marked regions, and the phone should not scroll past an empty textarea to- // reach the submit button. It opens itself when there is already text or- // screenshots to show (a restored draft, a paste, prior feedback) — hidden- // content the user cannot see is feedback waiting to be lost. Marked regions- // stay out of this: they have their own region-comments section.- const [supplementExpanded, setSupplementExpanded] = useState(() =>- Boolean(comment.trim() || attachments.length > 0),- );- const hasSupplementContent = comment.trim().length > 0 || attachments.length > 0;- const hasRegionContent = annotations.length > 0;+ const hasRegions = annotations.length > 0;+ const toggleDraw = () => model.advance('toggle-draw');- const regionNotes = (- <>- <Text strong>{t('acceptance.review.regionComments')}</Text>- {hasRegionContent ? (- <MobileRegionNotes- annotations={annotations}- evidence={evidence}- onChange={model.editAnnotation}- onJump={model.jumpToRegion}- onRemove={model.removeAnnotation}- />+ const regionSection = (+ <div {...stylex.props(styles.section)}>+ <div {...stylex.props(styles.sectionTitle)}>{t('acceptance.review.regionComments')}</div>+ {hasRegions ? (+ <div {...stylex.props(styles.regionList)}>+ <MobileRegionNotes+ annotations={annotations}+ evidence={evidence}+ onChange={model.editAnnotation}+ onJump={model.jumpToRegion}+ onRemove={model.removeAnnotation}+ />+ </div>) : (- <Text fontSize={13} type={'secondary'}>+ <div {...stylex.props(styles.regionEmpty)}>{t('acceptance.review.mobileRegionCommentsEmpty')}- </Text>+ </div>)}- </>+ </div>);return (@@ -165,6 +199,7 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model<><div {...stylex.props(styles.stage)}><EvidenceStage+ containtouchannotations={activeAnnotations}drawing={drawing}@@ -177,130 +212,97 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ modelonZoom={model.setZoom}/></div>- {/* One full-width block under the stage: previous / next at the- edges, the zoom in the middle. No hint text — the phone shows,- it does not explain. The percentage is what a pinch landed on;- the buttons step from there to the next notch. */}<div {...stylex.props(styles.switcher)}><ActionIconaria-label={t('acceptance.review.previousImage')}disabled={activeIndex <= 0}icon={ChevronLeft}- size={{ blockSize: 44, size: 20 }}+ size={TOUCH_ICON}onClick={() => model.selectEvidence(activeIndex - 1)}/>- <div {...stylex.props(styles.zoom)}>- <ActionIcon- aria-label={t('acceptance.review.zoomOut')}- disabled={zoom <= ZOOM_STEPS[0]}- icon={ZoomOut}- size={{ blockSize: 44, size: 20 }}- onClick={() => model.stepZoom(-1)}- />- <Text- aria-live={'polite'}- fontSize={13}- style={{ minWidth: 44, textAlign: 'center' }}- >- {Math.round(zoom * 100)}%- </Text>- <ActionIcon- aria-label={t('acceptance.review.zoomIn')}- disabled={zoom >= ZOOM_STEPS.at(-1)!}- icon={ZoomIn}- size={{ blockSize: 44, size: 20 }}- onClick={() => model.stepZoom(1)}- />- </div>+ <span+ {...stylex.props(styles.counter)}+ aria-label={t('acceptance.review.imageNumber', {+ current: activeIndex + 1,+ total: evidence.length,+ })}+ >+ {activeIndex + 1} / {evidence.length}+ </span><ActionIconaria-label={t('acceptance.review.nextImage')}disabled={activeIndex >= evidence.length - 1}icon={ChevronRight}- size={{ blockSize: 44, size: 20 }}+ size={TOUCH_ICON}onClick={() => model.selectEvidence(activeIndex + 1)}/>+ <span {...stylex.props(styles.spacer)} />+ <ActionIcon+ aria-label={t('acceptance.review.zoomOut')}+ disabled={zoom <= ZOOM_STEPS[0]}+ icon={ZoomOut}+ size={TOUCH_ICON}+ onClick={() => model.stepZoom(-1)}+ />+ <span aria-live={'polite'} {...stylex.props(styles.zoomValue)}>+ {Math.round(zoom * 100)}%+ </span>+ <ActionIcon+ aria-label={t('acceptance.review.zoomIn')}+ disabled={zoom >= ZOOM_STEPS.at(-1)!}+ icon={ZoomIn}+ size={TOUCH_ICON}+ onClick={() => model.stepZoom(1)}+ /></div></>)}{drawing ? (- // Marking mode: the circled comments are the whole story below the- // image — each new box lands here, ready for its note.- <div {...stylex.props(styles.editor)}>{regionNotes}</div>+ regionSection) : (<>- {/* Two buttons side by side: one enters marking mode, the other- discloses the written note below. The open state is a light- fill, not the primary slab — it marks which panel is open, it- is not the page's action. */}- <div {...stylex.props(styles.actions)}>- {activeEvidence && (- <Button- icon={PencilLine}- {...stylex.props(styles.actionButton)}- onClick={() => model.advance('toggle-draw')}- >- {t('acceptance.review.drawRegion')}- </Button>- )}- <Button- aria-expanded={supplementExpanded}- icon={NotebookPen}- {...stylex.props(styles.actionButton)}- type={supplementExpanded ? 'fill' : 'default'}- onClick={() => setSupplementExpanded((open) => !open)}- >- {hasSupplementContent && !supplementExpanded- ? t('acceptance.review.supplementButtonDraft')- : t('acceptance.review.supplementButton')}+ {activeEvidence && (+ <Button icon={PencilLine} {...stylex.props(styles.drawButton)} onClick={toggleDraw}>+ {t('acceptance.review.drawRegion')}</Button>- </div>- {(hasRegionContent || supplementExpanded) && (- <div {...stylex.props(styles.editor)}>- {hasRegionContent && regionNotes}- {supplementExpanded && (- <>- <Text strong>{t('acceptance.review.supplement')}</Text>- <TextArea- aria-label={t('acceptance.review.supplement')}- autoSize={{ maxRows: 10, minRows: 4 }}- placeholder={t('acceptance.review.rejectPlaceholder')}- style={{ fontSize: 16 }}- value={comment}- onChange={(event) => model.setComment(event.target.value)}- onPaste={handlePaste}- />- <AttachmentUploadButton disabled={loading} onFiles={model.uploadFiles} />- <AttachmentStrip- attachments={attachments}- disabled={loading}- uploading={uploading}- onRemove={model.removeAttachment}- />- <Text fontSize={12} type={'secondary'}>- {t('acceptance.review.draftSaved')}- </Text>- </>- )}- </div>)}+ {hasRegions && regionSection}+ <div {...stylex.props(styles.section)}>+ <div {...stylex.props(styles.label)}>{t('acceptance.review.supplement')}</div>+ {/* 16px: iOS Safari zooms the page when a focused field is smaller. */}+ <TextArea+ aria-label={t('acceptance.review.supplement')}+ autoSize={{ maxRows: 10, minRows: 3 }}+ placeholder={t('acceptance.review.rejectPlaceholder')}+ style={{ fontSize: 16 }}+ value={comment}+ variant={'filled'}+ onChange={(event) => model.setComment(event.target.value)}+ onPaste={handlePaste}+ />+ <div {...stylex.props(styles.caption)}>{t('acceptance.review.draftSaved')}</div>+ <div {...stylex.props(styles.attachments)}>+ <AttachmentUploadButton disabled={loading} onFiles={model.uploadFiles} />+ <AttachmentStrip+ attachments={attachments}+ disabled={loading}+ uploading={uploading}+ onRemove={model.removeAttachment}+ />+ </div>+ </div></>)}</div><div {...stylex.props(styles.footer)}>{drawing ? (- // Done closes marking mode; the boxes and their notes stay. The- // submit only comes back once the reviewer is out of the mode.- <Button- type={'primary'}- {...stylex.props(styles.footerButton)}- onClick={() => model.advance('toggle-draw')}- >+ <Button type={'primary'} {...stylex.props(styles.footerButton)} onClick={toggleDraw}>{t('acceptance.review.confirmRegions')}</Button>) : (<>{failed && (- <Text role={'alert'} type={'danger'}>+ <Text role={'alert'} type={'danger'} {...stylex.props(styles.alert)}>{t('acceptance.review.submitFailed')}</Text>)}diff --git a/src/features/Acceptance/Viewer/Evidence/RegionNotes.tsx b/src/features/Acceptance/Viewer/Evidence/RegionNotes.tsxindex da226f3c672..63b12f467e5 100644--- a/src/features/Acceptance/Viewer/Evidence/RegionNotes.tsx+++ b/src/features/Acceptance/Viewer/Evidence/RegionNotes.tsx@@ -1,66 +1,79 @@'use client';-import { ActionIcon, Flexbox, Icon, TextArea } from '@lobehub/ui';+import { ActionIcon, Flexbox, TextArea } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import { Crosshair, Trash2 } from 'lucide-react';+import { X } from 'lucide-react';import type { ReactNode } from 'react';import { memo } from 'react';import { useTranslation } from 'react-i18next';import type { DraftAnnotationEntry, RejectableEvidence } from '../Review/rejectDraft';+import { regionLocations } from './regionLocation';++// iOS Safari zooms the page when a focused field is smaller than 16px.+const TOUCH_FONT_SIZE = 16;+const TOUCH_REMOVE_SIZE = { blockSize: 44, size: 16 };+const TOUCH_REMOVE_STYLE = { marginBlockStart: -6, marginInlineEnd: -8 };const styles = stylex.create({+ caption: {+ paddingInlineStart: '28px',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },index: {flex: 'none',- width: '18px',- height: '18px',+ width: '20px',+ height: '20px',+ marginBlockStart: '6px',borderRadius: '50%',- fontSize: '11px',+ fontSize: '12px',fontWeight: 600,- lineHeight: '18px',+ lineHeight: '20px',color: '#fff',textAlign: 'center',backgroundColor: cssVar.colorError,backgroundImage: 'none',},jump: {- cursor: 'pointer',- display: 'inline-flex',- gap: '5px',- alignItems: 'center',- alignSelf: 'flex-start',- paddingBlock: '7px',- paddingInline: '2px',- borderStyle: 'none',- fontSize: '13px',- color: cssVar.colorLink,- backgroundColor: 'transparent',- backgroundImage: 'none',- opacity: { 'default': null, ':active': 0.6 },+ 'cursor': 'pointer',+ 'position': 'relative',+ 'appearance': 'none',+ 'padding': 0,+ 'borderWidth': 0,+ 'borderStyle': 'none',+ 'fontFamily': 'inherit',+ 'opacity': { 'default': null, ':active': 0.6 },+ // The badge stays 20px to match the one drawn on the image; the tap target does not.+ '::before': {+ content: '""',+ position: 'absolute',+ insetBlock: '-12px',+ insetInlineStart: '-12px',+ insetInlineEnd: '-4px',+ },},});interface RegionNoteRowProps {- /** Focus the field on mount — a note just made is a note about to be written. */autoFocus?: boolean;- /** Rendered beside the field — the desktop's number badge. */- badge?: ReactNode;- /** Rendered above the field — the phone's jump-back link. */+ badge: ReactNode;caption?: ReactNode;- /** 16px on a phone, so focusing the field never zooms the page. */- fontSize?: number;- /** 1-based, for the accessible name and the remove label. */index: number;onChange: (comment: string) => void;onRemove: () => void;placeholder: string;+ touch?: boolean;value: string;}export const RegionNoteRow = memo<RegionNoteRowProps>(- ({ autoFocus, badge, caption, fontSize, index, placeholder, value, onChange, onRemove }) => {+ ({ autoFocus, badge, caption, index, placeholder, touch, value, onChange, onRemove }) => {const { t } = useTranslation('verify');+ const fontSize = touch ? TOUCH_FONT_SIZE : undefined;+ const removeLabel = t('acceptance.review.removeRegion', { index });return (<Flexbox gap={4}>@@ -75,12 +88,15 @@ export const RegionNoteRow = memo<RegionNoteRowProps>(style={{ flex: 1, fontSize }}styles={fontSize ? { input: { fontSize } } : undefined}value={value}+ variant={'filled'}onChange={(event) => onChange(event.target.value)}/><ActionIcon- aria-label={t('acceptance.review.removeRegion', { index })}- icon={Trash2}- size={{ blockSize: 44, size: 18 }}+ aria-label={removeLabel}+ icon={X}+ size={touch ? TOUCH_REMOVE_SIZE : 'small'}+ style={touch ? TOUCH_REMOVE_STYLE : undefined}+ title={touch ? undefined : removeLabel}onClick={onRemove}/></Flexbox>@@ -97,21 +113,17 @@ interface RegionNotesProps {onRemove: (key: number) => void;}-/** Notes for the regions on the image currently on screen (desktop side panel). */export const RegionNotes = memo<RegionNotesProps>(({ annotations, onChange, onRemove }) => {const { t } = useTranslation('verify');return annotations.map((annotation, index) => (<RegionNoteRow+ autoFocus={index === annotations.length - 1 && !annotation.comment}+ badge={<span {...stylex.props(styles.index)}>{index + 1}</span>}index={index + 1}key={annotation.key}placeholder={t('acceptance.review.annotationPlaceholder', { index: index + 1 })}value={annotation.comment}- badge={- <span className={stylex.props(styles.index).className} style={{ marginBlockStart: 6 }}>- {index + 1}- </span>- }onChange={(comment) => onChange(annotation.key, comment)}onRemove={() => onRemove(annotation.key)}/>@@ -122,44 +134,41 @@ RegionNotes.displayName = 'AcceptanceRegionNotes';interface MobileRegionNotesProps extends RegionNotesProps {evidence: RejectableEvidence[];- /** Show the region's image and put the reviewer back in marking mode. */onJump: (evidenceId: string) => void;}-/**- * Every region across every image, in one list under the phone's stage.- *- * A phone has no side panel to park the other images' notes in, so each row- * says which image and region it belongs to and links back to it.- */export const MobileRegionNotes = memo<MobileRegionNotesProps>(({ annotations, evidence, onChange, onJump, onRemove }) => {const { t } = useTranslation('verify');+ // Badges restart at 1 on every image, like the ones drawn on it, so with+ // several images the number alone no longer says which region a row is.+ const multipleImages = evidence.length > 1;++ const locations = regionLocations(+ annotations,+ evidence.map((item) => item.id),+ );return annotations.map((annotation, index) => {- const imageIndex = evidence.findIndex((item) => item.id === annotation.evidenceId);- const regionIndex = annotations- .filter((item) => item.evidenceId === annotation.evidenceId)- .findIndex((item) => item.key === annotation.key);+ const { image, region } = locations[index];+ const location = t('acceptance.review.regionImage', { image, region });return (<RegionNoteRow- fontSize={16}+ touch+ caption={multipleImages && <div {...stylex.props(styles.caption)}>{location}</div>}index={index + 1}key={annotation.key}placeholder={t('acceptance.review.rejectPlaceholder')}value={annotation.comment}- caption={+ badge={<button- {...stylex.props(styles.jump)}+ {...stylex.props(styles.index, styles.jump)}+ aria-label={location}type={'button'}onClick={() => onJump(annotation.evidenceId)}>- <Icon icon={Crosshair} size={13} />- {t('acceptance.review.regionImage', {- image: imageIndex + 1,- region: regionIndex + 1,- })}+ {region}</button>}onChange={(comment) => onChange(annotation.key, comment)}diff --git a/src/features/Acceptance/Viewer/Evidence/ResourceTile.tsx b/src/features/Acceptance/Viewer/Evidence/ResourceTile.tsxnew file mode 100644index 00000000000..658e0452261--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/ResourceTile.tsx@@ -0,0 +1,207 @@+'use client';++import { Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { AudioLines, FileText, Film, type LucideIcon, Play, SquareTerminal } from 'lucide-react';+import { memo, useState } from 'react';++import type { ResourceItem } from './resources';+import { formatVideoClock } from './Video/videoTime';++const styles = stylex.create({+ tile: {+ overflow: 'hidden',+ display: 'flex',+ flexDirection: 'column',+ minWidth: 0,+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: cssVar.colorBorderSecondary,+ borderRadius: '12px',+ color: cssVar.colorText,+ textDecoration: 'none',+ backgroundColor: cssVar.colorBgContainer,+ },+ link: {+ cursor: 'pointer',+ borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },+ outlineWidth: { 'default': null, ':focus-visible': '2px' },+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimary },+ outlineOffset: { 'default': null, ':focus-visible': '2px' },+ },+ stage: {+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ height: '192px',+ paddingBlock: '12px',+ paddingInline: '12px',+ borderBlockEndWidth: '1px',+ borderBlockEndStyle: 'solid',+ borderBlockEndColor: cssVar.colorBorderSecondary,+ color: cssVar.colorTextSecondary,+ backgroundColor: cssVar.colorFillQuaternary,+ },+ image: {+ maxWidth: '100%',+ maxHeight: '100%',+ borderRadius: '6px',+ objectFit: 'contain',+ },+ recording: {+ position: 'relative',+ overflow: 'hidden',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ width: '100%',+ height: '100%',+ borderRadius: '6px',+ color: '#fff',+ backgroundColor: '#111',+ },+ video: {+ position: 'absolute',+ inset: 0,+ width: '100%',+ height: '100%',+ objectFit: 'contain',+ },+ play: {+ position: 'relative',+ display: 'inline-flex',+ alignItems: 'center',+ justifyContent: 'center',+ width: '36px',+ height: '36px',+ borderRadius: '50%',+ backgroundColor: 'rgba(0, 0, 0, 0.45)',+ },+ duration: {+ position: 'absolute',+ insetBlockEnd: '8px',+ insetInlineEnd: '8px',+ paddingInline: '8px',+ borderRadius: '4px',+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',+ backgroundColor: 'rgba(0, 0, 0, 0.6)',+ },+ meta: {+ display: 'flex',+ flexDirection: 'column',+ minWidth: 0,+ paddingBlock: '8px',+ paddingInline: '12px',+ },+ name: {+ overflow: 'hidden',+ fontSize: '12px',+ fontWeight: 500,+ lineHeight: '20px',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ },+ detail: {+ overflow: 'hidden',+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ },+});++const TYPE_GLYPH: Record<string, LucideIcon> = {+ audio: AudioLines,+ terminal: SquareTerminal,+ video: Film,+};++const RecordingStage = ({ src, video }: { src: string; video: boolean }) => {+ const [duration, setDuration] = useState<number>();++ return (+ <div {...stylex.props(styles.recording)}>+ {video && (+ <video+ muted+ playsInline+ preload={'metadata'}+ src={src}+ tabIndex={-1}+ {...stylex.props(styles.video)}+ onLoadedMetadata={(event) => {+ const seconds = event.currentTarget.duration;+ if (Number.isFinite(seconds)) setDuration(seconds);+ }}+ />+ )}+ <span {...stylex.props(styles.play)}>+ <Icon icon={video ? Play : AudioLines} size={20} />+ </span>+ {duration !== undefined && (+ <span {...stylex.props(styles.duration)}>{formatVideoClock(duration)}</span>+ )}+ </div>+ );+};++const ResourceStage = ({ item, name }: { item: ResourceItem; name: string }) => {+ const { evidence, kind } = item;+ if (kind === 'screenshot')+ return (+ <img alt={name} loading={'lazy'} src={evidence.fileUrl!} {...stylex.props(styles.image)} />+ );+ if (kind === 'recording')+ return <RecordingStage src={evidence.fileUrl!} video={evidence.type === 'video'} />;+ return <Icon icon={TYPE_GLYPH[evidence.type] ?? FileText} size={20} />;+};++interface ResourceTileProps {+ detail: string;+ item: ResourceItem;+}++const ResourceTile = memo<ResourceTileProps>(({ detail, item }) => {+ const { checkTitle, evidence } = item;+ const name = evidence.fileName ?? evidence.description ?? checkTitle;+ const body = (+ <>+ <div {...stylex.props(styles.stage)}>+ <ResourceStage item={item} name={name} />+ </div>+ <div {...stylex.props(styles.meta)}>+ <span {...stylex.props(styles.name)}>{name}</span>+ <span {...stylex.props(styles.detail)}>{detail}</span>+ </div>+ </>+ );++ if (!evidence.fileUrl)+ return (+ <div title={checkTitle} {...stylex.props(styles.tile)}>+ {body}+ </div>+ );++ return (+ <a+ href={evidence.fileUrl}+ rel={'noreferrer'}+ target={'_blank'}+ title={checkTitle}+ {...stylex.props(styles.tile, styles.link)}+ >+ {body}+ </a>+ );+});++ResourceTile.displayName = 'AcceptanceResourceTile';++export default ResourceTile;diff --git a/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsx b/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsxindex 4272ed1b579..0e6f02c7ca6 100644--- a/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsx+++ b/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsx@@ -1,16 +1,16 @@'use client';-import { Flexbox, Icon, Image, Text } from '@lobehub/ui';+import { Flexbox, Icon, Image } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import { Check, MessageSquare, X } from 'lucide-react';+import { Check } from 'lucide-react';import { memo, type ReactNode, useState } from 'react';-import { useTranslation } from 'react-i18next';import { comparisonMedia } from '../../Report/EvidenceComparisonCard';import { useOptionalAcceptanceScope } from '../AcceptanceScope';import { commentAnchorId } from '../Comments/anchor';import { floatingActionHostMarker } from '../markers.stylex';+import { AnnotationFace, OverlayNoteContent, OverlayRect } from './EvidenceOverlays';import { type EvidenceOverlay, overlayColor } from './overlay';import {annotationInSlice,@@ -22,21 +22,6 @@ import {import { useImageThreads } from './useImageThreads';const styles = stylex.create({- badge: {- position: 'absolute',- insetBlockStart: '-9px',- insetInlineStart: '-9px',- display: 'inline-flex',- alignItems: 'center',- justifyContent: 'center',- width: '18px',- height: '18px',- borderRadius: '50%',- fontSize: '11px',- fontWeight: 600,- lineHeight: 1,- color: cssVar.colorTextLightSolid,- },frame: {position: 'relative',overflow: 'hidden',@@ -48,31 +33,6 @@ const styles = stylex.create({borderRadius: cssVar.borderRadiusLG,},frameFlat: { borderStyle: 'none', borderRadius: '0' },- marker: {- pointerEvents: 'auto',- cursor: 'pointer',- position: 'absolute',- insetBlockStart: '-10px',- insetInlineEnd: '-10px',- display: 'inline-flex',- alignItems: 'center',- justifyContent: 'center',- width: '18px',- height: '18px',- borderStyle: 'none',- borderRadius: '50%',- fontSize: '10px',- fontWeight: 600,- lineHeight: 1,- color: cssVar.colorTextLightSolid,- boxShadow: cssVar.boxShadowTertiary,- filter: { 'default': null, ':hover': 'brightness(1.12)' },- },- markerActive: {- outlineWidth: '2px',- outlineStyle: 'solid',- outlineColor: cssVar.colorTextLightSolid,- },note: {position: 'absolute',zIndex: 5,@@ -86,25 +46,6 @@ const styles = stylex.create({boxShadow: cssVar.boxShadowSecondary,insetInlineStart: { 'default': null, '@media (width >= 1440px)': 'calc(100% + 12px)' },},- noteClose: {- cursor: 'pointer',- position: 'absolute',- insetBlockStart: '8px',- insetInlineEnd: '8px',- display: 'inline-flex',- alignItems: 'center',- justifyContent: 'center',- width: '20px',- height: '20px',- padding: '0',- borderStyle: 'none',- borderRadius: cssVar.borderRadius,- color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },- backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },- backgroundImage: { 'default': 'none', ':hover': 'none' },- transition: `all ${cssVar.motionDurationFast}`,- },- noteFallbackHead: { paddingBlockEnd: '4px' },pin: {cursor: 'pointer',position: 'absolute',@@ -125,113 +66,9 @@ const styles = stylex.create({filter: { 'default': null, ':hover': 'brightness(1.12)' },insetInlineStart: { 'default': null, '@media (width >= 1440px)': 'calc(100% + 12px)' },},- pinFace: { width: '18px', height: '18px', borderRadius: '50%', objectFit: 'cover' },- pinInitial: { fontSize: '11px', fontWeight: 600, lineHeight: 1 },stage: { position: 'relative' },- noteBody: { fontSize: '13px', lineHeight: 1.6, overflowWrap: 'anywhere', whiteSpace: 'pre-wrap' },- rect: {- pointerEvents: 'none',- position: 'absolute',- borderWidth: '2px',- borderStyle: 'solid',- borderColor: cssVar.colorError,- borderRadius: cssVar.borderRadiusXS,- boxShadow: '0 0 0 1px rgb(0 0 0 / 45%),\n inset 0 0 0 1px rgb(255 255 255 / 45%)',- },- swatch: { flex: 'none', width: '8px', height: '8px', borderRadius: '50%' },});-interface OverlayRectProps {- annotation: EvidenceOverlay;- /** Index within the whole image, so the marker and the note agree. */- index: number;- numbered: boolean;- onToggle: (index: number) => void;- opened: boolean;- /** Region geometry for THIS tile — a sliced screenshot clips it per tile. */- rect: EvidenceOverlay['rect'];-}--const OverlayRect = memo<OverlayRectProps>(- ({ annotation, index, numbered, onToggle, opened, rect }) => {- // A settled region keeps its place but drops its author's colour: an- // answered note should not compete with an open one for attention.- const color = overlayColor(annotation);- const label = annotation.label ?? index + 1;- return (- <div- className={stylex.props(styles.rect).className}- style={{- borderColor: color,- height: `${rect.height * 100}%`,- left: `${rect.x * 100}%`,- top: `${rect.y * 100}%`,- width: `${rect.width * 100}%`,- }}- >- {numbered && (- <span className={stylex.props(styles.badge).className} style={{ background: color }}>- {label}- </span>- )}- {annotation.comment && (- <button- className={stylex.props(styles.marker, opened && styles.markerActive).className}- style={{ background: color }}- title={annotation.authorName}- type={'button'}- onClick={() => onToggle(index)}- >- {annotation.resolved ? (- <Icon icon={Check} size={10} />- ) : (- <AnnotationFace- name={annotation.authorName}- size={14}- src={annotation.authorAvatar}- />- )}- </button>- )}- </div>- );- },-);--OverlayRect.displayName = 'AcceptanceOverlayRect';--/**- * The author inside a pin. An avatar when we have one, their initial when we- * do not, and the speech bubble only when the author is unknown — a pin with- * no face is indistinguishable from the next pin along.- */-const AnnotationFace = memo<{ name?: string; size?: number; src?: string | null }>(- ({ name, size = 18, src }) => {- if (src)- return (- <img- alt={name ?? ''}- className={stylex.props(styles.pinFace).className}- src={src}- style={{ height: size, width: size }}- />- );- const initial = name?.trim().slice(0, 1);- if (initial)- return (- <span- className={stylex.props(styles.pinInitial).className}- style={{ fontSize: size < 16 ? 9 : 11 }}- >- {initial.toUpperCase()}- </span>- );- return <Icon icon={MessageSquare} size={size < 16 ? 10 : 12} />;- },-);--AnnotationFace.displayName = 'AcceptanceAnnotationFace';-interface ScreenshotTilesProps {/** Floats over the picture (see `FloatingCommentAction`). */action?: ReactNode;@@ -247,7 +84,6 @@ interface ScreenshotTilesProps {export const ScreenshotTiles = memo<ScreenshotTilesProps>(({ action, alt, annotations, caption, fileHeight, fileWidth, flat = false, src }) => {- const { t } = useTranslation('verify');const [natural, setNatural] = useState(fileWidth && fileHeight ? { height: fileHeight, width: fileWidth } : undefined,);@@ -275,40 +111,11 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(id={opened.threadId ? commentAnchorId(opened.threadId) : undefined}style={{ insetBlockStart: `${Math.min(Math.max(opened.rect.y, 0), 0.62) * 100}%` }}>- {/*- * Opening a note hides every pin, including the one that opened it, so- * without this the only way back is the small marker on the box itself- * — findable if you know it is there, and nowhere near where the reader- * is looking.- */}- <button- {...stylex.props(styles.noteClose)}- title={t('acceptance.comments.collapseThread')}- type={'button'}- onClick={close}- >- <Icon icon={X} size={12} />- </button>- {opened.panel ?? (- <Flexbox gap={4}>- <Flexbox- horizontal- align={'center'}- className={stylex.props(styles.noteFallbackHead).className}- gap={6}- >- <span- className={stylex.props(styles.swatch).className}- style={{ background: opened.color ?? cssVar.colorError }}- />- <Text fontSize={12} type={'secondary'}>- {numbered ? `${opened.label ?? openedNote! + 1} · ` : ''}- {opened.authorName}- </Text>- </Flexbox>- <div {...stylex.props(styles.noteBody)}>{opened.comment}</div>- </Flexbox>- )}+ <OverlayNoteContent+ label={numbered ? (opened.label ?? openedNote! + 1) : undefined}+ opened={opened}+ onClose={close}+ /></div>);diff --git a/src/features/Acceptance/Viewer/Evidence/TapToReviewImage.tsx b/src/features/Acceptance/Viewer/Evidence/TapToReviewImage.tsxnew file mode 100644index 00000000000..074b66e1499--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/TapToReviewImage.tsx@@ -0,0 +1,57 @@+'use client';++import * as stylex from '@stylexjs/stylex';+import { memo, type ReactNode } from 'react';++import { floatingActionHostMarker } from '../markers.stylex';++const styles = stylex.create({+ host: {+ position: 'relative',+ width: '100%',+ },+ button: {+ cursor: 'pointer',+ width: '100%',+ padding: 0,+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ textAlign: 'start',+ backgroundColor: 'transparent',+ backgroundImage: 'none',+ },+ image: {+ display: 'block',+ width: '100%',+ maxWidth: '100%',+ height: '180px',+ borderRadius: '8px',+ objectFit: 'cover',+ objectPosition: 'top',+ },+});++interface TapToReviewImageProps {+ action?: ReactNode;+ alt: string;+ caption?: ReactNode;+ onReview: () => void;+ src: string;+}++// The tap reviews; the comment shortcut sits beside the button rather than+// inside it, since a button cannot hold another one.+export const TapToReviewImage = memo<TapToReviewImageProps>(+ ({ action, alt, caption, onReview, src }) => (+ <div {...stylex.props(styles.host, action ? floatingActionHostMarker : null)}>+ <button type={'button'} {...stylex.props(styles.button)} onClick={onReview}>+ <img alt={alt} loading={'lazy'} src={src} {...stylex.props(styles.image)} />+ {caption}+ </button>+ {action}+ </div>+ ),+);++TapToReviewImage.displayName = 'AcceptanceTapToReviewImage';diff --git a/src/features/Acceptance/Viewer/Evidence/Video/ChapterScrubber.tsx b/src/features/Acceptance/Viewer/Evidence/Video/ChapterScrubber.tsxnew file mode 100644index 00000000000..bc889634843--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/ChapterScrubber.tsx@@ -0,0 +1,225 @@+'use client';++import type { VerifyEvidenceChapter } from '@lobechat/types';+import { useVideoState, type VideoPlayer, type VideoState } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import type { PointerEvent as ReactPointerEvent } from 'react';+import { useLayoutEffect, useRef } from 'react';+import { useTranslation } from 'react-i18next';++import { sx } from '@/styles/sx';++import { chapterScrubberStyles as styles } from './chapterScrubberStyles';+import {+ fanOutPins,+ type PinSlot,+ type ScrubberSegment,+ type StoryEntry,+ type StoryNote,+ toScrubberSegments,+} from './story';+import { CLAIM_COLOR } from './styles';+import { formatVideoTime } from './videoTime';++const GAP_PX = 4;+const PIN_EDGE_PX = 10;++const pinLeft = (slot: PinSlot, clampAlone: boolean) => {+ if (slot.before + slot.after === 0 && !clampAlone) return `${slot.percent}%`;+ return `clamp(${PIN_EDGE_PX + slot.before}px, calc(${slot.percent}% + ${slot.offset}px), calc(100% - ${+ PIN_EDGE_PX + slot.after+ }px))`;+};++interface ChapterScrubberProps<N extends StoryNote> {+ chapters: VerifyEvidenceChapter[];+ onPin: (entry: StoryEntry<N>) => void;+ player: VideoPlayer;+ range: { end: number; start: number } | null;+ story: StoryEntry<N>[];+}++export const ChapterScrubber = <N extends StoryNote>({+ chapters,+ onPin,+ player,+ range,+ story,+}: ChapterScrubberProps<N>) => {+ const { t } = useTranslation('verify');+ const root = useRef<HTMLDivElement>(null);+ const track = useRef<HTMLDivElement>(null);+ const duration = useVideoState(player, (state) =>+ Number.isFinite(state.duration) ? state.duration : 0,+ );+ const currentStart = useVideoState(player, (state) => state.activeSection?.start);++ useLayoutEffect(() => {+ const paint = (state: VideoState) => {+ root.current?.style.setProperty('--video-time', String(state.time));+ track.current?.setAttribute('aria-valuenow', String(Math.round(state.time)));+ track.current?.setAttribute(+ 'aria-valuetext',+ [+ `${formatVideoTime(state.time)} / ${formatVideoTime(state.duration)}`,+ state.activeSection?.title,+ ]+ .filter(Boolean)+ .join(', '),+ );+ };+ paint(player.getState());+ return player.subscribe(paint);+ }, [player]);++ const segments: ScrubberSegment[] = toScrubberSegments(chapters, duration);+ const pct = (seconds: number) => (duration > 0 ? (seconds / duration) * 100 : 0);+ const box = (segment: ScrubberSegment, index: number) => {+ const before = index === 0 ? 0 : GAP_PX / 2;+ const after = index === segments.length - 1 ? 0 : GAP_PX / 2;+ return {+ left: `calc(${pct(segment.start)}% + ${before}px)`,+ width: `calc(${pct(segment.end - segment.start)}% - ${before + after}px)`,+ };+ };++ const timeAt = (element: HTMLElement, clientX: number) => {+ const bounds = element.getBoundingClientRect();+ if (!bounds.width) return 0;+ return Math.min(Math.max((clientX - bounds.left) / bounds.width, 0), 1) * duration;+ };+ const onPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {+ if (event.button !== 0 || !duration) return;+ const element = event.currentTarget;+ player.seek(timeAt(element, event.clientX));+ element.setPointerCapture?.(event.pointerId);+ const move = (next: PointerEvent) => player.seek(timeAt(element, next.clientX));+ const up = () => {+ element.removeEventListener('pointermove', move);+ element.removeEventListener('pointerup', up);+ element.removeEventListener('pointercancel', up);+ };+ element.addEventListener('pointermove', move);+ element.addEventListener('pointerup', up);+ element.addEventListener('pointercancel', up);+ };++ const inside = (seconds: number) => duration > 0 && seconds >= 0 && seconds <= duration;+ const pinSlots = fanOutPins(+ story.filter((entry) => entry.type !== 'chapter' && inside(entry.time)),+ duration,+ );++ return (+ <div {...stylex.props(styles.root)} ref={root}>+ {story.map((entry) => {+ const slot = pinSlots.get(entry.id);+ if (!slot) return null;+ switch (entry.type) {+ case 'chapter': {+ return null;+ }+ case 'claim': {+ return (+ <button+ aria-label={`${t(`acceptance.video.claim.${entry.claim.kind}`)} ${formatVideoTime(entry.time)}`}+ key={entry.id}+ type={'button'}+ {...sx(styles.pin, styles.claimPin, { left: pinLeft(slot, false) })}+ onClick={() => onPin(entry)}+ >+ <span+ {...stylex.props(+ styles.claimDot,+ styles.claimColor(CLAIM_COLOR[entry.claim.kind]),+ )}+ />+ </button>+ );+ }+ case 'note': {+ return (+ <button+ key={entry.id}+ type={'button'}+ aria-label={t('acceptance.video.story.notePin', {+ index: entry.index,+ time: formatVideoTime(entry.time),+ })}+ {...sx(styles.pin, styles.notePin, { left: pinLeft(slot, true) })}+ onClick={() => onPin(entry)}+ >+ {entry.index}+ </button>+ );+ }+ }+ })}+ <div+ aria-label={t('acceptance.video.seek')}+ aria-valuemax={Math.round(duration)}+ aria-valuemin={0}+ ref={track}+ role={'slider'}+ tabIndex={0}+ {...stylex.props(styles.track)}+ onPointerDown={onPointerDown}+ >+ {segments.length === 0 && <div {...sx(styles.segment, { left: 0, width: '100%' })} />}+ {segments.map((segment, index) => (+ <div key={segment.start} {...sx(styles.segment, box(segment, index))}>+ <div+ {...sx(styles.played, {+ width: `calc(clamp(0, (var(--video-time, 0) - ${segment.start}) / ${+ segment.end - segment.start+ }, 1) * 100%)`,+ })}+ />+ </div>+ ))}+ {story.map((entry) =>+ entry.type === 'note' && entry.note.end !== undefined && inside(entry.time) ? (+ <div+ key={entry.id}+ {...sx(styles.noteSpan, {+ left: `${pct(entry.time)}%`,+ width: `${pct(Math.min(entry.note.end, duration) - entry.time)}%`,+ })}+ />+ ) : null,+ )}+ {range && duration > 0 && (+ <div+ {...sx(styles.range, {+ left: `${pct(range.start)}%`,+ width: `${pct(Math.min(range.end, duration) - range.start)}%`,+ })}+ />+ )}+ {duration > 0 && (+ <div {...sx(styles.head, { left: `calc(var(--video-time, 0) / ${duration} * 100%)` })} />+ )}+ </div>+ {segments.some((segment) => segment.label) && (+ <div {...stylex.props(styles.labels)}>+ {segments.map((segment, index) =>+ segment.label ? (+ <button+ key={segment.start}+ type={'button'}+ {...sx(+ styles.label,+ segment.start === currentStart && styles.labelCurrent,+ box(segment, index),+ )}+ onClick={() => player.seek(segment.start)}+ >+ {segment.label}+ </button>+ ) : null,+ )}+ </div>+ )}+ </div>+ );+};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/RangeLane.tsx b/src/features/Acceptance/Viewer/Evidence/Video/RangeLane.tsxdeleted file mode 100644index bfd58dd68c6..00000000000--- a/src/features/Acceptance/Viewer/Evidence/Video/RangeLane.tsx+++ /dev/null@@ -1,83 +0,0 @@-'use client';--import { useVideo } from '@lobehub/ui';-import * as stylex from '@stylexjs/stylex';-import type { PointerEvent as ReactPointerEvent } from 'react';-import { useTranslation } from 'react-i18next';--import { sx } from '@/styles/sx';--import type { TimedNote } from './chapters';-import { styles } from './styles';--export interface VideoLoop {- end: number;- start: number;-}--interface RangeLaneProps {- notes: TimedNote[];- onRange: (range: VideoLoop | null) => void;- onSeek: (seconds: number) => void;- range: VideoLoop | null;-}--/** The lane under the rail: drag to select a span, and see the spans notes cover. */-export const RangeLane = ({ notes, onRange, onSeek, range }: RangeLaneProps) => {- const { t } = useTranslation('verify');- const duration = useVideo((state) => (Number.isFinite(state.duration) ? state.duration : 0));- const pct = (seconds: number) => `${(duration ? seconds / duration : 0) * 100}%`;-- const timeAt = (element: HTMLElement, clientX: number) => {- const box = element.getBoundingClientRect();- return Math.min(Math.max((clientX - box.left) / box.width, 0), 1) * duration;- };-- const onPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {- if (!duration) return;- const element = event.currentTarget;- const anchor = timeAt(element, event.clientX);- onRange({ end: anchor, start: anchor });- element.setPointerCapture?.(event.pointerId);- const move = (next: PointerEvent) => {- const seconds = timeAt(element, next.clientX);- onRange({ end: Math.max(anchor, seconds), start: Math.min(anchor, seconds) });- };- const up = (next: PointerEvent) => {- element.removeEventListener('pointermove', move);- element.removeEventListener('pointerup', up);- const seconds = timeAt(element, next.clientX);- // A click, not a drag, clears the span rather than leaving a sliver.- if (Math.abs(seconds - anchor) < 0.15) onRange(null);- else onSeek(Math.min(anchor, seconds));- };- element.addEventListener('pointermove', move);- element.addEventListener('pointerup', up);- };-- return (- <div {...stylex.props(styles.lane)} onPointerDown={onPointerDown}>- {!range && <span {...stylex.props(styles.laneLabel)}>{t('acceptance.video.rangeLane')}</span>}- {notes- .filter((note) => note.end !== undefined)- .map((note) => (- <div- key={`span-${note.key}`}- {...sx(styles.noteSpan, {- left: pct(note.start),- top: 4,- width: pct(note.end! - note.start),- })}- />- ))}- {range && (- <div- {...sx(styles.rangeBand, {- left: pct(range.start),- width: pct(range.end - range.start),- })}- />- )}- </div>- );-};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/ReviewControls.tsx b/src/features/Acceptance/Viewer/Evidence/Video/ReviewControls.tsxnew file mode 100644index 00000000000..c754624cc54--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/ReviewControls.tsx@@ -0,0 +1,205 @@+'use client';++import { ActionIcon, Button, Popover, Select, useVideoState, type VideoPlayer } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { Captions, Flag, Keyboard, Maximize, Pause, Play } from 'lucide-react';+import type { ReactNode } from 'react';+import { useTranslation } from 'react-i18next';++import { REVIEW_RATES } from './useReviewKeys';+import { StoryLink } from './VideoStory';+import { formatVideoTime } from './videoTime';++const styles = stylex.create({+ controls: {+ display: 'flex',+ flex: 'none',+ gap: '8px',+ alignItems: 'center',+ marginBlockStart: '12px',+ fontSize: '12px',+ lineHeight: '20px',+ },+ time: {+ flex: 'none',+ fontFamily: cssVar.fontFamilyCode,+ fontVariantNumeric: 'tabular-nums',+ color: cssVar.colorText,+ whiteSpace: 'nowrap',+ },+ spacer: { flex: '1' },+ rate: { flex: 'none', width: '80px' },+ shortcuts: {+ display: 'grid',+ gridTemplateColumns: 'max-content 1fr',+ rowGap: '4px',+ columnGap: '12px',+ alignItems: 'center',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ kbd: {+ display: 'inline-block',+ minWidth: '16px',+ marginInline: '1px',+ paddingInline: '4px',+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: cssVar.colorBorder,+ borderRadius: '4px',+ fontFamily: cssVar.fontFamilyCode,+ fontSize: '12px',+ lineHeight: '18px',+ color: cssVar.colorTextSecondary,+ textAlign: 'center',+ },+ addRow: {+ display: 'flex',+ flex: 'none',+ flexWrap: 'wrap',+ columnGap: '12px',+ rowGap: '4px',+ alignItems: 'center',+ marginBlockStart: '16px',+ },+ hint: {+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+});++const Keys = ({ keys }: { keys: string[] }) => (+ <span>+ {keys.map((key) => (+ <kbd key={key} {...stylex.props(styles.kbd)}>+ {key}+ </kbd>+ ))}+ </span>+);++const Shortcuts = () => {+ const { t } = useTranslation('verify');+ const rows: [string[], ReactNode][] = [+ [['Space'], `${t('acceptance.video.play')} / ${t('acceptance.video.pause')}`],+ [[',', '.'], t('acceptance.video.keysFrame')],+ [['J', 'L'], t('acceptance.video.speed')],+ [['M'], t('acceptance.video.markFrame')],+ [['I', 'O'], t('acceptance.video.keysRange')],+ [['Esc'], t('acceptance.video.clearRange')],+ ];+ return (+ <div {...stylex.props(styles.shortcuts)}>+ {rows.map(([keys, label]) => [+ <Keys key={`keys-${keys.join('')}`} keys={keys} />,+ <span key={`label-${keys.join('')}`}>{label}</span>,+ ])}+ </div>+ );+};++const TimeReadout = ({ player }: { player: VideoPlayer }) => {+ const readout = useVideoState(+ player,+ (state) => `${formatVideoTime(state.time)} / ${formatVideoTime(state.duration)}`,+ );+ return <span {...stylex.props(styles.time)}>{readout}</span>;+};++const CaptionsToggle = ({ player }: { player: VideoPlayer }) => {+ const { t } = useTranslation('verify');+ const shown = useVideoState(player, (state) => state.captions);+ return (+ <ActionIcon+ active={shown}+ aria-pressed={shown}+ icon={Captions}+ size={'small'}+ title={shown ? t('acceptance.video.captionsHide') : t('acceptance.video.captionsShow')}+ onClick={() => player.setCaptions(!shown)}+ />+ );+};++interface ReviewControlsProps {+ captions?: boolean;+ player: VideoPlayer;+}++export const ReviewControls = ({ captions, player }: ReviewControlsProps) => {+ const { t } = useTranslation('verify');+ const paused = useVideoState(player, (state) => state.paused);+ const rate = useVideoState(player, (state) => state.rate);+ const ready = useVideoState(player, (state) => state.status === 'ready');+ const rates = REVIEW_RATES.includes(rate)+ ? REVIEW_RATES+ : [...REVIEW_RATES, rate].toSorted((a, b) => a - b);++ return (+ <div {...stylex.props(styles.controls)}>+ <ActionIcon+ disabled={!ready}+ icon={paused ? Play : Pause}+ size={'small'}+ title={paused ? t('acceptance.video.play') : t('acceptance.video.pause')}+ onClick={player.toggle}+ />+ <TimeReadout player={player} />+ <span {...stylex.props(styles.spacer)} />+ <span {...stylex.props(styles.rate)}>+ <Select+ aria-label={t('acceptance.video.speed')}+ options={rates.map((value) => ({ label: `${value}×`, value: String(value) }))}+ size={'small'}+ value={String(rate)}+ variant={'filled'}+ onChange={(value) => player.setRate(Number(value))}+ />+ </span>+ {captions && <CaptionsToggle player={player} />}+ <Popover content={<Shortcuts />} placement={'topRight'} trigger={'click'}>+ <ActionIcon icon={Keyboard} size={'small'} title={t('acceptance.video.story.shortcuts')} />+ </Popover>+ <ActionIcon+ icon={Maximize}+ size={'small'}+ title={t('acceptance.video.fullscreen')}+ onClick={() => void player.requestFullscreen()}+ />+ </div>+ );+};++interface AddNoteRowProps {+ onAdd: () => void;+ onClearRange: () => void;+ player: VideoPlayer;+ range: { end: number; start: number } | null;+}++export const AddNoteRow = ({ onAdd, onClearRange, player, range }: AddNoteRowProps) => {+ const { t } = useTranslation('verify');+ const ready = useVideoState(player, (state) => state.status === 'ready');+ const time = useVideoState(player, (state) => formatVideoTime(state.time));++ return (+ <div {...stylex.props(styles.addRow)}>+ <Button disabled={!ready} icon={Flag} onClick={onAdd}>+ {range+ ? t('acceptance.video.story.addSpanNote', {+ end: formatVideoTime(range.end),+ start: formatVideoTime(range.start),+ })+ : t('acceptance.video.story.addNote', { time })}+ </Button>+ {range ? (+ <StoryLink onClick={onClearRange}>{t('acceptance.video.clearRange')}</StoryLink>+ ) : (+ <span {...stylex.props(styles.hint)}>{t('acceptance.video.story.addHint')}</span>+ )}+ </div>+ );+};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/ReviewTools.tsx b/src/features/Acceptance/Viewer/Evidence/Video/ReviewTools.tsxdeleted file mode 100644index e7e0afe43cf..00000000000--- a/src/features/Acceptance/Viewer/Evidence/Video/ReviewTools.tsx+++ /dev/null@@ -1,108 +0,0 @@-'use client';--import { ActionIcon, Button, Flexbox, Icon, Text } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import { Flag, MessageSquareText, Repeat, X } from 'lucide-react';-import { useTranslation } from 'react-i18next';--import type { VideoLoop } from './RangeLane';-import { formatVideoTime } from './videoTime';--const local = stylex.create({- kbd: {- display: 'inline-block',- minWidth: '16px',- marginInline: '1px',- paddingInline: '4px',- borderWidth: '1px',- borderStyle: 'solid',- borderColor: cssVar.colorBorder,- borderRadius: '4px',- fontFamily: cssVar.fontFamilyCode,- fontSize: '10px',- lineHeight: '16px',- color: cssVar.colorTextSecondary,- textAlign: 'center',- },- mono: { fontFamily: cssVar.fontFamilyCode, fontVariantNumeric: 'tabular-nums' },- tools: {- flex: 'none',- minHeight: '40px',- paddingBlock: '6px',- paddingInline: '12px',- borderRadius: cssVar.borderRadiusLG,- fontSize: '12px',- backgroundColor: cssVar.colorFillQuaternary,- backgroundImage: 'none',- },-});--interface ReviewToolsProps {- loop: boolean;- onClearRange: () => void;- onCommentRange: () => void;- onMarkFrame: () => void;- onToggleLoop: () => void;- range: VideoLoop | null;- ready: boolean;-}--/** The selected span and what to do with it, or the keys and the mark button. */-export const ReviewTools = ({- loop,- onClearRange,- onCommentRange,- onMarkFrame,- onToggleLoop,- range,- ready,-}: ReviewToolsProps) => {- const { t } = useTranslation('verify');-- return (- <Flexbox horizontal align={'center'} className={stylex.props(local.tools).className} gap={8}>- {range ? (- <>- <Icon icon={Repeat} size={14} />- <span {...stylex.props(local.mono)}>- {formatVideoTime(range.start)} – {formatVideoTime(range.end)}- </span>- <Text fontSize={12} type={'secondary'}>- {t('acceptance.video.rangeSeconds', { seconds: (range.end - range.start).toFixed(1) })}- </Text>- <div style={{ flex: 1 }} />- <Button size={'small'} type={loop ? 'primary' : 'default'} onClick={onToggleLoop}>- {t('acceptance.video.loop')}- </Button>- <Button icon={MessageSquareText} size={'small'} onClick={onCommentRange}>- {t('acceptance.video.commentRange')}- </Button>- <ActionIcon- icon={X}- size={'small'}- title={t('acceptance.video.clearRange')}- onClick={onClearRange}- />- </>- ) : (- <>- <Text fontSize={12} type={'secondary'}>- <span {...stylex.props(local.kbd)}>Space</span> {t('acceptance.video.play')} ·{' '}- <span {...stylex.props(local.kbd)}>,</span>- <span {...stylex.props(local.kbd)}>.</span> {t('acceptance.video.keysFrame')} ·{' '}- <span {...stylex.props(local.kbd)}>J</span>- <span {...stylex.props(local.kbd)}>L</span> {t('acceptance.video.speed')} ·{' '}- <span {...stylex.props(local.kbd)}>M</span> {t('acceptance.video.markFrame')} ·{' '}- <span {...stylex.props(local.kbd)}>I</span>- <span {...stylex.props(local.kbd)}>O</span> {t('acceptance.video.keysRange')}- </Text>- <div style={{ flex: 1 }} />- <Button disabled={!ready} icon={Flag} size={'small'} onClick={onMarkFrame}>- {t('acceptance.video.markFrame')}- </Button>- </>- )}- </Flexbox>- );-};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsxindex d332ac72f74..f5d4f439242 100644--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsx+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsx@@ -50,7 +50,7 @@ const styles = stylex.create({paddingInline: '6px',borderStyle: 'none',borderRadius: cssVar.borderRadiusSM,- fontSize: '13px',+ fontSize: '14px',color: cssVar.colorText,textAlign: 'start',backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },@@ -59,7 +59,7 @@ const styles = stylex.create({time: {flex: 'none',fontFamily: cssVar.fontFamilyCode,- fontSize: '11px',+ fontSize: '12px',fontVariantNumeric: 'tabular-nums',color: cssVar.colorTextTertiary,},diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidenceDiscussion.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidenceDiscussion.tsxindex 482d0242161..7fe4a6ef0e4 100644--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidenceDiscussion.tsx+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidenceDiscussion.tsx@@ -1,7 +1,7 @@'use client';import type { AcceptanceReviewAnnotation, VerifyEvidenceChapter } from '@lobechat/types';-import { Flexbox, Icon, Text } from '@lobehub/ui';+import { Flexbox, Icon } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { CheckCircle2, ChevronRight, MessageSquare } from 'lucide-react';@@ -12,75 +12,61 @@ import { useTranslation } from 'react-i18next';import { useOptionalAcceptanceScope } from '../../AcceptanceScope';import { commentAnchorId } from '../../Comments/anchor';import { type EvidenceOverlay, overlayColor } from '../overlay';+import { buildVideoStory, type StoryNote } from './story';import { useVideoThreads, type VideoThread } from './useVideoThreads';import {VideoEvidencePlayer,type VideoEvidencePlayerHandle,type VideoMark,} from './VideoEvidencePlayer';-import { formatVideoTime } from './videoTime';+import {+ StoryBadge,+ StoryChapter,+ StoryDot,+ StoryItem,+ StoryList,+ StoryText,+ StoryTitle,+ StoryWho,+} from './VideoStory';const styles = stylex.create({- badgeColor: (color: string) => ({ backgroundColor: color }),item: {scrollMarginBlock: 96,- borderRadius: cssVar.borderRadius,- transition: `background ${cssVar.motionDurationMid}`,- },- itemOpen: {- backgroundColor: cssVar.colorFillQuaternary,- boxShadow: `inset 0 0 0 1px ${cssVar.colorBorderSecondary}`,},- row: {- cursor: 'pointer',+ story: {display: 'flex',- gap: 8,- alignItems: 'center',- width: '100%',- minHeight: 36,- paddingBlock: 6,+ flexDirection: 'column',+ gap: 12,paddingInline: 8,- borderWidth: 0,- borderRadius: cssVar.borderRadius,- fontSize: 14,- color: cssVar.colorText,- textAlign: 'start',- backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },- outline: { 'default': null, ':focus-visible': `2px solid ${cssVar.colorPrimaryBorder}` },- outlineOffset: { 'default': null, ':focus-visible': -2 },},- badge: {- flex: 'none',- width: 18,- height: 18,- borderRadius: '50%',- fontSize: 11,- fontWeight: 600,- lineHeight: '18px',- color: cssVar.colorTextLightSolid,- textAlign: 'center',+ heading: {+ display: 'flex',+ gap: 8,+ alignItems: 'baseline',},- stamp: {- flex: 'none',- fontFamily: cssVar.fontFamilyCode,+ count: {fontSize: 12,- fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',color: cssVar.colorTextSecondary,},+ who: {+ display: 'flex',+ gap: 8,+ alignItems: 'center',+ minWidth: 0,+ },author: {overflow: 'hidden',- flex: 'none',- maxWidth: '30%',+ minWidth: 0,fontSize: 12,+ lineHeight: '20px',color: cssVar.colorTextSecondary,textOverflow: 'ellipsis',whiteSpace: 'nowrap',- display: { 'default': null, '@media (width <= 767px)': 'none' },},excerpt: {overflow: 'hidden',- flex: '1',- minWidth: 0,textOverflow: 'ellipsis',whiteSpace: 'nowrap',},@@ -95,6 +81,7 @@ const styles = stylex.create({},chevron: {flex: 'none',+ marginInlineStart: 'auto',color: cssVar.colorTextTertiary,transition: {'default': `transform ${cssVar.motionDurationMid}`,@@ -102,21 +89,10 @@ const styles = stylex.create({},},chevronOpen: { transform: 'rotate(90deg)' },- thread: {- paddingBlockStart: 0,- paddingBlockEnd: 12,- paddingInlineStart: 36,- paddingInlineEnd: 12,- },});-/**- * A video with its discussion. The posted comments sit under the player as an- * index in timeline order — number, moment, who, the first line — so a reader- * can scan them without the full threads stacking up below the recording.- * Opening one pauses on its frame, lifts its region and unfolds the thread with- * its replies and resolve action; a pin on the timeline opens the same row.- */+type ThreadStoryNote = StoryNote & { thread: VideoThread };+export const VideoEvidenceDiscussion = ({evidenceId,src,@@ -171,6 +147,12 @@ export const VideoEvidenceDiscussion = ({),];+ const story = buildVideoStory<ThreadStoryNote>(+ chapters ?? [],+ threads.map((thread) => ({ key: thread.threadId, start: thread.time.start, thread })),+ );+ const seek = (start: number) => player.current?.focus({ start }, { reveal: false });+// Opening a row keeps the reader on the thread they asked for: the player// moves to the moment where it stands, without scrolling the row away (on a// phone the two do not fit on one screen).@@ -184,6 +166,7 @@ export const VideoEvidenceDiscussion = ({activeMark={openId}caption={caption}chapters={chapters}+ claimList={false}handleRef={player}marks={marks}src={src}@@ -199,64 +182,106 @@ export const VideoEvidenceDiscussion = ({);}}/>- {threads.length > 0 && (- <Flexbox gap={4}>- <Text fontSize={12} style={{ paddingInline: 8 }} type={'secondary'}>- {t('acceptance.comments.video.listTitle', { count: threads.length })}- </Text>- {threads.map((item, index) => {- const isOpen = openId === item.threadId;- const messages = item.commentIds?.length ?? 1;- return (- <div- {...stylex.props(styles.item, isOpen && styles.itemOpen)}- id={`video-thread-${item.threadId}`}- key={item.threadId}- >- <button- aria-expanded={isOpen}- {...stylex.props(styles.row)}- type={'button'}- onClick={() => select(item)}- >- <span {...stylex.props(styles.badge, styles.badgeColor(overlayColor(item)))}>- {index + 1}- </span>- <span {...stylex.props(styles.stamp)}>{formatVideoTime(item.time.start)}</span>- {/* Open, the thread below names the author and says it in full. */}- <span {...stylex.props(styles.author)}>{isOpen ? '' : item.authorName}</span>- <span {...stylex.props(styles.excerpt, item.resolved && styles.resolved)}>- {isOpen ? '' : item.comment}- </span>- {messages > 1 && (- <span- {...stylex.props(styles.meta)}- title={t('acceptance.comments.sectionMessages', { count: messages })}+ {story.length > 0 && (+ <div {...stylex.props(styles.story)}>+ <div {...stylex.props(styles.heading)}>+ <StoryTitle>{t('acceptance.video.story.title')}</StoryTitle>+ {threads.length > 0 && (+ <span {...stylex.props(styles.count)}>+ {t('acceptance.comments.video.listTitle', { count: threads.length })}+ </span>+ )}+ </div>+ <StoryList>+ {story.map((entry, index) => {+ switch (entry.type) {+ case 'chapter': {+ return (+ <StoryChapter+ first={index === 0}+ key={entry.id}+ label={entry.label}+ time={entry.time}+ onSeek={() => seek(entry.time)}+ />+ );+ }+ case 'claim': {+ return (+ <StoryItem+ key={entry.id}+ marker={<StoryDot kind={entry.claim.kind} />}+ time={entry.time}+ head={+ <>+ <StoryWho>{t(`acceptance.video.claim.${entry.claim.kind}`)}</StoryWho>+ <StoryText>{entry.claim.note}</StoryText>+ </>+ }+ onSeek={() => seek(entry.time)}+ />+ );+ }+ case 'note': {+ const item = entry.note.thread;+ const isOpen = openId === item.threadId;+ const messages = item.commentIds?.length ?? 1;+ return (+ <StoryItem+ active={isOpen}+ expanded={isOpen}+ id={`video-thread-${item.threadId}`}+ key={entry.id}+ marker={<StoryBadge color={overlayColor(item)}>{entry.index}</StoryBadge>}+ time={entry.time}+ xstyle={styles.item}+ head={+ <>+ <span {...stylex.props(styles.who)}>+ <span {...stylex.props(styles.author)}>{item.authorName}</span>+ {messages > 1 && (+ <span+ {...stylex.props(styles.meta)}+ title={t('acceptance.comments.sectionMessages', {+ count: messages,+ })}+ >+ <Icon icon={MessageSquare} size={12} />+ {messages}+ </span>+ )}+ {item.resolved && (+ <span+ {...stylex.props(styles.meta)}+ title={t('acceptance.comments.resolved')}+ >+ <Icon icon={CheckCircle2} size={14} />+ </span>+ )}+ <Icon+ {...stylex.props(styles.chevron, isOpen && styles.chevronOpen)}+ icon={ChevronRight}+ size={14}+ />+ </span>+ {/* Open, the thread below says it in full. */}+ {!isOpen && (+ <StoryText xstyle={[styles.excerpt, item.resolved && styles.resolved]}>+ {item.comment}+ </StoryText>+ )}+ </>+ }+ onSeek={() => select(item)}>- <Icon icon={MessageSquare} size={12} />- {messages}- </span>- )}- {item.resolved && (- <span {...stylex.props(styles.meta)} title={t('acceptance.comments.resolved')}>- <Icon icon={CheckCircle2} size={14} />- </span>- )}- <Icon- {...stylex.props(styles.chevron, isOpen && styles.chevronOpen)}- icon={ChevronRight}- size={14}- />- </button>- {isOpen && (- <div {...stylex.props(styles.thread)} id={commentAnchorId(item.threadId)}>- {item.panel}- </div>- )}- </div>- );- })}- </Flexbox>+ {isOpen && <div id={commentAnchorId(item.threadId)}>{item.panel}</div>}+ </StoryItem>+ );+ }+ }+ })}+ </StoryList>+ </div>)}</Flexbox>);diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsxindex 50503aa6ad7..a9cac5747f9 100644--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx@@ -32,6 +32,7 @@ import { styles } from './styles';import { useVideoRegionGesture } from './useVideoRegionGesture';import { DraftRegion, type FrameRegion, FrameRegions } from './VideoChrome';import { VideoClaimList } from './VideoClaimList';+import { VideoLoadFailed } from './VideoLoadFailed';import { frameOf } from './videoTime';const MAX_HEIGHT = 360;@@ -107,6 +108,7 @@ interface VideoEvidencePlayerProps {/** The description stays at content width even when the frame is portrait. */caption?: ReactNode;chapters?: VerifyEvidenceChapter[];+ claimList?: boolean;frameMaxHeight?: string;handleRef?: RefObject<VideoEvidencePlayerHandle | null>;initialTime?: number;@@ -160,6 +162,7 @@ export const VideoEvidencePlayer = memo<VideoEvidencePlayerProps>(activeMark,caption,chapters = [],+ claimList = true,frameMaxHeight,handleRef,initialTime = 0,@@ -284,7 +287,7 @@ export const VideoEvidencePlayer = memo<VideoEvidencePlayerProps>()}<Video.Caption />{!onRegion && <Video.CenterPlay />}- <Video.LoadError />+ <VideoLoadFailed player={player} src={src} onRetry={onRefreshSource} /></Video.Frame></div><Video.Controls frameStep className={stylex.props(playerStyles.controls).className} />@@ -300,14 +303,16 @@ export const VideoEvidencePlayer = memo<VideoEvidencePlayerProps>()}</div>{caption && <div style={{ overflowWrap: 'anywhere' }}>{caption}</div>}- <VideoClaimList- chapters={chapters}- onSeek={(seconds) => {- player.pause();- player.seek(seconds);- player.setCaptions(true);- }}- />+ {claimList && (+ <VideoClaimList+ chapters={chapters}+ onSeek={(seconds) => {+ player.pause();+ player.seek(seconds);+ player.setCaptions(true);+ }}+ />+ )}</Flexbox>);},diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoFeedbackNotes.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoFeedbackNotes.tsxindex 53ab1b56be1..02b83f8a688 100644--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoFeedbackNotes.tsx+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoFeedbackNotes.tsx@@ -30,10 +30,10 @@ export const VideoFeedbackNotes = ({ notes }: { notes: AcceptanceReviewAnnotatiocolor: cssVar.colorErrorText,flex: 'none',fontFamily: cssVar.fontFamilyCode,- fontSize: 11,+ fontSize: 12,}}>- <Icon icon={note.time?.end === undefined ? Flag : Repeat} size={11} />+ <Icon icon={note.time?.end === undefined ? Flag : Repeat} size={12} />{note.time? note.time.end === undefined? formatVideoTime(note.time.start)diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoLoadFailed.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoLoadFailed.tsxnew file mode 100644index 00000000000..4fd3a4b35e8--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoLoadFailed.tsx@@ -0,0 +1,93 @@+'use client';++import { Button, Icon, useVideoState, type VideoPlayer } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { Info, RefreshCw } from 'lucide-react';+import { useState } from 'react';+import { useTranslation } from 'react-i18next';++const styles = stylex.create({+ root: {+ position: 'absolute',+ zIndex: 2,+ insetBlockStart: 0,+ insetBlockEnd: 0,+ insetInlineStart: 0,+ insetInlineEnd: 0,+ display: 'flex',+ flexDirection: 'column',+ gap: '4px',+ alignItems: 'center',+ justifyContent: 'center',+ padding: '16px',+ fontSize: '14px',+ lineHeight: '22px',+ color: cssVar.colorText,+ textAlign: 'center',+ backgroundColor: cssVar.colorBgLayout,+ backgroundImage: 'none',+ },+ icon: { color: cssVar.colorWarning },+ title: { fontWeight: 600 },+ body: { margin: 0, color: cssVar.colorTextSecondary },+ actions: {+ display: 'flex',+ gap: '12px',+ alignItems: 'center',+ marginBlockStart: '4px',+ },+ download: {+ fontSize: '12px',+ lineHeight: '20px',+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },+ textDecorationLine: 'underline',+ textUnderlineOffset: '2px',+ },+});++const reloadVideo = (player: VideoPlayer) => {+ // lobe-ui's store resets its own status in reload(), which VideoPlayer does+ // not declare; a bare video.load() would leave the player reporting an error.+ if ('reload' in player && typeof player.reload === 'function') player.reload();+ else player.video?.load();+};++interface VideoLoadFailedProps {+ onRetry?: () => Promise<unknown> | void;+ player: VideoPlayer;+ src: string;+}++export const VideoLoadFailed = ({ onRetry, player, src }: VideoLoadFailedProps) => {+ const { t } = useTranslation('verify');+ const failed = useVideoState(player, (state) => state.status === 'error');+ const [retrying, setRetrying] = useState(false);+ if (!failed) return null;++ const retry = async () => {+ setRetrying(true);+ try {+ await onRetry?.();+ reloadVideo(player);+ } finally {+ setRetrying(false);+ }+ };++ return (+ <div role={'alert'} {...stylex.props(styles.root)}>+ <Icon icon={Info} size={24} {...stylex.props(styles.icon)} />+ <div {...stylex.props(styles.title)}>{t('acceptance.video.story.loadFailedTitle')}</div>+ <p {...stylex.props(styles.body)}>{t('acceptance.video.story.loadFailedBody')}</p>+ <div {...stylex.props(styles.actions)}>+ <Button icon={RefreshCw} loading={retrying} onClick={() => void retry()}>+ {t('acceptance.video.reload')}+ </Button>+ <a href={src} rel={'noreferrer'} target={'_blank'} {...stylex.props(styles.download)}>+ {t('acceptance.video.download')}+ </a>+ </div>+ </div>+ );+};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoNotes.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoNotes.tsxdeleted file mode 100644index 263926830f0..00000000000--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoNotes.tsx+++ /dev/null@@ -1,116 +0,0 @@-'use client';--import { isFullFrameRect } from '@lobechat/const/verify';-import { Flexbox, Icon } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';-import * as stylex from '@stylexjs/stylex';-import { Flag, Repeat } from 'lucide-react';-import { useTranslation } from 'react-i18next';--import type { DraftAnnotationEntry } from '../../Review/rejectDraft';-import { RegionNoteRow } from '../RegionNotes';-import { ClaimLabel } from './ClaimLabel';-import { formatVideoTime, frameOf } from './videoTime';--const styles = stylex.create({- stamp: {- cursor: 'pointer',- display: 'inline-flex',- gap: '4px',- alignItems: 'center',- paddingBlock: '1px',- paddingInline: '6px',- borderStyle: 'none',- borderRadius: '4px',- fontFamily: cssVar.fontFamilyCode,- fontSize: '11px',- fontVariantNumeric: 'tabular-nums',- color: cssVar.colorErrorText,- backgroundColor: { 'default': cssVar.colorErrorBg, ':hover': cssVar.colorErrorBgHover },- backgroundImage: { 'default': 'none', ':hover': 'none' },- },- active: { boxShadow: `0 0 0 1px ${cssVar.colorError}` },- quote: {- display: 'flex',- flexDirection: 'column',- gap: '2px',- paddingBlock: '6px',- paddingInline: '10px',- borderRadius: '6px',- fontSize: '12px',- color: cssVar.colorTextSecondary,- backgroundColor: cssVar.colorFillQuaternary,- backgroundImage: 'none',- },-});--interface VideoNotesProps {- activeNoteKey?: number;- notes: DraftAnnotationEntry[];- onChange: (key: number, comment: string) => void;- onFocusNote: (note: DraftAnnotationEntry) => void;- onRemove: (key: number) => void;-}--/**- * The notes on the video on screen, in the order they occur. Each names its- * frame or span — clicking it seeks there — and a dispute quotes the agent's- * claim it answers, so the note reads on its own in the next round.- */-export const VideoNotes = ({- activeNoteKey,- notes,- onChange,- onFocusNote,- onRemove,-}: VideoNotesProps) => {- const { t } = useTranslation('verify');- const sorted = notes.filter((note) => note.time).sort((a, b) => a.time!.start - b.time!.start);-- return sorted.map((note, index) => {- const time = note.time!;- const span = time.end !== undefined;- let placeholder = t('acceptance.video.notePlaceholderFrame');- if (note.disputes) placeholder = t('acceptance.video.notePlaceholderDispute');- else if (span) placeholder = t('acceptance.video.notePlaceholderRange');- let detail = t('acceptance.video.frame', { frame: frameOf(time.start) });- if (span)- detail = t('acceptance.video.rangeSeconds', { seconds: (time.end! - time.start).toFixed(1) });- else if (!isFullFrameRect(note.rect)) detail += ` · ${t('acceptance.video.circled')}`;-- return (- <RegionNoteRow- autoFocus={note.key === activeNoteKey && !note.comment}- index={index + 1}- key={note.key}- placeholder={placeholder}- value={note.comment}- caption={- <Flexbox gap={6}>- <Flexbox horizontal align={'center'} gap={6}>- <button- {...stylex.props(styles.stamp, note.key === activeNoteKey && styles.active)}- type={'button'}- onClick={() => onFocusNote(note)}- >- <Icon icon={span ? Repeat : Flag} size={11} />- {span- ? `${formatVideoTime(time.start)} – ${formatVideoTime(time.end!)}`- : formatVideoTime(time.start)}- </button>- <span style={{ color: cssVar.colorTextTertiary, fontSize: 11 }}>{detail}</span>- </Flexbox>- {note.disputes && (- <div {...stylex.props(styles.quote)}>- <ClaimLabel kind={note.disputes.kind} />- <div>{note.disputes.note}</div>- </div>- )}- </Flexbox>- }- onChange={(comment) => onChange(note.key, comment)}- onRemove={() => onRemove(note.key)}- />- );- });-};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsxindex 351f2c3e0a2..73a4b39e000 100644--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsx+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsx@@ -2,27 +2,51 @@import { isFullFrameRect } from '@lobechat/const/verify';import type { AcceptanceReviewAnnotation, VerifyEvidenceChapter } from '@lobechat/types';-import { useVideo, useVideoPlayer, useVideoState, Video, type VideoPlayer } from '@lobehub/ui';+import { useVideoPlayer, useVideoState, Video } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import type { PointerEvent as ReactPointerEvent, RefObject } from 'react';-import { memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';-import { useTranslation } from 'react-i18next';+import { memo, useEffect, useMemo, useRef, useState } from 'react';import type { DraftAnnotationEntry } from '../../Review/rejectDraft';-import { type ClaimMarker, noteKeyOf, toClaimMarkers, toNoteMarkers, toSections } from './chapters';+import { toSections } from './chapters';+import { ChapterScrubber } from './ChapterScrubber';import { readStoredRate, storeRate } from './playbackRate';-import { RangeLane, type VideoLoop } from './RangeLane';-import { ReviewTools } from './ReviewTools';+import { AddNoteRow, ReviewControls } from './ReviewControls';+import { buildVideoStory, spanFromFrame, storyNoteId } from './story';import { styles } from './styles';+import { useReviewKeys, type VideoLoop } from './useReviewKeys';+import { useVideoRegionGesture } from './useVideoRegionGesture';import { DraftRegion, FrameRegions } from './VideoChrome';-import { disputesClaim, formatVideoTime, frameOf } from './videoTime';+import { VideoLoadFailed } from './VideoLoadFailed';+import { storyEntryDomId, toReviewStoryNotes, VideoReviewStory } from './VideoReviewStory';+import { VideoStoryCaption } from './VideoStoryCaption';type Rect = AcceptanceReviewAnnotation['rect'];--const RATES = [0.5, 1, 1.5, 2];+type NoteTime = NonNullable<AcceptanceReviewAnnotation['time']>;const local = stylex.create({+ layout: {+ display: 'grid',+ flex: '1',+ gridTemplateRows: 'minmax(0, 1fr)',+ gridTemplateColumns: 'minmax(0, 1fr) 360px',+ gap: '24px',+ minWidth: 0,+ minHeight: 0,+ },+ player: {+ overflow: 'visible',+ display: 'flex',+ flexDirection: 'column',+ minWidth: 0,+ minHeight: 0,+ padding: { 'default': 0, ':fullscreen': '24px' },+ borderRadius: 0,+ lineHeight: 'inherit',+ color: 'inherit',+ backgroundColor: { 'default': 'transparent', ':fullscreen': cssVar.colorBgContainer },+ backgroundImage: 'none',+ },fit: {display: 'flex',flex: '1',@@ -30,108 +54,46 @@ const local = stylex.create({justifyContent: 'center',minHeight: '0',},+ story: {+ overflowY: 'auto',+ minHeight: 0,+ paddingInline: '8px',+ },});-export interface VideoReviewStageHandle {- /** Pause on a note's frame (and select its span) — the notes panel's "go there". */- focusNote: (note: DraftAnnotationEntry) => void;-}-interface VideoReviewStageProps {+ activeNoteKey?: number;chapters: VerifyEvidenceChapter[];- handleRef?: RefObject<VideoReviewStageHandle | null>;notes: DraftAnnotationEntry[];onAddNote: (note: {disputes?: AcceptanceReviewAnnotation['disputes'];rect?: Rect;- time: NonNullable<AcceptanceReviewAnnotation['time']>;- }) => void;+ time: NoteTime;+ }) => number;+ onChangeNote: (key: number, comment: string) => void;/** Re-sign the file link; resolves to the fresh URL, if the evidence still exists. */onRefreshSource?: () => Promise<string | undefined>;+ onRemoveNote: (key: number) => void;onSelectNote: (key: number) => void;src: string;}-const isTyping = (target: EventTarget | null) =>- target instanceof HTMLElement &&- (target.isContentEditable || ['INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName));--const playbackKey = (event: KeyboardEvent, player: VideoPlayer) => {- // A focused button owns Space and Enter — they must activate it, not play.- if (event.target instanceof HTMLButtonElement && (event.key === ' ' || event.key === 'Enter'))- return false;- const { rate, time } = player.getState();- const nextRate = (direction: 1 | -1) => {- const index = RATES.indexOf(rate);- player.setRate(- RATES[Math.min(Math.max((index === -1 ? 1 : index) + direction, 0), RATES.length - 1)],- );- };- switch (event.key.toLowerCase()) {- case ' ':- case 'k': {- player.toggle();- return true;- }- case ',': {- player.step(-1);- return true;- }- case '.': {- player.step(1);- return true;- }- case 'arrowleft': {- player.seek(time - (event.shiftKey ? 5 : 1));- return true;- }- case 'arrowright': {- player.seek(time + (event.shiftKey ? 5 : 1));- return true;- }- case 'j': {- nextRate(-1);- return true;- }- case 'l': {- nextRate(1);- return true;- }- default: {- return false;- }- }-};--const Hint = ({ drafting, flash }: { drafting: boolean; flash: string | null }) => {- const { t } = useTranslation('verify');- const paused = useVideo((state) => state.paused);- const frame = useVideo((state) => (state.paused ? frameOf(state.time) : -1));- const hint =- flash ??- (drafting- ? null- : paused- ? t('acceptance.video.hintPaused', { frame })- : t('acceptance.video.hintPlaying'));- return hint ? <div {...stylex.props(styles.hint)}>{hint}</div> : null;-};--/**- * Where a video is rejected. Pressing on the picture pauses on the frame being- * shown and draws a region on it; M marks the frame without a region; the lane- * under the timeline (or I / O) selects a span that loops while it is judged;- * and an agent claim captioned on screen can be disputed in one click.- */export const VideoReviewStage = memo<VideoReviewStageProps>(- ({ chapters, handleRef, notes, onAddNote, onRefreshSource, onSelectNote, src: initialSrc }) => {- const { t } = useTranslation('verify');+ ({+ activeNoteKey,+ chapters,+ notes,+ onAddNote,+ onChangeNote,+ onRefreshSource,+ onRemoveNote,+ onSelectNote,+ src: initialSrc,+ }) => {const player = useVideoPlayer();// The modal holds the link it opened with; a re-signed one replaces it here.const [src, setSrc] = useState(initialSrc);const [range, setRange] = useState<VideoLoop | null>(null);- const [loop, setLoop] = useState(true);- const [draft, setDraft] = useState<Rect | null>(null);const [flash, setFlash] = useState<string | null>(null);const [defaultRate] = useState(readStoredRate);const ready = useVideoState(player, (state) => state.status === 'ready');@@ -144,59 +106,52 @@ export const VideoReviewStage = memo<VideoReviewStageProps>(};useEffect(() => () => clearTimeout(flashTimer.current), []);- const loopRange = loop ? range : null;useEffect(() => {- if (!loopRange) return;+ if (!range) return;return player.subscribe((state) => {- if (!state.paused && state.time >= loopRange.end) player.seek(loopRange.start);+ if (!state.paused && state.time >= range.end) player.seek(range.start);});- }, [player, loopRange]);+ }, [player, range]);- const timed = useMemo(() => notes.filter((note) => note.time), [notes]);- const timedNotes = useMemo(- () =>- timed.map((note) => ({- comment: note.comment,- end: note.time!.end,- key: note.key,- start: note.time!.start,- })),- [timed],- );const sections = useMemo(() => toSections(chapters), [chapters]);- const markers = useMemo(- () => [- ...toClaimMarkers(chapters, (kind) => t(`acceptance.video.claim.${kind}`)),- ...toNoteMarkers(timedNotes),- ],- [chapters, t, timedNotes],+ const story = useMemo(+ () => buildVideoStory(chapters, toReviewStoryNotes(notes)),+ [chapters, notes],);- const regions = useMemo(- () =>- timed- .filter((note) => !isFullFrameRect(note.rect))- .map((note) => ({- comment: note.comment,- key: note.key,- rect: note.rect,- start: note.time!.start,- })),- [timed],+ const regions = story.flatMap((entry) =>+ entry.type === 'note' && !isFullFrameRect(entry.note.source.rect)+ ? [+ {+ key: String(entry.note.key),+ label: entry.index,+ rect: entry.note.source.rect,+ start: entry.time,+ },+ ]+ : [],);+ const seek = (seconds: number) => {+ player.pause();+ player.seek(seconds);+ };+const focusNote = (note: DraftAnnotationEntry) => {if (!note.time) return;- player.pause();- player.seek(note.time.start);+ seek(note.time.start);setRange(note.time.end === undefined ? null : { end: note.time.end, start: note.time.start });onSelectNote(note.key);};- useImperativeHandle(handleRef, () => ({ focusNote }));++ const revealEntry = (id: string) =>+ requestAnimationFrame(() =>+ document.getElementById(storyEntryDomId(id))?.scrollIntoView({ block: 'nearest' }),+ );const markFrame = () => {const start = player.getState().time;player.pause();- onAddNote({ time: { start } });+ revealEntry(storyNoteId(onAddNote({ time: { start } })));};const commentRange = () => {@@ -205,191 +160,108 @@ export const VideoReviewStage = memo<VideoReviewStageProps>(setRange(null);};- // The modal is the review: keys act whenever the reviewer is not typing.- const keyStateRef = useRef({ markFrame, range });- keyStateRef.current = { markFrame, range };- useEffect(() => {- const onKey = (event: KeyboardEvent) => {- if (isTyping(event.target) || event.metaKey || event.ctrlKey || event.altKey) return;- const state = player.getState();- if (state.status !== 'ready') return;- const { range: current } = keyStateRef.current;- const now = state.time;- let handled = true;- switch (event.key.toLowerCase()) {- case 'm': {- keyStateRef.current.markFrame();- break;- }- case 'i': {- // Open-ended until O: a provisional end would loop playback short- // of the moment the reviewer is waiting for.- const end = current && current.end > now ? current.end : state.duration;- setRange({ end, start: now });- showFlash(t('acceptance.video.inPoint', { time: formatVideoTime(now) }));- break;- }- case 'o': {- const start = current?.start ?? Math.max(0, now - 1);- if (now > start) {- setRange({ end: now, start });- showFlash(t('acceptance.video.outPoint', { time: formatVideoTime(now) }));- }- break;- }- case 'escape': {- if (!current) return;- setRange(null);- break;- }- default: {- handled = playbackKey(event, player);- }- }- if (handled) {- event.preventDefault();- event.stopPropagation();- }- };- window.addEventListener('keydown', onKey, true);- return () => window.removeEventListener('keydown', onKey, true);- }, [player, t]);-- /** Press pauses on the frame on screen; a drag circles a region on it; a click plays. */- const onStageDown = (event: ReactPointerEvent<HTMLDivElement>) => {- const element = event.currentTarget;- const box = element.getBoundingClientRect();- const origin = {- x: (event.clientX - box.left) / box.width,- y: (event.clientY - box.top) / box.height,- };- const wasPlaying = !player.getState().paused;- // The frame on screen at the press is the one being circled.- const start = player.getState().time;- player.pause();- element.setPointerCapture(event.pointerId);- let current: Rect | null = null;- const clamp = (value: number) => Math.min(Math.max(value, 0), 1);- const move = (next: PointerEvent) => {- const x = clamp((next.clientX - box.left) / box.width);- const y = clamp((next.clientY - box.top) / box.height);- current = {- height: Math.abs(y - origin.y),- width: Math.abs(x - origin.x),- x: Math.min(x, origin.x),- y: Math.min(y, origin.y),- };- setDraft(current);- };- const up = () => {- element.removeEventListener('pointermove', move);- element.removeEventListener('pointerup', up);- setDraft(null);- const rect = current as Rect | null;- if (rect && rect.width > 0.02 && rect.height > 0.02) {- onAddNote({ rect, time: { start } });- } else if (!wasPlaying) {- player.toggle();- }- };- element.addEventListener('pointermove', move);- element.addEventListener('pointerup', up);+ const retime = (note: DraftAnnotationEntry, time: NoteTime) => {+ onRemoveNote(note.key);+ onChangeNote(onAddNote({ disputes: note.disputes, rect: note.rect, time }), note.comment);+ setRange(time.end === undefined ? null : { end: time.end, start: time.start });};- const dispute = (marker: ClaimMarker) => {- const { claim } = marker;- const disputed = notes.some((note) => disputesClaim(note.disputes, claim));- return (- <button- {...stylex.props(styles.dispute)}- disabled={disputed}- type={'button'}- onClick={() => {- player.pause();- player.seek(claim.t);- onAddNote({- disputes: { kind: claim.kind, note: claim.note, t: claim.t },- time: { start: claim.t },- });- }}- >- {disputed ? t('acceptance.video.disputed') : t('acceptance.video.dispute')}- </button>- );- };+ useReviewKeys(player, {+ onFlash: showFlash,+ onMarkFrame: markFrame,+ onRange: setRange,+ range,+ });++ const gesture = useVideoRegionGesture(player, onAddNote);return (- <Video.Root- defaultPlaybackRate={defaultRate}- markers={markers}- player={player}- preload={'auto'}- sections={sections}- src={src}- style={{- background: 'transparent',- borderRadius: 0,- color: 'inherit',- display: 'flex',- flex: 1,- flexDirection: 'column',- gap: 10,- lineHeight: 'inherit',- minHeight: 0,- minWidth: 0,- overflow: 'visible',- }}- onRateChange={storeRate}- onMarkerClick={(marker) => {- const key = noteKeyOf(marker);- const entry =- key === undefined ? undefined : notes.find((note) => String(note.key) === key);- if (entry) focusNote(entry);- }}- onRetry={async () => {- const fresh = await onRefreshSource?.();- if (fresh && fresh !== src) setSrc(fresh);- }}- >- <div {...stylex.props(local.fit)}>- <Video.Frame- style={{- borderRadius: cssVar.borderRadiusLG,- height: '100%',- maxWidth: '100%',- width: 'auto',- }}- >- {ready && (- <div {...stylex.props(styles.overlay, styles.drawable)} onPointerDown={onStageDown}>- <FrameRegions regions={regions} />- {draft && <DraftRegion rect={draft} />}- <Hint drafting={Boolean(draft)} flash={flash} />- </div>- )}- {!draft && (- <Video.Caption- action={(marker) => ('claim' in marker ? dispute(marker as ClaimMarker) : null)}+ <div {...stylex.props(local.layout)}>+ <Video.Root+ className={stylex.props(local.player).className}+ defaultPlaybackRate={defaultRate}+ player={player}+ preload={'auto'}+ sections={sections}+ src={src}+ onRateChange={storeRate}+ >+ <div {...stylex.props(local.fit)}>+ <Video.Frame+ style={{+ borderRadius: cssVar.borderRadiusLG,+ height: '100%',+ maxWidth: '100%',+ width: 'auto',+ }}+ >+ {ready && (+ <div+ {...stylex.props(styles.overlay, styles.drawable)}+ onPointerDown={gesture.onPointerDown}+ >+ <FrameRegions+ active={activeNoteKey === undefined ? undefined : String(activeNoteKey)}+ regions={regions}+ />+ {gesture.draft && <DraftRegion rect={gesture.draft} />}+ {flash && !gesture.draft && <div {...stylex.props(styles.hint)}>{flash}</div>}+ {!gesture.draft && <VideoStoryCaption player={player} story={story} />}+ </div>+ )}+ <VideoLoadFailed+ player={player}+ src={src}+ onRetry={async () => {+ const fresh = await onRefreshSource?.();+ if (fresh && fresh !== src) setSrc(fresh);+ }}/>- )}- <Video.LoadError />- </Video.Frame>+ </Video.Frame>+ </div>+ <ChapterScrubber+ chapters={chapters}+ player={player}+ range={range}+ story={story}+ onPin={(entry) => {+ if (entry.type === 'note') focusNote(entry.note.source);+ else seek(entry.time);+ revealEntry(entry.id);+ }}+ />+ <ReviewControls captions={story.length > 0} player={player} />+ <AddNoteRow+ player={player}+ range={range}+ onAdd={range ? commentRange : markFrame}+ onClearRange={() => setRange(null)}+ />+ </Video.Root>+ <div {...stylex.props(local.story)}>+ <VideoReviewStory+ activeNoteKey={activeNoteKey}+ player={player}+ story={story}+ onChangeNote={onChangeNote}+ onFocusNote={focusNote}+ onRemoveNote={onRemoveNote}+ onSeek={seek}+ onSingleFrame={(note) => retime(note, { start: note.time!.start })}+ onCoverSpan={(note) => {+ const { duration, time } = player.getState();+ retime(note, spanFromFrame(note.time!.start, time, duration));+ }}+ onDispute={(claim) => {+ seek(claim.t);+ onAddNote({+ disputes: { kind: claim.kind, note: claim.note, t: claim.t },+ time: { start: claim.t },+ });+ }}+ /></div>- <Video.Controls frameStep style={{ borderRadius: cssVar.borderRadiusLG }}>- <Video.Timeline>- <RangeLane notes={timedNotes} range={range} onRange={setRange} onSeek={player.seek} />- </Video.Timeline>- </Video.Controls>- <ReviewTools- loop={loop}- range={range}- ready={ready}- onClearRange={() => setRange(null)}- onCommentRange={commentRange}- onMarkFrame={markFrame}- onToggleLoop={() => setLoop((value) => !value)}- />- </Video.Root>+ </div>);},);diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStory.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStory.tsxnew file mode 100644index 00000000000..3d64e92d795--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStory.tsx@@ -0,0 +1,236 @@+'use client';++import { isFullFrameRect } from '@lobechat/const/verify';+import type { VerifyEvidenceChapter } from '@lobechat/types';+import { Text, TextArea, useVideoState, type VideoPlayer } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { useTranslation } from 'react-i18next';++import type { DraftAnnotationEntry } from '../../Review/rejectDraft';+import {+ activeStoryEntryId,+ type StoryClaimEntry,+ type StoryEntry,+ type StoryNote,+ type StoryNoteEntry,+} from './story';+import {+ StoryBadge,+ StoryChapter,+ StoryDot,+ StoryItem,+ StoryLink,+ StoryList,+ StoryText,+ StoryTitle,+ StoryWho,+} from './VideoStory';+import { formatVideoTime } from './videoTime';++const styles = stylex.create({+ root: {+ display: 'flex',+ flexDirection: 'column',+ gap: '12px',+ },+ quote: {+ display: 'block',+ marginBlockStart: '4px',+ paddingBlock: '4px',+ paddingInline: '12px',+ borderRadius: '8px',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ backgroundColor: cssVar.colorFillQuaternary,+ backgroundImage: 'none',+ },+});++export type ReviewStoryNote = StoryNote & { source: DraftAnnotationEntry };++export const storyEntryDomId = (id: string) => `video-story-${id}`;++export const toReviewStoryNotes = (notes: DraftAnnotationEntry[]): ReviewStoryNote[] =>+ notes.flatMap((note) =>+ note.time+ ? [+ {+ disputes: note.disputes,+ end: note.time.end,+ key: note.key,+ source: note,+ start: note.time.start,+ },+ ]+ : [],+ );++interface VideoReviewStoryProps {+ activeNoteKey?: number;+ onChangeNote: (key: number, comment: string) => void;+ onCoverSpan: (note: DraftAnnotationEntry) => void;+ onDispute: (claim: VerifyEvidenceChapter) => void;+ onFocusNote: (note: DraftAnnotationEntry) => void;+ onRemoveNote: (key: number) => void;+ onSeek: (seconds: number) => void;+ onSingleFrame: (note: DraftAnnotationEntry) => void;+ player: VideoPlayer;+ story: StoryEntry<ReviewStoryNote>[];+}++export const VideoReviewStory = ({+ activeNoteKey,+ onChangeNote,+ onCoverSpan,+ onDispute,+ onFocusNote,+ onRemoveNote,+ onSeek,+ onSingleFrame,+ player,+ story,+}: VideoReviewStoryProps) => {+ const { t } = useTranslation('verify');+ const activeId = useVideoState(player, (state) => activeStoryEntryId(story, state.time));++ const field = (note: DraftAnnotationEntry, placeholder: string) => (+ <TextArea+ aria-label={placeholder}+ autoFocus={note.key === activeNoteKey}+ autoSize={{ maxRows: 5, minRows: 1 }}+ placeholder={placeholder}+ value={note.comment}+ variant={'filled'}+ onChange={(event) => onChangeNote(note.key, event.target.value)}+ onFocus={() => {+ if (note.key !== activeNoteKey) onFocusNote(note);+ }}+ />+ );++ const claimItem = (entry: StoryClaimEntry<ReviewStoryNote>) => {+ const dispute = entry.dispute?.source;+ const label = t(`acceptance.video.claim.${entry.claim.kind}`);+ return (+ <StoryItem+ active={entry.id === activeId}+ id={storyEntryDomId(entry.id)}+ key={entry.id}+ marker={<StoryDot kind={entry.claim.kind} />}+ time={entry.time}+ actions={+ dispute ? (+ <StoryLink onClick={() => onRemoveNote(dispute.key)}>+ {t('acceptance.video.story.withdraw')}+ </StoryLink>+ ) : (+ <StoryLink onClick={() => onDispute(entry.claim)}>+ {t('acceptance.video.dispute')}+ </StoryLink>+ )+ }+ head={+ <>+ <StoryWho>{dispute ? `${label} · ${t('acceptance.video.disputed')}` : label}</StoryWho>+ <StoryText>{entry.claim.note}</StoryText>+ </>+ }+ onSeek={() => (dispute ? onFocusNote(dispute) : onSeek(entry.time))}+ >+ {dispute && field(dispute, t('acceptance.video.notePlaceholderDispute'))}+ </StoryItem>+ );+ };++ const noteItem = (entry: StoryNoteEntry<ReviewStoryNote>) => {+ const note = entry.note.source;+ const { end } = entry.note;+ const span = end !== undefined;+ let detail = t('acceptance.video.story.noteFrame');+ let placeholder = t('acceptance.video.notePlaceholderFrame');+ if (span) {+ detail = t('acceptance.video.story.noteSpan', {+ end: formatVideoTime(end),+ start: formatVideoTime(entry.time),+ });+ placeholder = t('acceptance.video.notePlaceholderRange');+ } else if (!isFullFrameRect(note.rect)) detail = t('acceptance.video.story.noteCircled');+ if (note.disputes) placeholder = t('acceptance.video.notePlaceholderDispute');++ return (+ <StoryItem+ active={entry.id === activeId}+ id={storyEntryDomId(entry.id)}+ key={entry.id}+ marker={<StoryBadge>{entry.index}</StoryBadge>}+ time={entry.time}+ actions={+ <>+ {span ? (+ <StoryLink onClick={() => onSingleFrame(note)}>+ {t('acceptance.video.story.singleFrame')}+ </StoryLink>+ ) : (+ <StoryLink onClick={() => onCoverSpan(note)}>+ {t('acceptance.video.story.coverSpan')}+ </StoryLink>+ )}+ <StoryLink onClick={() => onRemoveNote(note.key)}>+ {t('acceptance.video.story.delete')}+ </StoryLink>+ </>+ }+ head={+ <>+ <StoryWho>{`${t('acceptance.video.story.yourNote')} · ${detail}`}</StoryWho>+ {note.disputes && (+ <StoryText xstyle={styles.quote}>+ {`${t(`acceptance.video.claim.${note.disputes.kind}`)} · ${note.disputes.note ?? ''}`}+ </StoryText>+ )}+ </>+ }+ onSeek={() => onFocusNote(note)}+ >+ {field(note, placeholder)}+ </StoryItem>+ );+ };++ return (+ <div {...stylex.props(styles.root)}>+ <StoryTitle>{t('acceptance.video.story.title')}</StoryTitle>+ {story.length === 0 ? (+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.video.story.empty')}+ </Text>+ ) : (+ <StoryList>+ {story.map((entry, index) => {+ switch (entry.type) {+ case 'chapter': {+ return (+ <StoryChapter+ first={index === 0}+ key={entry.id}+ label={entry.label}+ time={entry.time}+ onSeek={() => onSeek(entry.time)}+ />+ );+ }+ case 'claim': {+ return claimItem(entry);+ }+ case 'note': {+ return noteItem(entry);+ }+ }+ })}+ </StoryList>+ )}+ </div>+ );+};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoStory.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoStory.tsxnew file mode 100644index 00000000000..6d7e6f3f5cd--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoStory.tsx@@ -0,0 +1,279 @@+'use client';++import type { VerifyEvidenceChapterKind } from '@lobechat/types';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import type { StyleXStyles } from '@stylexjs/stylex';+import * as stylex from '@stylexjs/stylex';+import type { ReactNode } from 'react';++import { CLAIM_COLOR } from './styles';+import { formatVideoClock, formatVideoTime } from './videoTime';++const styles = stylex.create({+ title: {+ fontSize: '14px',+ fontWeight: 600,+ lineHeight: '22px',+ color: cssVar.colorText,+ },+ list: {+ display: 'flex',+ flexDirection: 'column',+ },+ chapter: {+ cursor: 'pointer',+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ width: '100%',+ margin: 0,+ paddingBlockStart: '12px',+ paddingBlockEnd: '4px',+ paddingInline: 0,+ borderBlockStartWidth: '1px',+ borderBlockEndWidth: 0,+ borderInlineWidth: 0,+ borderStyle: 'solid',+ borderColor: cssVar.colorBorderSecondary,+ borderRadius: 0,+ fontFamily: 'inherit',+ fontSize: '12px',+ fontWeight: 500,+ lineHeight: '20px',+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },+ textAlign: 'start',+ backgroundColor: 'transparent',+ backgroundImage: 'none',+ outline: {+ 'default': 'none',+ ':focus-visible': `2px solid ${cssVar.colorPrimaryBorder}`,+ },+ appearance: 'none',+ },+ chapterFirst: {+ paddingBlockStart: 0,+ borderBlockStartWidth: 0,+ },+ mono: {+ fontFamily: cssVar.fontFamilyCode,+ fontVariantNumeric: 'tabular-nums',+ },+ chapterTime: { color: cssVar.colorTextTertiary },+ item: {+ display: 'grid',+ gridTemplateColumns: '20px 56px minmax(0, 1fr)',+ rowGap: '4px',+ columnGap: '8px',+ alignItems: 'start',+ marginInline: '-8px',+ padding: '8px',+ borderRadius: '8px',+ backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillQuaternary },+ backgroundImage: 'none',+ },+ itemActive: {+ backgroundColor: {+ 'default': cssVar.colorFillQuaternary,+ ':hover': cssVar.colorFillTertiary,+ },+ },+ head: {+ cursor: 'pointer',+ userSelect: 'text',+ display: 'grid',+ gridColumnStart: 1,+ gridColumnEnd: -1,+ gridTemplateColumns: 'subgrid',+ alignItems: 'start',+ margin: 0,+ padding: 0,+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '4px',+ font: 'inherit',+ color: cssVar.colorText,+ textAlign: 'start',+ backgroundColor: 'transparent',+ backgroundImage: 'none',+ outline: {+ 'default': 'none',+ ':focus-visible': `2px solid ${cssVar.colorPrimaryBorder}`,+ },+ outlineOffset: '2px',+ appearance: 'none',+ },+ marker: {+ display: 'grid',+ placeItems: 'center',+ height: '22px',+ },+ time: {+ fontSize: '12px',+ lineHeight: '22px',+ color: cssVar.colorTextTertiary,+ },+ body: {+ display: 'flex',+ flexDirection: 'column',+ minWidth: 0,+ },+ below: {+ gridColumnStart: 3,+ minWidth: 0,+ },+ actions: {+ display: 'flex',+ flexWrap: 'wrap',+ gridColumnStart: 3,+ columnGap: '12px',+ rowGap: '4px',+ },+ who: {+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ text: {+ overflowWrap: 'anywhere',+ fontSize: '14px',+ lineHeight: '22px',+ color: cssVar.colorText,+ },+ dot: {+ flex: 'none',+ width: '8px',+ height: '8px',+ borderRadius: '50%',+ },+ dotColor: (color: string) => ({ backgroundColor: color }),+ badge: {+ flex: 'none',+ width: '20px',+ height: '20px',+ marginBlockStart: '1px',+ borderRadius: '50%',+ fontSize: '12px',+ fontWeight: 600,+ lineHeight: '20px',+ color: cssVar.colorTextLightSolid,+ textAlign: 'center',+ backgroundColor: cssVar.colorError,+ backgroundImage: 'none',+ },+ link: {+ cursor: { 'default': 'pointer', ':disabled': 'default' },+ margin: 0,+ padding: 0,+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '2px',+ fontFamily: 'inherit',+ fontSize: '12px',+ lineHeight: '20px',+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },+ textDecorationLine: 'underline',+ textUnderlineOffset: '2px',+ backgroundColor: 'transparent',+ backgroundImage: 'none',+ outline: {+ 'default': 'none',+ ':focus-visible': `2px solid ${cssVar.colorPrimaryBorder}`,+ },+ outlineOffset: '2px',+ appearance: 'none',+ },+});++export const StoryTitle = ({ children }: { children: ReactNode }) => (+ <div {...stylex.props(styles.title)}>{children}</div>+);++export const StoryList = ({ children }: { children: ReactNode }) => (+ <div {...stylex.props(styles.list)}>{children}</div>+);++interface StoryChapterProps {+ first: boolean;+ label: string;+ onSeek: () => void;+ time: number;+}++export const StoryChapter = ({ first, label, onSeek, time }: StoryChapterProps) => (+ <button+ {...stylex.props(styles.chapter, first && styles.chapterFirst)}+ type={'button'}+ onClick={onSeek}+ >+ <span {...stylex.props(styles.mono, styles.chapterTime)}>{formatVideoClock(time)}</span>+ {label}+ </button>+);++interface StoryItemProps {+ actions?: ReactNode;+ active?: boolean;+ children?: ReactNode;+ expanded?: boolean;+ head: ReactNode;+ id?: string;+ marker: ReactNode;+ onSeek: () => void;+ time: number;+ xstyle?: StyleXStyles;+}++export const StoryItem = ({+ actions,+ active,+ children,+ expanded,+ head,+ id,+ marker,+ onSeek,+ time,+ xstyle,+}: StoryItemProps) => (+ <div {...stylex.props(styles.item, active && styles.itemActive, xstyle)} id={id}>+ <button+ aria-current={active ? 'true' : undefined}+ aria-expanded={expanded}+ {...stylex.props(styles.head)}+ type={'button'}+ onClick={onSeek}+ >+ <span {...stylex.props(styles.marker)}>{marker}</span>+ <span {...stylex.props(styles.mono, styles.time)}>{formatVideoTime(time)}</span>+ <span {...stylex.props(styles.body)}>{head}</span>+ </button>+ {children && <div {...stylex.props(styles.below)}>{children}</div>}+ {actions && <div {...stylex.props(styles.actions)}>{actions}</div>}+ </div>+);++export const StoryWho = ({ children }: { children: ReactNode }) => (+ <span {...stylex.props(styles.who)}>{children}</span>+);++export const StoryText = ({ children, xstyle }: { children: ReactNode; xstyle?: StyleXStyles }) => (+ <span {...stylex.props(styles.text, xstyle)}>{children}</span>+);++export const StoryDot = ({ kind }: { kind: VerifyEvidenceChapterKind }) => (+ <span aria-hidden {...stylex.props(styles.dot, styles.dotColor(CLAIM_COLOR[kind]))} />+);++export const StoryBadge = ({ children, color }: { children: ReactNode; color?: string }) => (+ <span {...stylex.props(styles.badge, color !== undefined && styles.dotColor(color))}>+ {children}+ </span>+);++export const StoryLink = ({ children, onClick }: { children: ReactNode; onClick: () => void }) => (+ <button {...stylex.props(styles.link)} type={'button'} onClick={onClick}>+ {children}+ </button>+);diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoStoryCaption.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoStoryCaption.tsxnew file mode 100644index 00000000000..da1f1ec07e9--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoStoryCaption.tsx@@ -0,0 +1,101 @@+'use client';++import { useVideoState, type VideoPlayer } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import type { ReactNode } from 'react';+import { useTranslation } from 'react-i18next';++import { captionEntriesAt, type StoryEntry, storyEntryCaption } from './story';+import type { ReviewStoryNote } from './VideoReviewStory';+import { StoryBadge, StoryDot } from './VideoStory';++const styles = stylex.create({+ root: {+ pointerEvents: 'none',+ position: 'absolute',+ insetBlockEnd: '12px',+ insetInlineStart: '50%',+ transform: 'translateX(-50%)',+ display: 'flex',+ flexDirection: 'column',+ gap: '8px',+ width: 'max-content',+ maxWidth: 'calc(100% - 24px)',+ paddingBlock: '8px',+ paddingInline: '12px',+ borderRadius: '8px',+ fontSize: '14px',+ lineHeight: '22px',+ color: '#fff',+ overflowWrap: 'anywhere',+ backgroundColor: 'rgb(0 0 0 / 65%)',+ backgroundImage: 'none',+ },+ who: {+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ fontSize: '12px',+ lineHeight: '20px',+ color: 'rgb(255 255 255 / 75%)',+ },+});++const ID_SEPARATOR = '\n';++const noteText = (note: ReviewStoryNote) => note.source.comment;++interface VideoStoryCaptionProps {+ player: VideoPlayer;+ story: StoryEntry<ReviewStoryNote>[];+}++export const VideoStoryCaption = ({ player, story }: VideoStoryCaptionProps) => {+ const { t } = useTranslation('verify');+ const shownIds = useVideoState(player, (state) =>+ state.captions+ ? captionEntriesAt(story, state.time, noteText)+ .map((entry) => entry.id)+ .join(ID_SEPARATOR)+ : '',+ );+ if (!shownIds) return null;++ const ids = new Set(shownIds.split(ID_SEPARATOR));+ const who = (entry: StoryEntry<ReviewStoryNote>): ReactNode => {+ switch (entry.type) {+ case 'chapter': {+ return null;+ }+ case 'claim': {+ return (+ <span {...stylex.props(styles.who)}>+ <StoryDot kind={entry.claim.kind} />+ {t(`acceptance.video.claim.${entry.claim.kind}`)}+ </span>+ );+ }+ case 'note': {+ return (+ <span {...stylex.props(styles.who)}>+ <StoryBadge>{entry.index}</StoryBadge>+ {t('acceptance.video.story.yourNote')}+ </span>+ );+ }+ }+ };++ return (+ <div aria-live={'polite'} {...stylex.props(styles.root)}>+ {story+ .filter((entry) => ids.has(entry.id))+ .map((entry) => (+ <div key={entry.id}>+ {who(entry)}+ <div>{storyEntryCaption(entry, noteText)}</div>+ </div>+ ))}+ </div>+ );+};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/chapterScrubberStyles.ts b/src/features/Acceptance/Viewer/Evidence/Video/chapterScrubberStyles.tsnew file mode 100644index 00000000000..010f83e37ac--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/chapterScrubberStyles.ts@@ -0,0 +1,147 @@+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';++export const chapterScrubberStyles = stylex.create({+ root: {+ userSelect: 'none',+ position: 'relative',+ flex: 'none',+ paddingBlockStart: '21px',+ },+ track: {+ touchAction: 'none',+ cursor: 'pointer',+ position: 'relative',+ height: '20px',+ borderRadius: '4px',+ outline: {+ 'default': 'none',+ ':focus-visible': `2px solid ${cssVar.colorPrimaryBorder}`,+ },+ },+ segment: {+ pointerEvents: 'none',+ position: 'absolute',+ insetBlockStart: '7px',+ overflow: 'hidden',+ height: '6px',+ borderRadius: '3px',+ backgroundColor: cssVar.colorFill,+ backgroundImage: 'none',+ },+ played: {+ height: '100%',+ backgroundColor: cssVar.colorPrimary,+ backgroundImage: 'none',+ },+ noteSpan: {+ pointerEvents: 'none',+ position: 'absolute',+ insetBlockStart: '15px',+ height: '2px',+ borderRadius: '1px',+ backgroundColor: cssVar.colorError,+ backgroundImage: 'none',+ },+ range: {+ pointerEvents: 'none',+ position: 'absolute',+ insetBlockStart: '3px',+ height: '14px',+ borderRadius: '4px',+ backgroundColor: `color-mix(in srgb, ${cssVar.colorWarning} 25%, transparent)`,+ backgroundImage: 'none',+ boxShadow: `inset 0 0 0 1px ${cssVar.colorWarning}`,+ },+ head: {+ pointerEvents: 'none',+ position: 'absolute',+ insetBlockStart: '4px',+ width: '12px',+ height: '12px',+ marginInlineStart: '-6px',+ borderRadius: '50%',+ backgroundColor: cssVar.colorPrimary,+ backgroundImage: 'none',+ boxShadow: `0 0 0 2px ${cssVar.colorBgElevated}`,+ },+ pin: {+ cursor: 'pointer',+ position: 'absolute',+ zIndex: 1,+ display: 'grid',+ placeItems: 'center',+ margin: 0,+ padding: 0,+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '50%',+ fontFamily: 'inherit',+ backgroundColor: 'transparent',+ backgroundImage: 'none',+ outline: {+ 'default': 'none',+ ':focus-visible': `2px solid ${cssVar.colorPrimaryBorder}`,+ },+ appearance: 'none',+ },+ notePin: {+ insetBlockStart: '4px',+ width: '20px',+ height: '20px',+ marginInlineStart: '-10px',+ fontSize: '12px',+ fontWeight: 600,+ lineHeight: '20px',+ color: cssVar.colorTextLightSolid,+ backgroundColor: cssVar.colorError,+ },+ claimPin: {+ insetBlockStart: '7px',+ width: '16px',+ height: '16px',+ marginInlineStart: '-8px',+ },+ claimDot: {+ width: '8px',+ height: '8px',+ borderRadius: '50%',+ },+ claimColor: (color: string) => ({ backgroundColor: color }),+ labels: {+ position: 'relative',+ height: '20px',+ marginBlockStart: '-3px',+ },+ label: {+ cursor: 'pointer',+ position: 'absolute',+ insetBlockStart: 0,+ overflow: 'hidden',+ margin: 0,+ padding: 0,+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '2px',+ fontFamily: 'inherit',+ fontSize: '12px',+ lineHeight: '20px',+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },+ textAlign: 'start',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ backgroundColor: 'transparent',+ backgroundImage: 'none',+ outline: {+ 'default': 'none',+ ':focus-visible': `2px solid ${cssVar.colorPrimaryBorder}`,+ },+ appearance: 'none',+ },+ labelCurrent: {+ fontWeight: 500,+ color: { 'default': cssVar.colorText, ':hover': cssVar.colorText },+ },+});diff --git a/src/features/Acceptance/Viewer/Evidence/Video/story.test.ts b/src/features/Acceptance/Viewer/Evidence/Video/story.test.tsnew file mode 100644index 00000000000..9fe90cc7c00--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/story.test.ts@@ -0,0 +1,312 @@+import type { VerifyEvidenceChapter } from '@lobechat/types';+import { describe, expect, it } from 'vitest';++import {+ activeStoryEntryId,+ buildVideoStory,+ captionEntriesAt,+ fanOutPins,+ spanFromFrame,+ storyEntryCaption,+ type StoryNote,+ toScrubberSegments,+} from './story';++const chapters: VerifyEvidenceChapter[] = [+ { kind: 'check', note: 'Range still reads 30 days after returning.', t: 9.2 },+ { kind: 'step', label: 'Open Balance', t: 5 },+ { kind: 'flag', note: 'The range may reset when the tab remounts.', t: 8.1 },+ { kind: 'step', label: 'Select 30 days', t: 0 },+ { kind: 'step', label: 'Back to Usage', t: 8 },+ { kind: 'check', note: 'Range reads 30 days before the switch.', t: 4 },+];++const note = (key: number, start: number, extra: Partial<StoryNote> = {}): StoryNote => ({+ key,+ start,+ ...extra,+});++const shape = (entries: ReturnType<typeof buildVideoStory>) =>+ entries.map((entry) => {+ switch (entry.type) {+ case 'chapter': {+ return `chapter ${entry.time} ${entry.label}`;+ }+ case 'claim': {+ return `${entry.claim.kind} ${entry.time}${entry.dispute ? ' disputed' : ''}`;+ }+ case 'note': {+ return `note#${entry.index} ${entry.time}`;+ }+ }+ });++describe('buildVideoStory', () => {+ it('interleaves chapters, agent claims and reviewer notes in playing order', () => {+ expect(shape(buildVideoStory(chapters, [note(2, 9.5), note(1, 6.4)]))).toEqual([+ 'chapter 0 Select 30 days',+ 'check 4',+ 'chapter 5 Open Balance',+ 'note#1 6.4',+ 'chapter 8 Back to Usage',+ 'flag 8.1',+ 'check 9.2',+ 'note#2 9.5',+ ]);+ });++ it('opens a moment with its chapter, then the claim, then the note about it', () => {+ const story = buildVideoStory(+ [+ { kind: 'check', note: 'loaded', t: 5 },+ { kind: 'step', label: 'Open', t: 5 },+ ],+ [note(1, 5)],+ );+ expect(story.map((entry) => entry.type)).toEqual(['chapter', 'claim', 'note']);+ });++ it('folds a dispute into the claim it answers instead of listing it twice', () => {+ const disputes = { kind: 'check' as const, note: chapters[0].note, t: 9.2 };+ const story = buildVideoStory(chapters, [note(7, 9.2, { disputes }), note(8, 6.4)]);++ expect(shape(story)).toEqual([+ 'chapter 0 Select 30 days',+ 'check 4',+ 'chapter 5 Open Balance',+ 'note#1 6.4',+ 'chapter 8 Back to Usage',+ 'flag 8.1',+ 'check 9.2 disputed',+ ]);+ const claim = story.find((entry) => entry.type === 'claim' && entry.dispute);+ expect(claim?.type === 'claim' && claim.dispute?.key).toBe(7);+ });++ it('keeps a dispute whose claim is gone as a note of its own', () => {+ const disputes = { kind: 'flag' as const, note: 'removed in a later round', t: 3 };+ expect(shape(buildVideoStory(chapters.slice(3), [note(1, 3, { disputes })]))).toEqual([+ 'chapter 0 Select 30 days',+ 'note#1 3',+ 'check 4',+ 'chapter 8 Back to Usage',+ ]);+ });++ it('settles one of two identical-looking claims per dispute', () => {+ const twin: VerifyEvidenceChapter = { kind: 'check', note: 'same', t: 2 };+ const story = buildVideoStory([twin, { ...twin }], [note(1, 2, { disputes: twin })]);+ expect(shape(story)).toEqual(['check 2 disputed', 'check 2']);+ });++ it('numbers notes drawn on one frame in the order they were made', () => {+ const story = buildVideoStory([], [note(11, 3), note(12, 3), note(10, 1)]);+ expect(story.map((entry) => entry.type === 'note' && [entry.note.key, entry.index])).toEqual([+ [10, 1],+ [11, 2],+ [12, 3],+ ]);+ });++ it('gives every entry a distinct id', () => {+ const twin: VerifyEvidenceChapter = { kind: 'check', note: 'same', t: 2 };+ const ids = buildVideoStory(+ [twin, { ...twin }, { kind: 'step', label: 'A', t: 2 }],+ [note(1, 2)],+ ).map((entry) => entry.id);+ expect(new Set(ids).size).toBe(ids.length);+ });+});++describe('activeStoryEntryId', () => {+ const story = buildVideoStory(chapters, [note(1, 6.4, { end: 7.5 })]);++ it('is nothing before the first claim or note', () => {+ expect(activeStoryEntryId(story, 2)).toBeUndefined();+ });++ it('follows the playhead to the latest claim or note, never a chapter heading', () => {+ expect(activeStoryEntryId(story, 4.5)).toBe(story[1].id);+ expect(activeStoryEntryId(story, 5.5)).toBe(story[1].id);+ expect(activeStoryEntryId(story, 6.4)).toBe('note-1');+ expect(activeStoryEntryId(story, 8.5)).toBe(story[5].id);+ });++ it('lands on an entry when the player seeks to its exact frame', () => {+ expect(activeStoryEntryId(story, 8.1 - 1e-4)).toBe(story[5].id);+ });+});++describe('toScrubberSegments', () => {+ it('splits the recording at each step and ends the last one at the duration', () => {+ expect(toScrubberSegments(chapters, 14)).toEqual([+ { end: 5, label: 'Select 30 days', start: 0 },+ { end: 8, label: 'Open Balance', start: 5 },+ { end: 14, label: 'Back to Usage', start: 8 },+ ]);+ });++ it('leads with an unnamed stretch when the first step starts late', () => {+ expect(toScrubberSegments([{ kind: 'step', label: 'Open', t: 2 }], 10)).toEqual([+ { end: 2, start: 0 },+ { end: 10, label: 'Open', start: 2 },+ ]);+ });++ it('is one unnamed bar without steps, and nothing before the duration is known', () => {+ expect(toScrubberSegments([{ kind: 'check', note: 'x', t: 1 }], 10)).toEqual([+ { end: 10, start: 0 },+ ]);+ expect(toScrubberSegments(chapters, 0)).toEqual([]);+ expect(toScrubberSegments(chapters, Number.NaN)).toEqual([]);+ });++ it('drops steps past the end and steps sharing a start', () => {+ expect(+ toScrubberSegments(+ [+ { kind: 'step', label: 'A', t: 0 },+ { kind: 'step', label: 'B', t: 0 },+ { kind: 'step', label: 'Late', t: 30 },+ ],+ 10,+ ),+ ).toEqual([{ end: 10, label: 'A', start: 0 }]);+ });+});++describe('spanFromFrame', () => {+ it('runs from the marked frame to the playhead when the playhead is past it', () => {+ expect(spanFromFrame(6.4, 8, 14)).toEqual({ end: 8, start: 6.4 });+ });++ it('covers one second when the playhead is still on the frame', () => {+ expect(spanFromFrame(6.4, 6.4, 14)).toEqual({ end: 7.4, start: 6.4 });+ expect(spanFromFrame(6.4, 2, 14)).toEqual({ end: 7.4, start: 6.4 });+ });++ it('never runs past the end of the recording', () => {+ expect(spanFromFrame(13.6, 13.6, 14)).toEqual({ end: 14, start: 13.6 });+ });+});+describe('captionEntriesAt', () => {+ const comments: Record<string, string> = { 1: 'The selector already reads 7 days.', 2: ' ' };+ const noteText = (item: StoryNote) => comments[item.key];+ const story = buildVideoStory(chapters, [note(1, 6.4, { end: 11 }), note(2, 12)]);+ const captions = (time: number, entries = story) =>+ captionEntriesAt(entries, time, noteText).map((entry) => storyEntryCaption(entry, noteText));++ it('captions an agent claim when the player seeks to it', () => {+ expect(captions(4)).toEqual(['Range reads 30 days before the switch.']);+ expect(captions(8.1 - 1e-4)).toEqual(['The range may reset when the tab remounts.']);+ expect(captions(9.2)).toEqual(['Range still reads 30 days after returning.']);+ });++ it('captions a chapter step and the reviewer note by their own text', () => {+ expect(captions(0)).toEqual(['Select 30 days']);+ expect(captions(6.4)).toEqual(['The selector already reads 7 days.']);+ });++ it('holds a caption for two seconds, then clears it', () => {+ const claimOnly = buildVideoStory([chapters[5]], []);+ expect(captions(5.9, claimOnly)).toEqual(['Range reads 30 days before the switch.']);+ expect(captions(6, claimOnly)).toEqual([]);+ expect(captions(3.9, claimOnly)).toEqual([]);+ });++ it('lets the later entry take over while an earlier one is still held', () => {+ expect(captions(5.5)).toEqual(['Open Balance']);+ expect(captions(8.05)).toEqual(['Back to Usage']);+ });++ it('keeps a span note captioned until the span ends unless something newer starts', () => {+ const spanOnly = buildVideoStory([], [note(1, 6.4, { end: 11 })]);+ expect(captions(10.9, spanOnly)).toEqual(['The selector already reads 7 days.']);+ expect(captions(11.5, spanOnly)).toEqual([]);+ expect(captions(10.9)).toEqual(['Range still reads 30 days after returning.']);+ });++ it('skips entries with nothing to read', () => {+ expect(captions(12)).toEqual([]);+ expect(captions(1, buildVideoStory([{ kind: 'step', t: 1 }], []))).toEqual([]);+ });++ it('captions every entry sharing the moment, in story order', () => {+ const shared = buildVideoStory(+ [+ { kind: 'check', note: 'loaded', t: 5 },+ { kind: 'flag', note: 'slow', t: 5 },+ { kind: 'step', label: 'Open', t: 5 },+ ],+ [note(1, 5)],+ );+ expect(captions(5, shared)).toEqual([+ 'Open',+ 'loaded',+ 'slow',+ 'The selector already reads 7 days.',+ ]);+ });++ it('returns the story entries themselves so a subscriber can compare them', () => {+ expect(captionEntriesAt(story, 4, noteText)[0]).toBe(story[1]);+ });+});++describe('fanOutPins', () => {+ const pin = (id: string, time: number) => ({ id, time });+ const slot = (pins: ReturnType<typeof pin>[], duration: number, id: string) =>+ fanOutPins(pins, duration).get(id);++ it('leaves a pin with no neighbour exactly on its own time', () => {+ expect(slot([pin('a', 2), pin('b', 8)], 10, 'a')).toEqual({+ after: 0,+ before: 0,+ offset: 0,+ percent: 20,+ });+ expect(slot([pin('a', 2), pin('b', 8)], 10, 'b')?.percent).toBe(80);+ });++ it('fans pins sharing a timestamp out around it, in the order given', () => {+ const slots = fanOutPins([pin('a', 5), pin('b', 5), pin('c', 5)], 10);+ expect([...slots.values()].map((item) => item.offset)).toEqual([-14, 0, 14]);+ expect([...slots.values()].map((item) => item.percent)).toEqual([50, 50, 50]);+ expect([...slots.keys()]).toEqual(['a', 'b', 'c']);+ });++ it('gives every pin of a cluster a distinct resting place', () => {+ const slots = fanOutPins([pin('a', 5), pin('b', 5)], 10);+ expect(slots.get('a')?.offset).toBe(-7);+ expect(slots.get('b')?.offset).toBe(7);+ });++ it('treats pins within one percent of the recording as one cluster', () => {+ const slots = fanOutPins([pin('a', 50), pin('b', 50.8), pin('c', 52)], 100);+ expect(slots.get('a')).toMatchObject({ offset: -7, percent: 50.4 });+ expect(slots.get('b')).toMatchObject({ offset: 7, percent: 50.4 });+ expect(slots.get('c')).toEqual({ after: 0, before: 0, offset: 0, percent: 52 });+ });++ it('reserves room at both ends so a cluster clamped to an edge stays fanned out', () => {+ const slots = fanOutPins([pin('a', 0), pin('b', 0), pin('c', 0)], 10);+ expect([...slots.values()].map((item) => [item.before, item.after])).toEqual([+ [0, 28],+ [14, 14],+ [28, 0],+ ]);+ });++ it('clusters by time whatever order the pins arrive in', () => {+ const slots = fanOutPins([pin('late', 9), pin('a', 5), pin('b', 5)], 10);+ expect(slots.get('late')?.offset).toBe(0);+ expect(slots.get('a')?.offset).toBe(-7);+ expect(slots.get('b')?.offset).toBe(7);+ });++ it('places nothing before the duration is known', () => {+ expect(fanOutPins([pin('a', 5)], 0).size).toBe(0);+ expect(fanOutPins([pin('a', 5)], Number.NaN).size).toBe(0);+ });+});diff --git a/src/features/Acceptance/Viewer/Evidence/Video/story.ts b/src/features/Acceptance/Viewer/Evidence/Video/story.tsnew file mode 100644index 00000000000..820bb795ebd--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/story.ts@@ -0,0 +1,195 @@+import type { VerifyEvidenceChapter } from '@lobechat/types';++import { claimsOf, disputesClaim, stepsOf } from './videoTime';++type ClaimRef = Pick<VerifyEvidenceChapter, 'kind' | 'note' | 't'>;++export interface StoryNote {+ disputes?: ClaimRef;+ end?: number;+ key: number | string;+ start: number;+}++export interface StoryChapterEntry {+ id: string;+ label: string;+ time: number;+ type: 'chapter';+}++export interface StoryClaimEntry<N extends StoryNote = StoryNote> {+ claim: VerifyEvidenceChapter;+ dispute?: N;+ id: string;+ time: number;+ type: 'claim';+}++export interface StoryNoteEntry<N extends StoryNote = StoryNote> {+ id: string;+ index: number;+ note: N;+ time: number;+ type: 'note';+}++export type StoryEntry<N extends StoryNote = StoryNote> =+ StoryChapterEntry | StoryClaimEntry<N> | StoryNoteEntry<N>;++const RANK: Record<StoryEntry['type'], number> = { chapter: 0, claim: 1, note: 2 };++const SEEK_TOLERANCE = 1 / 60;++export const storyNoteId = (key: number | string) => `note-${key}`;++export const buildVideoStory = <N extends StoryNote>(+ chapters: VerifyEvidenceChapter[],+ notes: N[],+): StoryEntry<N>[] => {+ const unclaimed = [...notes];+ const takeDispute = (claim: VerifyEvidenceChapter) => {+ const at = unclaimed.findIndex((note) => disputesClaim(note.disputes, claim));+ return at === -1 ? undefined : unclaimed.splice(at, 1)[0];+ };++ const claims = claimsOf(chapters).map((claim, index): StoryClaimEntry<N> => ({+ claim,+ dispute: takeDispute(claim),+ id: `claim-${claim.kind}-${claim.t}-${index}`,+ time: claim.t,+ type: 'claim',+ }));+ const entries: StoryEntry<N>[] = [+ ...stepsOf(chapters).map((step, index): StoryChapterEntry => ({+ id: `chapter-${step.t}-${index}`,+ label: step.label ?? '',+ time: step.t,+ type: 'chapter',+ })),+ ...claims,+ ...unclaimed.map((note): StoryNoteEntry<N> => ({+ id: storyNoteId(note.key),+ index: 0,+ note,+ time: note.start,+ type: 'note',+ })),+ ];++ let index = 0;+ return entries+ .toSorted((a, b) => a.time - b.time || RANK[a.type] - RANK[b.type])+ .map((entry) => (entry.type === 'note' ? { ...entry, index: ++index } : entry));+};++export const activeStoryEntryId = (entries: StoryEntry[], time: number) =>+ entries.findLast((entry) => entry.type !== 'chapter' && entry.time <= time + SEEK_TOLERANCE)?.id;++const CAPTION_HOLD_SECONDS = 2;++export const storyEntryCaption = <N extends StoryNote>(+ entry: StoryEntry<N>,+ noteText: (note: N) => string | undefined,+) => {+ const text = () => {+ switch (entry.type) {+ case 'chapter': {+ return entry.label;+ }+ case 'claim': {+ return entry.claim.note;+ }+ case 'note': {+ return noteText(entry.note);+ }+ }+ };+ return text()?.trim() || undefined;+};++export const captionEntriesAt = <N extends StoryNote>(+ entries: StoryEntry<N>[],+ time: number,+ noteText: (note: N) => string | undefined,+): StoryEntry<N>[] => {+ const heldUntil = (entry: StoryEntry<N>) =>+ Math.max(entry.time + CAPTION_HOLD_SECONDS, entry.type === 'note' ? (entry.note.end ?? 0) : 0);+ const showing = entries.filter(+ (entry) =>+ time >= entry.time - SEEK_TOLERANCE &&+ time < heldUntil(entry) &&+ storyEntryCaption(entry, noteText) !== undefined,+ );+ const latest = Math.max(...showing.map((entry) => entry.time));+ return showing.filter((entry) => entry.time === latest);+};++export interface ScrubberSegment {+ end: number;+ label?: string;+ start: number;+}++export const toScrubberSegments = (+ chapters: VerifyEvidenceChapter[],+ duration: number,+): ScrubberSegment[] => {+ if (!Number.isFinite(duration) || duration <= 0) return [];+ const starts = stepsOf(chapters)+ .filter((step) => step.t >= 0 && step.t < duration)+ .toSorted((a, b) => a.t - b.t)+ .filter((step, index, sorted) => index === 0 || step.t !== sorted[index - 1].t)+ .map((step): Omit<ScrubberSegment, 'end'> => ({ label: step.label, start: step.t }));+ if (starts[0]?.start !== 0) starts.unshift({ start: 0 });+ return starts.map((segment, index) => ({+ ...segment,+ end: starts[index + 1]?.start ?? duration,+ }));+};++const DEFAULT_SPAN_SECONDS = 1;++export const spanFromFrame = (start: number, playhead: number, duration: number) => ({+ end:+ playhead > start + SEEK_TOLERANCE ? playhead : Math.min(start + DEFAULT_SPAN_SECONDS, duration),+ start,+});+const PIN_CLUSTER_SPAN = 0.01;+const PIN_FAN_STEP_PX = 14;++export interface PinSlot {+ after: number;+ before: number;+ offset: number;+ percent: number;+}++export const fanOutPins = (+ pins: { id: string; time: number }[],+ duration: number,+): Map<string, PinSlot> => {+ const slots = new Map<string, PinSlot>();+ if (!Number.isFinite(duration) || duration <= 0) return slots;++ const clusters: { id: string; time: number }[][] = [];+ for (const pin of pins.toSorted((a, b) => a.time - b.time)) {+ const cluster = clusters.at(-1);+ if (cluster && (pin.time - cluster[0].time) / duration <= PIN_CLUSTER_SPAN) cluster.push(pin);+ else clusters.push([pin]);+ }++ for (const cluster of clusters) {+ const last = cluster.length - 1;+ const middle = cluster.reduce((sum, pin) => sum + pin.time, 0) / cluster.length;+ for (const [index, pin] of cluster.entries()) {+ slots.set(pin.id, {+ after: (last - index) * PIN_FAN_STEP_PX,+ before: index * PIN_FAN_STEP_PX,+ offset: (index - last / 2) * PIN_FAN_STEP_PX,+ percent: (middle / duration) * 100,+ });+ }+ }+ return slots;+};diff --git a/src/features/Acceptance/Viewer/Evidence/Video/styles.ts b/src/features/Acceptance/Viewer/Evidence/Video/styles.tsindex 4be971f625e..6659937bb98 100644--- a/src/features/Acceptance/Viewer/Evidence/Video/styles.ts+++ b/src/features/Acceptance/Viewer/Evidence/Video/styles.ts@@ -36,7 +36,7 @@ export const styles = stylex.create({paddingBlock: '1px',paddingInline: '6px',borderRadius: '4px',- fontSize: '11px',+ fontSize: '12px',lineHeight: '18px',color: '#fff',textOverflow: 'ellipsis',@@ -68,7 +68,7 @@ export const styles = stylex.create({width: '18px',height: '18px',borderRadius: '50%',- fontSize: '11px',+ fontSize: '12px',fontWeight: 600,lineHeight: 1,color: cssVar.colorTextLightSolid,@@ -102,61 +102,6 @@ export const styles = stylex.create({whiteSpace: 'nowrap',backgroundColor: 'rgb(0 0 0 / 65%)',},- dispute: {- cursor: { 'default': 'pointer', ':disabled': 'default' },- flex: 'none',- paddingBlock: '1px',- paddingInline: '8px',- borderWidth: '1px',- borderStyle: 'solid',- borderColor: 'rgb(255 255 255 / 30%)',- borderRadius: '4px',- fontSize: '12px',- color: '#fff',- opacity: { 'default': null, ':disabled': 0.5 },- backgroundColor: {- 'default': 'transparent',- ':hover': { 'default': null, ':not(:disabled)': 'rgb(255 255 255 / 12%)' },- },- backgroundImage: 'none',- },- noteSpan: {- pointerEvents: 'none',- position: 'absolute',- insetBlockStart: '6px',- height: '8px',- borderRadius: '2px',- opacity: 0.6,- backgroundColor: cssVar.colorError,- },- rangeBand: {- pointerEvents: 'none',- position: 'absolute',- insetBlockStart: '2px',- insetBlockEnd: '2px',- borderRadius: '3px',- backgroundColor: `color-mix(in srgb, ${cssVar.colorWarning} 25%, transparent)`,- boxShadow: `inset 0 0 0 1px ${cssVar.colorWarning}`,- },- lane: {- touchAction: 'none',- cursor: 'text',- position: 'relative',- height: '16px',- marginBlockStart: '4px',- borderRadius: '4px',- backgroundImage:- 'repeating-linear-gradient(90deg, rgb(255 255 255 / 6%) 0, rgb(255 255 255 / 6%) 1px, transparent 1px, transparent 12px)',- },- laneLabel: {- pointerEvents: 'none',- position: 'absolute',- insetBlockStart: 0,- insetInlineStart: '6px',- fontSize: '10px',- lineHeight: '16px',- color: '#777',- },});export const CLAIM_COLOR: Record<VerifyEvidenceChapterKind, string> = {diff --git a/src/features/Acceptance/Viewer/Evidence/Video/useReviewKeys.ts b/src/features/Acceptance/Viewer/Evidence/Video/useReviewKeys.tsnew file mode 100644index 00000000000..701f609c140--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/Video/useReviewKeys.ts@@ -0,0 +1,126 @@+import type { VideoPlayer } from '@lobehub/ui';+import { useEffect, useRef } from 'react';+import { useTranslation } from 'react-i18next';++import { formatVideoTime } from './videoTime';++export interface VideoLoop {+ end: number;+ start: number;+}++export const REVIEW_RATES = [0.5, 1, 1.5, 2];++const isTyping = (target: EventTarget | null) =>+ target instanceof HTMLElement &&+ (target.isContentEditable || ['INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName));++const playbackKey = (event: KeyboardEvent, player: VideoPlayer) => {+ // A focused button owns Space and Enter — they must activate it, not play.+ if (event.target instanceof HTMLButtonElement && (event.key === ' ' || event.key === 'Enter'))+ return false;+ const { rate, time } = player.getState();+ const nextRate = (direction: 1 | -1) => {+ const index = REVIEW_RATES.indexOf(rate);+ player.setRate(+ REVIEW_RATES[+ Math.min(Math.max((index === -1 ? 1 : index) + direction, 0), REVIEW_RATES.length - 1)+ ],+ );+ };+ switch (event.key.toLowerCase()) {+ case ' ':+ case 'k': {+ player.toggle();+ return true;+ }+ case ',': {+ player.step(-1);+ return true;+ }+ case '.': {+ player.step(1);+ return true;+ }+ case 'arrowleft': {+ player.seek(time - (event.shiftKey ? 5 : 1));+ return true;+ }+ case 'arrowright': {+ player.seek(time + (event.shiftKey ? 5 : 1));+ return true;+ }+ case 'j': {+ nextRate(-1);+ return true;+ }+ case 'l': {+ nextRate(1);+ return true;+ }+ default: {+ return false;+ }+ }+};++interface ReviewKeysOptions {+ onFlash: (text: string) => void;+ onMarkFrame: () => void;+ onRange: (range: VideoLoop | null) => void;+ range: VideoLoop | null;+}++export const useReviewKeys = (player: VideoPlayer, options: ReviewKeysOptions) => {+ const { t } = useTranslation('verify');+ const latest = useRef(options);+ latest.current = options;++ // The modal is the review: keys act whenever the reviewer is not typing.+ useEffect(() => {+ const onKey = (event: KeyboardEvent) => {+ if (isTyping(event.target) || event.metaKey || event.ctrlKey || event.altKey) return;+ const state = player.getState();+ if (state.status !== 'ready') return;+ const { onFlash, onMarkFrame, onRange, range } = latest.current;+ const now = state.time;+ let handled = true;+ switch (event.key.toLowerCase()) {+ case 'm': {+ onMarkFrame();+ break;+ }+ case 'i': {+ // Open-ended until O: a provisional end would loop playback short+ // of the moment the reviewer is waiting for.+ const end = range && range.end > now ? range.end : state.duration;+ onRange({ end, start: now });+ onFlash(t('acceptance.video.inPoint', { time: formatVideoTime(now) }));+ break;+ }+ case 'o': {+ const start = range?.start ?? Math.max(0, now - 1);+ if (now > start) {+ onRange({ end: now, start });+ onFlash(t('acceptance.video.outPoint', { time: formatVideoTime(now) }));+ }+ break;+ }+ case 'escape': {+ if (!range) return;+ onRange(null);+ break;+ }+ default: {+ handled = playbackKey(event, player);+ }+ }+ if (handled) {+ event.preventDefault();+ event.stopPropagation();+ }+ };+ window.addEventListener('keydown', onKey, true);+ return () => window.removeEventListener('keydown', onKey, true);+ }, [player, t]);+};diff --git a/src/features/Acceptance/Viewer/Evidence/regionLocation.test.ts b/src/features/Acceptance/Viewer/Evidence/regionLocation.test.tsnew file mode 100644index 00000000000..35d700c327b--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/regionLocation.test.ts@@ -0,0 +1,29 @@+import { describe, expect, it } from 'vitest';++import { regionLocations } from './regionLocation';++const note = (key: number, evidenceId: string) => ({ evidenceId, key });++describe('regionLocations', () => {+ it('numbers each region within its own image, like the badge drawn on it', () => {+ expect(+ regionLocations([note(1, 'a'), note(2, 'b'), note(3, 'a'), note(4, 'b')], ['a', 'b']),+ ).toEqual([+ { image: 1, region: 1 },+ { image: 2, region: 1 },+ { image: 1, region: 2 },+ { image: 2, region: 2 },+ ]);+ });++ it('follows the evidence order for the image number, not the order regions were drawn', () => {+ expect(regionLocations([note(1, 'b'), note(2, 'a')], ['a', 'b'])).toEqual([+ { image: 2, region: 1 },+ { image: 1, region: 1 },+ ]);+ });++ it('keeps a region whose image is gone on image 0 rather than dropping the row', () => {+ expect(regionLocations([note(1, 'gone')], ['a'])).toEqual([{ image: 0, region: 1 }]);+ });+});diff --git a/src/features/Acceptance/Viewer/Evidence/regionLocation.ts b/src/features/Acceptance/Viewer/Evidence/regionLocation.tsnew file mode 100644index 00000000000..23d24f72f1a--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/regionLocation.ts@@ -0,0 +1,21 @@+interface RegionRef {+ evidenceId: string;+ key: number;+}++export interface RegionLocation {+ image: number;+ region: number;+}++export const regionLocations = (+ annotations: RegionRef[],+ evidenceIds: string[],+): RegionLocation[] => {+ const drawnPerImage = new Map<string, number>();+ return annotations.map((annotation) => {+ const region = (drawnPerImage.get(annotation.evidenceId) ?? 0) + 1;+ drawnPerImage.set(annotation.evidenceId, region);+ return { image: evidenceIds.indexOf(annotation.evidenceId) + 1, region };+ });+};diff --git a/src/features/Acceptance/Viewer/Evidence/resources.test.ts b/src/features/Acceptance/Viewer/Evidence/resources.test.tsnew file mode 100644index 00000000000..d4baf0714d7--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/resources.test.ts@@ -0,0 +1,134 @@+import { describe, expect, it } from 'vitest';++import type { AcceptanceCheck } from '../Checks/types';+import { collectResources, countResources, filterResources, resourceKind } from './resources';++const evidence = (id: string, type: string, extra: Record<string, unknown> = {}) => ({+ fileId: `file-${id}`,+ fileUrl: `https://files.test/${id}`,+ id,+ type,+ ...extra,+});++const check = (+ seq: number,+ steps: { evidence: unknown[]; roundIndex: number }[],+ current: unknown[] = steps.at(-1)?.evidence ?? [],+) =>+ ({+ evidence: current,+ id: `check-${seq}`,+ resultRound: steps.at(-1)?.roundIndex,+ seq,+ timeline: steps,+ title: `Check ${seq}`,+ }) as unknown as AcceptanceCheck;++describe('resourceKind', () => {+ it('sorts evidence into the three filters', () => {+ expect(resourceKind(evidence('a', 'screenshot'))).toBe('screenshot');+ expect(resourceKind(evidence('b', 'gif'))).toBe('screenshot');+ expect(resourceKind(evidence('c', 'video'))).toBe('recording');+ expect(resourceKind(evidence('d', 'audio'))).toBe('recording');+ expect(resourceKind(evidence('e', 'terminal'))).toBe('other');+ expect(resourceKind(evidence('f', 'markdown'))).toBe('other');+ });++ it('treats media without a file as a plain document', () => {+ expect(resourceKind({ documentId: 'doc', fileUrl: null, type: 'screenshot' })).toBe('other');+ });+});++describe('collectResources', () => {+ it('gathers every round, newest round first, then by check order', () => {+ const items = collectResources([+ check(2, [+ { evidence: [evidence('r1-c2', 'markdown')], roundIndex: 1 },+ { evidence: [evidence('r2-c2', 'screenshot')], roundIndex: 2 },+ ]),+ check(1, [+ { evidence: [evidence('r1-c1', 'screenshot')], roundIndex: 1 },+ { evidence: [evidence('r2-c1', 'video')], roundIndex: 2 },+ ]),+ ]);++ expect(items.map((item) => [item.evidence.id, item.checkSeq, item.roundIndex])).toEqual([+ ['r2-c1', 1, 2],+ ['r2-c2', 2, 2],+ ['r1-c1', 1, 1],+ ['r1-c2', 2, 1],+ ]);+ });++ it('lists a carried-forward file once, under the round that captured it', () => {+ const items = collectResources([+ check(1, [+ { evidence: [evidence('first', 'screenshot', { fileId: 'same' })], roundIndex: 1 },+ { evidence: [evidence('again', 'screenshot', { fileId: 'same' })], roundIndex: 2 },+ ]),+ ]);++ expect(items).toHaveLength(1);+ expect(items[0]).toMatchObject({ roundIndex: 1, rounds: [1, 2] });+ expect(items[0].evidence.id).toBe('first');+ });++ it('skips inline text that has no file or document to open', () => {+ const items = collectResources([+ check(1, [+ {+ evidence: [+ { content: 'inline', fileId: null, fileUrl: null, id: 'inline', type: 'text' },+ { documentId: 'doc-1', fileId: null, fileUrl: null, id: 'doc', type: 'markdown' },+ ],+ roundIndex: 1,+ },+ ]),+ ]);++ expect(items.map((item) => item.evidence.id)).toEqual(['doc']);+ });++ it('keeps current evidence that no timeline step carries', () => {+ const items = collectResources([check(3, [], [evidence('loose', 'screenshot')])]);+ expect(items).toHaveLength(1);+ expect(items[0].roundIndex).toBeNull();+ });+});++describe('filtering and counting', () => {+ const items = collectResources([+ check(1, [+ { evidence: [evidence('s1', 'screenshot'), evidence('t1', 'terminal')], roundIndex: 1 },+ {+ evidence: [+ evidence('s1-again', 'screenshot', { fileId: 'file-s1' }),+ evidence('v2', 'video'),+ ],+ roundIndex: 2,+ },+ ]),+ check(2, [{ evidence: [evidence('s2', 'screenshot')], roundIndex: 2 }]),+ ]);++ it('counts each filter tab', () => {+ expect(countResources(items)).toEqual({ all: 4, other: 1, recording: 1, screenshot: 2 });+ });++ it('filters by kind', () => {+ expect(+ filterResources(items, { kind: 'recording', round: null }).map((i) => i.evidence.id),+ ).toEqual(['v2']);+ expect(filterResources(items, { kind: 'all', round: null })).toHaveLength(4);+ });++ it('filters by any round a file appeared in', () => {+ expect(+ filterResources(items, { kind: 'all', round: 2 }).map((item) => item.evidence.id),+ ).toEqual(['v2', 's2', 's1']);+ expect(+ filterResources(items, { kind: 'screenshot', round: 1 }).map((item) => item.evidence.id),+ ).toEqual(['s1']);+ });+});diff --git a/src/features/Acceptance/Viewer/Evidence/resources.ts b/src/features/Acceptance/Viewer/Evidence/resources.tsnew file mode 100644index 00000000000..10df4c2ca14--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/resources.ts@@ -0,0 +1,79 @@+import type { AcceptanceCheck, AcceptanceEvidence } from '../Checks/types';+import { IMAGE_EVIDENCE } from './evidence';++export type ResourceKind = 'other' | 'recording' | 'screenshot';+export type ResourceFilter = 'all' | ResourceKind;++export const RESOURCE_FILTERS: ResourceFilter[] = ['all', 'screenshot', 'recording', 'other'];++const RECORDING_EVIDENCE = new Set(['audio', 'video']);++export const resourceKind = (+ evidence: Pick<AcceptanceEvidence, 'fileUrl' | 'type'>,+): ResourceKind => {+ if (!evidence.fileUrl) return 'other';+ if (IMAGE_EVIDENCE.has(evidence.type)) return 'screenshot';+ if (RECORDING_EVIDENCE.has(evidence.type)) return 'recording';+ return 'other';+};++export interface ResourceItem {+ checkSeq: number;+ checkTitle: string;+ evidence: AcceptanceEvidence;+ key: string;+ kind: ResourceKind;+ roundIndex: number | null;+ rounds: number[];+}++const resourceKey = (evidence: AcceptanceEvidence) =>+ evidence.fileId ?? evidence.documentId ?? evidence.id;++export const collectResources = (checks: AcceptanceCheck[]): ResourceItem[] => {+ const byKey = new Map<string, ResourceItem>();+ const add = (check: AcceptanceCheck, evidence: AcceptanceEvidence, roundIndex: number | null) => {+ if (!evidence.fileUrl && !evidence.documentId) return;+ const key = resourceKey(evidence);+ if (!key) return;+ const known = byKey.get(key);+ if (known) {+ if (roundIndex !== null && !known.rounds.includes(roundIndex)) known.rounds.push(roundIndex);+ return;+ }+ byKey.set(key, {+ checkSeq: check.seq,+ checkTitle: check.title,+ evidence,+ key,+ kind: resourceKind(evidence),+ roundIndex,+ rounds: roundIndex === null ? [] : [roundIndex],+ });+ };++ for (const check of checks) {+ const steps = [...(check.timeline ?? [])].sort((a, b) => a.roundIndex - b.roundIndex);+ for (const step of steps) for (const item of step.evidence) add(check, item, step.roundIndex);+ for (const item of check.evidence ?? []) add(check, item, check.resultRound ?? null);+ }++ return [...byKey.values()].sort(+ (a, b) => (b.roundIndex ?? -1) - (a.roundIndex ?? -1) || a.checkSeq - b.checkSeq,+ );+};++export const filterResources = (+ items: ResourceItem[],+ { kind, round }: { kind: ResourceFilter; round: number | null },+) =>+ items.filter(+ (item) =>+ (kind === 'all' || item.kind === kind) && (round === null || item.rounds.includes(round)),+ );++export const countResources = (items: ResourceItem[]): Record<ResourceFilter, number> => {+ const counts = { all: items.length, other: 0, recording: 0, screenshot: 0 };+ for (const item of items) counts[item.kind] += 1;+ return counts;+};diff --git a/src/features/Acceptance/Viewer/Evidence/stageFit.test.ts b/src/features/Acceptance/Viewer/Evidence/stageFit.test.tsnew file mode 100644index 00000000000..f6fe8d68dc1--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/stageFit.test.ts@@ -0,0 +1,105 @@+import { describe, expect, it } from 'vitest';++import { resolveStageFit, stageContentBox, TALL_IMAGE_ASPECT } from './stageFit';++const stage = { height: 400, width: 600 };++describe('resolveStageFit', () => {+ it('returns nothing until both boxes are measured', () => {+ expect(resolveStageFit({ natural: undefined, stage })).toBeUndefined();+ expect(+ resolveStageFit({ natural: { height: 800, width: 1280 }, stage: undefined }),+ ).toBeUndefined();+ expect(resolveStageFit({ natural: { height: 0, width: 1280 }, stage })).toBeUndefined();+ expect(+ resolveStageFit({ natural: { height: 800, width: 1280 }, stage: { height: 0, width: 600 } }),+ ).toBeUndefined();+ });++ it('fits a landscape screenshot to the stage width', () => {+ expect(resolveStageFit({ natural: { height: 1000, width: 1600 }, stage })).toEqual({+ height: 375,+ mode: 'contain',+ scale: 0.375,+ tall: false,+ width: 600,+ });+ });++ it('fits a phone screenshot to the stage height and leaves side bands', () => {+ const fit = resolveStageFit({ natural: { height: 1950, width: 900 }, stage })!;+ expect(fit.mode).toBe('contain');+ expect(fit.tall).toBe(false);+ expect(fit.height).toBe(400);+ expect(fit.width).toBe(184);+ });++ it('shows a small crop at its natural size instead of scaling it up', () => {+ expect(resolveStageFit({ natural: { height: 120, width: 320 }, stage })).toEqual({+ height: 120,+ mode: 'contain',+ scale: 1,+ tall: false,+ width: 320,+ });+ });++ it('fits a full-page capture to the width and lets it scroll', () => {+ expect(resolveStageFit({ natural: { height: 4800, width: 1200 }, stage })).toEqual({+ height: 2400,+ mode: 'scroll',+ scale: 0.5,+ tall: true,+ width: 600,+ });+ });++ it('never scales a narrow full-page capture above its natural width', () => {+ const fit = resolveStageFit({ natural: { height: 2412, width: 390 }, stage })!;+ expect(fit).toMatchObject({ height: 2412, mode: 'scroll', scale: 1, width: 390 });+ });++ it('contains a full-page capture once fit height is chosen, and keeps the toggle', () => {+ const fit = resolveStageFit({+ fitHeight: true,+ natural: { height: 4800, width: 1200 },+ stage,+ })!;+ expect(fit).toMatchObject({ height: 400, mode: 'contain', tall: true, width: 100 });+ });++ it('does not scroll a tall image that already fits the stage', () => {+ const fit = resolveStageFit({ natural: { height: 390, width: 100 }, stage })!;+ expect(fit).toMatchObject({ height: 390, mode: 'contain', tall: false, width: 100 });+ });++ it('treats the aspect threshold itself as a phone screen, not a full page', () => {+ const fit = resolveStageFit({+ natural: { height: 1000 * TALL_IMAGE_ASPECT, width: 1000 },+ stage,+ })!;+ expect(fit.mode).toBe('contain');+ });++ it('gives the same mode for the same picture at any pixel density', () => {+ const at1x = resolveStageFit({ natural: { height: 844, width: 390 }, stage })!;+ const at3x = resolveStageFit({ natural: { height: 2532, width: 1170 }, stage })!;+ expect(at1x.mode).toBe('contain');+ expect(at3x.mode).toBe('contain');+ });+});++describe('stageContentBox', () => {+ it('subtracts the stage padding from the measured box', () => {+ expect(+ stageContentBox({ height: 480, width: 800 }, { bottom: 68, left: 16, right: 16, top: 16 }),+ ).toEqual({ height: 396, width: 768 });+ });++ it('is unmeasured while either side is missing or swallowed by padding', () => {+ const padding = { bottom: 16, left: 16, right: 16, top: 16 };+ expect(stageContentBox({ height: undefined, width: 800 }, padding)).toBeUndefined();+ expect(stageContentBox({ height: 480, width: undefined }, padding)).toBeUndefined();+ expect(stageContentBox({ height: 24, width: 800 }, padding)).toBeUndefined();+ });+});diff --git a/src/features/Acceptance/Viewer/Evidence/stageFit.ts b/src/features/Acceptance/Viewer/Evidence/stageFit.tsnew file mode 100644index 00000000000..e401b1d372a--- /dev/null+++ b/src/features/Acceptance/Viewer/Evidence/stageFit.ts@@ -0,0 +1,70 @@+export interface StageSize {+ height: number;+ width: number;+}++export interface StagePadding {+ bottom: number;+ left: number;+ right: number;+ top: number;+}++export type StageFitMode = 'contain' | 'scroll';++export interface StageFit {+ height: number;+ mode: StageFitMode;+ scale: number;+ tall: boolean;+ width: number;+}++// Aspect, not pixels: the tallest phone screens sit near 2.4, and a ratio reads+// the same at 1x and 3x where a pixel threshold would not.+export const TALL_IMAGE_ASPECT = 2.5;++const isMeasured = (size?: Partial<StageSize>): size is StageSize =>+ Boolean(size?.width && size.height && size.width > 0 && size.height > 0);++const wholePixels = (value: number) => Math.floor(value + 1e-6);++export const stageContentBox = (+ size: Partial<StageSize>,+ padding: StagePadding,+): StageSize | undefined => {+ if (!isMeasured(size)) return;+ const box = {+ height: size.height - padding.top - padding.bottom,+ width: size.width - padding.left - padding.right,+ };+ return isMeasured(box) ? box : undefined;+};++export const resolveStageFit = ({+ fitHeight = false,+ natural,+ stage,+}: {+ fitHeight?: boolean;+ natural?: Partial<StageSize>;+ stage?: Partial<StageSize>;+}): StageFit | undefined => {+ if (!isMeasured(natural) || !isMeasured(stage)) return;++ const widthScale = Math.min(stage.width / natural.width, 1);+ const containScale = Math.min(widthScale, stage.height / natural.height);+ const tall =+ natural.height / natural.width > TALL_IMAGE_ASPECT &&+ natural.height * widthScale > stage.height;+ const mode: StageFitMode = tall && !fitHeight ? 'scroll' : 'contain';+ const scale = mode === 'scroll' ? widthScale : containScale;++ return {+ height: wholePixels(natural.height * scale),+ mode,+ scale,+ tall,+ width: wholePixels(natural.width * scale),+ };+};diff --git a/src/features/Acceptance/Viewer/Evidence/styles.ts b/src/features/Acceptance/Viewer/Evidence/styles.tsindex f3a2d6381b9..3bf0edafaf0 100644--- a/src/features/Acceptance/Viewer/Evidence/styles.ts+++ b/src/features/Acceptance/Viewer/Evidence/styles.ts@@ -16,6 +16,10 @@ export const styles = stylex.create({borderColor: cssVar.colorBorderSecondary,borderRadius: cssVar.borderRadiusLG,},+ listFill: {+ flex: '1',+ minHeight: 0,+ },evidenceText: {overflow: 'auto',maxHeight: '200px',diff --git a/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.ts b/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.tsindex 2948e89dbfd..d4def48a088 100644--- a/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.ts+++ b/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.ts@@ -18,15 +18,19 @@ import { useLayoutEffect, useState } from 'react';export const useMeasuredWidth = <T extends HTMLElement = HTMLDivElement>() => {const [node, setNode] = useState<T | null>(null);const [width, setWidth] = useState<number>();+ const [height, setHeight] = useState<number>();useLayoutEffect(() => {if (!node) return;- const measure = () => setWidth(node.clientWidth || undefined);+ const measure = () => {+ setWidth(node.clientWidth || undefined);+ setHeight(node.clientHeight || undefined);+ };measure();const observer = new ResizeObserver(measure);observer.observe(node);return () => observer.disconnect();}, [node]);- return { node, ref: setNode, width };+ return { height, node, ref: setNode, width };};diff --git a/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx b/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsxindex 72927f70052..425558ffed6 100644--- a/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx+++ b/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx@@ -2,20 +2,10 @@import '@xyflow/react/dist/style.css';-import {- ActionIcon,- Button,- Empty,- Flexbox,- Select,- Text,- useAppElement,- useResponsive,-} from '@lobehub/ui';+import { Empty, Flexbox, useAppElement, useResponsive } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { MarkerType, ReactFlowProvider } from '@xyflow/react';-import { Maximize2, Minimize2 } from 'lucide-react';import { use, useEffect, useRef, useState } from 'react';import { createPortal } from 'react-dom';import { useTranslation } from 'react-i18next';@@ -24,7 +14,6 @@ import { sx } from '@/styles/sx';import { useAcceptanceScope } from '../AcceptanceScope';import { acceptanceContentLayout } from '../layout';-import { AcceptancePlanReview } from '../Plan/AcceptancePlanReview';import { useAcceptanceBundle } from '../useAcceptanceBundle';import { FlowCanvas } from './FlowCanvas';import { buildFlowGraph } from './flowGraph';@@ -34,6 +23,8 @@ import { FlowNode } from './FlowNode';import { FlowOutline } from './FlowOutline';import { FlowPanelHostContext } from './FlowPanelHost';import { FlowResults } from './FlowResults';+import { walkNeighbors, walkOrder } from './flowStoryboard';+import { FlowToolbar } from './FlowToolbar';const narrow = '@media (width <= 640px)';@@ -62,7 +53,7 @@ const styles = stylex.create({details: {overflow: 'hidden',flex: 'none',- width: { default: 'min(440px, 42%)', [narrow]: '100%' },+ width: { default: 'min(480px, 42%)', [narrow]: '100%' },height: { default: '100%', [narrow]: '40%' },minHeight: 0,},@@ -148,6 +139,13 @@ export function AcceptanceFlow() {focus,);if (!views.length) return <Empty description={t('flow.empty')} />;+ const steps = walkOrder(graph.nodes);+ const stepNumbers = new Map(steps.map((step, index) => [step.id, index + 1]));+ const storyboardNodes = graph.nodes.map((node) =>+ stepNumbers.has(node.id)+ ? { ...node, data: { ...node.data, order: stepNumbers.get(node.id) } }+ : node,+ );const edgeSelection = graph.transitions.get(selected ?? '');const checkSelection =graph.checks.get(selected ?? '') ??@@ -158,6 +156,8 @@ export function AcceptanceFlow() {item.node.id === edgeSelection.edge.targetNodeKey,): undefined);+ const selectedStepId = [...graph.checks].find(([, item]) => item === checkSelection)?.[0];+ const walk = walkNeighbors(steps, selectedStepId);const attempts = (checkSelection?.view.run?.attempts ?? []).filter((a) =>a.nodeId === checkSelection?.node.id &&@@ -181,6 +181,8 @@ export function AcceptanceFlow() {edges={checkSelection.view.version.edges}key={`${checkSelection.view.id}:${selected}`}node={checkSelection.node}+ nodes={checkSelection.view.version.nodes}+ position={walk.position ? { index: walk.position, total: steps.length } : undefined}selectedEdge={edgeSelection?.edge}canReview={Boolean(data?.canReview &&@@ -206,53 +208,26 @@ export function AcceptanceFlow() {wrap="wrap"{...sx(styles.toolbar, { maxWidth: contentMeasure })}>- <Flexbox horizontal align="center" gap={4}>- <Button size="small" type="text" onClick={() => setFocus(undefined)}>- {t('flow.allGroups')}- </Button>- {crumbs.map((crumb) => (- <Flexbox horizontal align="center" gap={4} key={crumb.id}>- <Text type="secondary">/</Text>- <Button size="small" type="text" onClick={() => setFocus(crumb.id)}>- {crumb.title}- </Button>- </Flexbox>- ))}- </Flexbox>- <Flexbox horizontal align="center" gap={8} wrap="wrap">- <AcceptancePlanReview runId={candidates[0]?.run?.verifyRunId} />- <Button- size="small"- type="text"- onClick={() => setDisplay(showOutline ? 'graph' : 'outline')}- >- {t(showOutline ? 'flow.graphView' : 'flow.outlineView')}- </Button>- <Select- size="small"- style={{ width: 120, flexShrink: 0 }}- value={activeKey}- options={keys.map((key) => ({- value: key,- label:- key === 'pending'- ? t('flow.pendingPlan')- : t('acceptance.round', { round: Number(key) }),- }))}- onChange={(value: string) => {- setRoundKey(value);- setFocus(undefined);- setSelected(undefined);- }}- />- <ActionIcon- aria-label={t(fullscreen ? 'flow.exitFullscreen' : 'flow.fullscreen')}- icon={fullscreen ? Minimize2 : Maximize2}- ref={fullscreenButton}- title={t(fullscreen ? 'flow.exitFullscreen' : 'flow.fullscreen')}- onClick={() => setFullscreen((value) => !value)}- />- </Flexbox>+ <FlowToolbar+ activeKey={activeKey}+ crumbs={crumbs}+ fullscreen={fullscreen}+ fullscreenButtonRef={fullscreenButton}+ keys={keys}+ runId={candidates[0]?.run?.verifyRunId}+ showOutline={showOutline}+ stepCount={steps.length}+ walk={walk}+ onDisplayChange={setDisplay}+ onFocus={setFocus}+ onSelect={setSelected}+ onToggleFullscreen={() => setFullscreen((value) => !value)}+ onRoundChange={(value) => {+ setRoundKey(value);+ setFocus(undefined);+ setSelected(undefined);+ }}+ /></Flexbox><Flexbox horizontal flex={fullscreen ? 1 : undefined} {...stylex.props(styles.workspace)}>{showOutline ? (@@ -265,7 +240,7 @@ export function AcceptanceFlow() {edges={graphEdges}fullscreen={fullscreen}nodeTypes={nodeTypes}- nodes={graph.nodes}+ nodes={storyboardNodes}viewKey={focus ?? activeKey}onSelect={setSelected}/>diff --git a/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx b/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsxindex 9a311d716d1..34c536e8f16 100644--- a/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx+++ b/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx@@ -12,7 +12,7 @@ import {useReactFlow,type Viewport,} from '@xyflow/react';-import { useEffect, useRef } from 'react';+import { useCallback, useEffect, useRef } from 'react';import { observeWidth } from '@/features/AgentGoals/ProcessControl/Graph/useFitViewOnResize';import { useSingleton } from '@/hooks/useSingleton';@@ -21,7 +21,7 @@ import { sx } from '@/styles/sx';import { FlowAnchorContext } from './flowAnchor';import { FlowEdge } from './FlowEdge';import type { FlowGraphData } from './flowGraph';-import { getSelectedFlowNodeId, panNodeIntoView } from './flowViewport';+import { getSelectedFlowNodeId, panNodeIntoView, revealNode } from './flowViewport';const edgeTypes = { transition: FlowEdge };@@ -70,12 +70,15 @@ export function FlowCanvas({}) {const ref = useRef<HTMLDivElement>(null);const { fitView, getNodesBounds, getViewport, setViewport } = useReactFlow();- const anchor = useSingleton(() => ({ current: null as string | null }));+ const anchorRef = useRef<string | null>(null);+ const markAnchor = useCallback((nodeId: string | null) => {+ anchorRef.current = nodeId;+ }, []);// The toggled group has just changed height, so follow it rather than leaving// the user staring at whatever slid into its place.useEffect(() => {- const toggled = anchor.current;- anchor.current = null;+ const toggled = anchorRef.current;+ anchorRef.current = null;const container = ref.current;if (!toggled || !container) return;panNodeIntoView(@@ -83,15 +86,29 @@ export function FlowCanvas({{ height: container.clientHeight, width: container.clientWidth },toggled,);- }, [nodes, anchor, getNodesBounds, getViewport, setViewport]);+ }, [nodes, getNodesBounds, getViewport, setViewport]);const viewports = useSingleton(() => new Map<string, { viewport: Viewport; width: number; height: number }>(),);const selectedId = getSelectedFlowNodeId(nodes);const selectedRef = useRef(selectedId);+ const clickedRef = useRef<string | undefined>(undefined);+ const walkedRef = useRef(false);+ // A click must never move the canvas out from under the pointer, but a state+ // picked from outside it (Prev / Next) has no pointer to respect, so it is+ // brought fully inside, clipped edges included.useEffect(() => {selectedRef.current = selectedId;- }, [selectedId]);+ walkedRef.current = Boolean(selectedId) && selectedId !== clickedRef.current;+ clickedRef.current = undefined;+ const container = ref.current;+ if (!walkedRef.current || !container) return;+ revealNode(+ { getNodesBounds, getViewport, setViewport },+ { height: container.clientHeight, width: container.clientWidth },+ selectedId,+ );+ }, [selectedId, getNodesBounds, getViewport, setViewport]);// The details panel opens beside the canvas when a node is picked. Refitting// here would throw away the zoom the user just set, so only bring the picked// node back into view when the narrower canvas hid it.@@ -99,7 +116,7 @@ export function FlowCanvas({const container = ref.current;if (!container || typeof ResizeObserver === 'undefined') return;return observeWidth(container, () =>- panNodeIntoView(+ (walkedRef.current ? revealNode : panNodeIntoView)({ getNodesBounds, getViewport, setViewport },{ height: container.clientHeight, width: container.clientWidth },selectedRef.current,@@ -130,7 +147,7 @@ export function FlowCanvas({return (// Custom nodes render inside React Flow, not under its `children`, so the// anchor channel has to sit above the canvas to reach a group's toggle.- <FlowAnchorContext value={anchor}>+ <FlowAnchorContext value={markAnchor}><Flexboxref={ref}{...sx(@@ -163,8 +180,11 @@ export function FlowCanvas({// the caption selected the branch, opened the panel and shifted the// canvas out from under the pointer. Branches stay pickable in the// outline view; on the canvas the state card is the way in.- onNodeClick={(_, n) => onSelect(n.id)}onPaneClick={() => onSelect('')}+ onNodeClick={(_, n) => {+ clickedRef.current = n.id;+ onSelect(n.id);+ }}><Background bgColor="transparent" color={cssVar.colorBorderSecondary} gap={18} size={1} /><Controls position="bottom-right" showInteractive={false} />diff --git a/src/features/Acceptance/Viewer/Flow/FlowGroup.tsx b/src/features/Acceptance/Viewer/Flow/FlowGroup.tsxindex c94de41c2d4..07348752f3b 100644--- a/src/features/Acceptance/Viewer/Flow/FlowGroup.tsx+++ b/src/features/Acceptance/Viewer/Flow/FlowGroup.tsx@@ -53,11 +53,11 @@ const styles = stylex.create({display: '-webkit-box',WebkitBoxOrient: 'vertical',WebkitLineClamp: '2',- fontSize: '13px',+ fontSize: '14px',fontWeight: 500,lineHeight: 1.4,},- summary: { fontSize: '11px', lineHeight: '16px', color: cssVar.colorTextTertiary },+ summary: { fontSize: '12px', lineHeight: '16px', color: cssVar.colorTextTertiary },handle: {width: '1px',minWidth: '0',@@ -70,12 +70,12 @@ const styles = stylex.create({export function FlowGroup({ data }: { data: FlowGraphData }) {const { t } = useTranslation('verify');- const anchor = use(FlowAnchorContext);+ const markAnchor = use(FlowAnchorContext);const nodeId = useNodeId();// Name this group as the one to follow once the new layout lands.const toggle = (event: { stopPropagation: () => void }) => {event.stopPropagation();- anchor.current = nodeId;+ markAnchor(nodeId);data.onToggle?.();};const statusIcon =@@ -174,7 +174,7 @@ export function FlowGroup({ data }: { data: FlowGraphData }) {</Button>)}<Icon icon={statusIcon} size={18} style={{ color: flowStateColor(data.state) }} />- <Text ellipsis fontSize={13} style={{ flex: 1 }}>+ <Text ellipsis fontSize={14} style={{ flex: 1 }}>{data.title}</Text><Text fontSize={12} type="secondary">diff --git a/src/features/Acceptance/Viewer/Flow/FlowNode.tsx b/src/features/Acceptance/Viewer/Flow/FlowNode.tsxindex f1dfabf0b35..0956e1e55d4 100644--- a/src/features/Acceptance/Viewer/Flow/FlowNode.tsx+++ b/src/features/Acceptance/Viewer/Flow/FlowNode.tsx@@ -1,18 +1,19 @@'use client';-import { Flexbox, Icon } from '@lobehub/ui';+import { Icon } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { Handle, Position } from '@xyflow/react';import {- CheckCircle2,+ BadgeCheck,+ Check,CircleDashed,CircleDot,CircleHelp,CirclePause,CircleX,- Paperclip,Repeat2,+ RotateCcw,} from 'lucide-react';import { useTranslation } from 'react-i18next';@@ -20,89 +21,171 @@ export interface FlowNodeData extends Record<string, unknown> {attempts: number;evidence: number;expected: string;+ order?: number;+ review?: 'accepted' | 'rejected';selected: boolean;state?: 'passed' | 'failed' | 'uncertain' | 'blocked' | 'partial';+ thumbnail?: string;title: string;}-export const flowStateBackground = (state?: string) =>- state === 'passed'- ? cssVar.colorSuccessBg- : state === 'failed'- ? cssVar.colorErrorBg- : state- ? cssVar.colorWarningBg- : cssVar.colorFillTertiary;+export const flowStateBackground = (state?: string) => {+ switch (state) {+ case undefined: {+ return cssVar.colorFillTertiary;+ }+ case 'passed': {+ return cssVar.colorSuccessBg;+ }+ case 'failed': {+ return cssVar.colorErrorBg;+ }+ default: {+ return cssVar.colorWarningBg;+ }+ }+};-export const flowStateColor = (state?: string) =>- state === 'passed'- ? cssVar.colorSuccess- : state === 'failed'- ? cssVar.colorError- : state- ? cssVar.colorWarning- : cssVar.colorTextTertiary;+export const flowStateColor = (state?: string) => {+ switch (state) {+ case undefined: {+ return cssVar.colorTextQuaternary;+ }+ case 'passed': {+ return cssVar.colorSuccess;+ }+ case 'failed': {+ return cssVar.colorError;+ }+ default: {+ return cssVar.colorWarning;+ }+ }+};++export const flowStateIcon = (state?: string) => {+ switch (state) {+ case 'passed': {+ return Check;+ }+ case 'failed': {+ return CircleX;+ }+ case 'blocked': {+ return CirclePause;+ }+ case 'partial': {+ return CircleDot;+ }+ case 'uncertain': {+ return CircleHelp;+ }+ default: {+ return CircleDashed;+ }+ }+};const styles = stylex.create({card: {overflow: 'hidden',display: 'flex',flexDirection: 'column',+ gap: '8px',width: '260px',height: '100%',+ padding: '8px',borderWidth: '1px',borderStyle: 'solid',- borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorPrimaryBorder },+ borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },borderRadius: cssVar.borderRadiusLG,backgroundColor: cssVar.colorBgContainer,backgroundImage: 'none',transition: 'border-color 0.15s,\n box-shadow 0.15s',},selected: {- borderColor: cssVar.colorPrimaryBorder,- boxShadow: `0 0 0 2px ${cssVar.colorPrimaryBg}`,+ borderColor: { 'default': cssVar.colorPrimary, ':hover': cssVar.colorPrimary },+ boxShadow: `0 0 0 1px ${cssVar.colorPrimary}`,},- head: { paddingBlock: '12px', paddingInline: '12px' },- glyph: {+ frame: {+ position: 'relative',+ overflow: 'hidden',display: 'flex',flex: 'none',alignItems: 'center',justifyContent: 'center',- width: '36px',- height: '36px',- borderRadius: cssVar.borderRadius,+ height: '132px',+ borderRadius: '6px',+ backgroundColor: cssVar.colorFillQuaternary,+ },+ frameEmpty: {+ borderWidth: '1px',+ borderStyle: 'dashed',+ borderColor: cssVar.colorBorder,+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,+ textAlign: 'center',+ },+ picture: {+ display: 'block',+ maxWidth: '100%',+ maxHeight: '100%',+ objectFit: 'contain',+ },+ order: {+ position: 'absolute',+ insetBlockStart: '8px',+ insetInlineStart: '8px',+ minWidth: '20px',+ height: '20px',+ paddingInline: '4px',+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: cssVar.colorBorderSecondary,+ borderRadius: '4px',+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '18px',color: cssVar.colorTextSecondary,- backgroundColor: cssVar.colorFillTertiary,- backgroundImage: 'none',+ textAlign: 'center',+ backgroundColor: cssVar.colorBgElevated,+ },+ caption: {+ display: 'flex',+ gap: '8px',+ alignItems: 'flex-start',+ paddingInline: '4px',},title: {overflow: 'hidden',display: '-webkit-box',WebkitBoxOrient: 'vertical',WebkitLineClamp: '2',- fontSize: '13px',+ fontSize: '14px',fontWeight: 500,- lineHeight: 1.4,- },- subtitle: {- overflow: 'hidden',- display: '-webkit-box',- WebkitBoxOrient: 'vertical',- WebkitLineClamp: '2',- fontSize: '11px',- lineHeight: '16px',- color: cssVar.colorTextTertiary,+ lineHeight: '22px',},footer: {+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ justifyContent: 'space-between',marginBlockStart: 'auto',- paddingBlock: '7px',- paddingInline: '12px',- borderBlockStartWidth: '1px',- borderBlockStartStyle: 'dashed',- borderBlockStartColor: cssVar.colorBorderSecondary,- fontSize: '11px',+ paddingInline: '4px',+ paddingBlockEnd: '4px',+ fontSize: '12px',+ lineHeight: '20px',color: cssVar.colorTextTertiary,},+ meta: {+ display: 'inline-flex',+ gap: '4px',+ alignItems: 'center',+ },+ reviewAccepted: { color: cssVar.colorSuccessText },+ reviewRejected: { color: cssVar.colorErrorText },+ reviewPending: { color: cssVar.colorTextSecondary },handle: {width: '1px',minWidth: '0',@@ -113,21 +196,37 @@ const styles = stylex.create({},});-/** Same status/head/summary hierarchy as Goal's exploration cards. */+function FlowNodeDecision({ attempts, review }: Pick<FlowNodeData, 'attempts' | 'review'>) {+ const { t } = useTranslation('verify');+ if (attempts === 0) return <span>{t('acceptance.decision.notRun')}</span>;+ switch (review) {+ case 'accepted': {+ return (+ <span {...stylex.props(styles.meta, styles.reviewAccepted)}>+ <Icon icon={BadgeCheck} size={14} />+ {t('acceptance.focus.state.accepted')}+ </span>+ );+ }+ case 'rejected': {+ return (+ <span {...stylex.props(styles.meta, styles.reviewRejected)}>+ <Icon icon={RotateCcw} size={14} />+ {t('acceptance.focus.state.needsFix')}+ </span>+ );+ }+ default: {+ return (+ <span {...stylex.props(styles.reviewPending)}>{t('acceptance.focus.state.pending')}</span>+ );+ }+ }+}+export function FlowNode({ data }: { data: FlowNodeData }) {const { t } = useTranslation('verify');- const statusIcon =- data.state === 'passed'- ? CheckCircle2- : data.state === 'failed'- ? CircleX- : data.state === 'blocked'- ? CirclePause- : data.state === 'partial'- ? CircleDot- : data.state === 'uncertain'- ? CircleHelp- : CircleDashed;+ const verdict = t(`flow.state.${data.state ?? 'pending'}`);return (<><Handle@@ -137,38 +236,41 @@ export function FlowNode({ data }: { data: FlowNodeData }) {type="target"/><div {...stylex.props(styles.card, data.selected && styles.selected)}>- <Flexbox horizontal className={stylex.props(styles.head).className} gap={10}>- <div- aria-label={t(`flow.state.${data.state ?? 'pending'}`)}- className={stylex.props(styles.glyph).className}+ <div {...stylex.props(styles.frame, !data.thumbnail && styles.frameEmpty)}>+ {data.thumbnail ? (+ <img+ alt={data.title}+ draggable={false}+ src={data.thumbnail}+ {...stylex.props(styles.picture)}+ />+ ) : (+ t(data.attempts === 0 ? 'flow.unvisitedShort' : 'flow.noPicture')+ )}+ {data.order !== undefined && <span {...stylex.props(styles.order)}>{data.order}</span>}+ </div>+ <div {...stylex.props(styles.caption)}>+ <span+ aria-label={verdict}role="img"- style={{- background: flowStateBackground(data.state),- color: flowStateColor(data.state),- }}+ style={{ display: 'inline-flex', flex: 'none', marginBlockStart: 3 }}+ title={`${t('acceptance.focus.judgeLabel')} · ${verdict}`}>- <Icon icon={statusIcon} size={24} />- </div>- <Flexbox gap={3} style={{ minWidth: 0 }}>- <span {...stylex.props(styles.title)}>{data.title}</span>- <span {...stylex.props(styles.subtitle)}>{data.expected}</span>- </Flexbox>- </Flexbox>- <Flexbox- horizontal- align="center"- className={stylex.props(styles.footer).className}- gap={12}- >- <Flexbox horizontal align="center" gap={4}>- <Icon icon={Repeat2} size={12} />- {data.attempts}- </Flexbox>- <Flexbox horizontal align="center" gap={4}>- <Icon icon={Paperclip} size={12} />- {data.evidence}- </Flexbox>- </Flexbox>+ <Icon color={flowStateColor(data.state)} icon={flowStateIcon(data.state)} size={16} />+ </span>+ <span {...stylex.props(styles.title)}>{data.title}</span>+ </div>+ <div {...stylex.props(styles.footer)}>+ <span {...stylex.props(styles.meta)}>+ {data.attempts > 1 && (+ <>+ <Icon icon={Repeat2} size={12} />+ {data.attempts}+ </>+ )}+ </span>+ <FlowNodeDecision attempts={data.attempts} review={data.review} />+ </div></div><HandleclassName={stylex.props(styles.handle).className}diff --git a/src/features/Acceptance/Viewer/Flow/FlowResults.tsx b/src/features/Acceptance/Viewer/Flow/FlowResults.tsxindex 37d70f8c5b6..13a7e598bd0 100644--- a/src/features/Acceptance/Viewer/Flow/FlowResults.tsx+++ b/src/features/Acceptance/Viewer/Flow/FlowResults.tsx@@ -1,22 +1,32 @@'use client';-import { ActionIcon, Button, Flexbox, Icon, Select, Text, TextArea, toast } from '@lobehub/ui';+import { ActionIcon, Button, Flexbox, Icon, Select, Text, toast } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import { ClipboardCheck, History, X } from 'lucide-react';+import { BadgeCheck, Check, MessageSquareX, RotateCcw, X } from 'lucide-react';import { useState } from 'react';import { useTranslation } from 'react-i18next';import { type AcceptanceBundle, verifyService } from '@/services/verify';+import { sx } from '@/styles/sx';import { AttachmentThumbs } from '../Evidence/attachments';import { EvidenceList } from '../Evidence/EvidenceList';import { openCheckRejectModal } from '../Review/CheckRejectModal';-import { flowStateColor } from './FlowNode';+import { flowStateColor, flowStateIcon } from './FlowNode';+import { hasReviewRecord } from './flowStoryboard';type FlowVersion = AcceptanceBundle['flows'][number]['versions'][number];type FlowAttempt = FlowVersion['runs'][number]['attempts'][number];+const MAX_ATTEMPT_TABS = 3;++const REVIEW_LABEL_KEY = {+ accepted: 'acceptance.focus.state.accepted',+ pending: 'acceptance.focus.state.pending',+ rejected: 'acceptance.focus.state.needsFix',+} as const;+const styles = stylex.create({panel: {overflow: 'hidden',@@ -29,153 +39,118 @@ const styles = stylex.create({backgroundColor: cssVar.colorBgContainer,},header: {+ flex: 'none',padding: '16px',borderBlockEndWidth: '1px',borderBlockEndStyle: 'solid',borderBlockEndColor: cssVar.colorBorderSecondary,},+ path: {+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,+ },+ title: {+ margin: 0,+ fontSize: '16px',+ fontWeight: 600,+ lineHeight: '24px',+ },+ status: {+ display: 'inline-flex',+ gap: '4px',+ alignItems: 'center',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ statusAccepted: { color: cssVar.colorSuccessText },+ statusRejected: { color: cssVar.colorErrorText },body: {overflow: 'auto',+ flex: '1',minHeight: 0,padding: '16px',},+ attemptTabs: {+ display: 'inline-flex',+ alignSelf: 'flex-start',+ gap: '2px',+ padding: '2px',+ borderRadius: '8px',+ backgroundColor: cssVar.colorFillTertiary,+ },+ attemptTab: {+ cursor: 'pointer',+ height: '28px',+ margin: 0,+ paddingBlock: 0,+ paddingInline: '12px',+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '6px',+ font: 'inherit',+ fontSize: '12px',+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },+ whiteSpace: 'nowrap',+ backgroundColor: 'transparent',+ outlineWidth: { 'default': 0, ':focus-visible': '2px' },+ outlineStyle: { 'default': 'none', ':focus-visible': 'solid' },+ outlineColor: cssVar.colorPrimary,+ },+ attemptTabActive: {+ fontWeight: 500,+ color: { 'default': cssVar.colorText, ':hover': cssVar.colorText },+ backgroundColor: cssVar.colorBgContainer,+ boxShadow: cssVar.boxShadowTertiary,+ },+ compare: {+ display: 'grid',+ gridTemplateColumns: '88px minmax(0, 1fr)',+ columnGap: '16px',+ rowGap: '8px',+ margin: 0,+ },+ compareTerm: {+ fontSize: '12px',+ lineHeight: '22px',+ color: cssVar.colorTextSecondary,+ },+ compareValue: {+ margin: 0,+ lineHeight: '22px',+ overflowWrap: 'anywhere',+ whiteSpace: 'pre-wrap',+ },plan: {fontSize: '12px',color: cssVar.colorTextSecondary,},planSummary: {cursor: 'pointer',- paddingBlock: '6px',+ paddingBlock: '4px',},- observation: {- lineHeight: 1.7,- overflowWrap: 'anywhere',- whiteSpace: 'pre-wrap',- },- review: {- paddingBlockStart: '16px',+ footer: {+ flex: 'none',+ paddingBlock: '12px',+ paddingInline: '16px',borderBlockStartWidth: '1px',borderBlockStartStyle: 'solid',borderBlockStartColor: cssVar.colorBorderSecondary,},});-function AttemptReview({- acceptanceId,- attempt,- onSaved,-}: {- acceptanceId: string;- attempt: FlowAttempt;- onSaved: () => Promise<unknown>;-}) {- const { t } = useTranslation('verify');- const [editing, setEditing] = useState(false);- const [comment, setComment] = useState(attempt.reviewComment ?? '');- const [saving, setSaving] = useState(false);- return (- <Flexbox gap={10} {...stylex.props(styles.review)}>- {attempt.review && (- <Text>- {t(`flow.review.${attempt.review}`)}- {attempt.reviewComment ? ` · ${attempt.reviewComment}` : ''}- </Text>- )}- {attempt.reviewDetail?.annotations?.map((annotation, index) => (- <Text fontSize={12} key={`${annotation.evidenceId}:${index}`}>- {index + 1}. {annotation.comment}- </Text>- ))}- <AttachmentThumbs attachments={attempt.reviewAttachments} />- <Button- onClick={() =>- openCheckRejectModal({- checkTitle: t('flow.annotate'),- draftKey: attempt.id,- evidence: attempt.evidence- .filter((e) => e.type === 'screenshot' && e.fileUrl)- .map((e) => ({ id: e.id, fileUrl: e.fileUrl! })),- initialAnnotations: attempt.reviewDetail?.annotations,- initialComment: comment,- onConfirm: async (feedback) => {- try {- await verifyService.reviewFlowStep({- id: acceptanceId,- attemptId: attempt.id,- review: 'rejected',- ...feedback,- });- await onSaved();- setComment(feedback.comment);- setEditing(false);- return true;- } catch (error) {- console.error(error);- toast.error(t('flow.saveError'));- return false;- }- },- })- }- >- {t('flow.annotate')}- </Button>- {!editing ? (- <Button onClick={() => setEditing(true)}>- {t(attempt.review ? 'flow.editReview' : 'flow.reviewResult')}- </Button>- ) : (- <>- <TextArea- placeholder={t('flow.comment')}- value={comment}- onChange={(e) => setComment(e.target.value)}- />- <Flexbox horizontal gap={8}>- {(['accepted', 'rejected'] as const).map((review) => (- <Button- disabled={saving}- key={review}- onClick={async () => {- setSaving(true);- try {- await verifyService.reviewFlowStep({- id: acceptanceId,- attemptId: attempt.id,- review,- comment,- annotations: attempt.reviewDetail?.annotations,- fileIds: attempt.reviewDetail?.fileIds,- });- await onSaved();- setEditing(false);- } catch (error) {- console.error(error);- toast.error(t('flow.saveError'));- } finally {- setSaving(false);- }- }}- >- {t(`flow.review.${review}`)}- </Button>- ))}- </Flexbox>- </>- )}- </Flexbox>- );-}--/** Selecting history and drafting a review only update the reading panel, never the map. */export function FlowResults({acceptanceId,attempts,canReview,edges,node,+ nodes,onClose,onSaved,+ position,selectedEdge,}: {acceptanceId: string;@@ -183,12 +158,15 @@ export function FlowResults({canReview: boolean;edges: FlowVersion['edges'];node: FlowVersion['nodes'][number];+ nodes: FlowVersion['nodes'];onClose: () => void;onSaved: () => Promise<unknown>;+ position?: { index: number; total: number };selectedEdge?: FlowVersion['edges'][number];}) {const { t } = useTranslation('verify');const [attemptId, setAttemptId] = useState<string>();+ const [saving, setSaving] = useState(false);const ordered = [...attempts].reverse();const attempt = ordered.find((a) => a.id === attemptId) ?? ordered[0];const evidence =@@ -202,27 +180,104 @@ export function FlowResults({...(overlays.get(annotation.evidenceId) ?? []),annotation,]);++ const incoming = selectedEdge ?? edges.find((edge) => edge.id === attempt?.incomingEdgeId);+ const source = incoming && nodes.find((item) => item.nodeKey === incoming.sourceNodeKey);+ const reachedText = () => {+ if (!incoming) return undefined;+ if (!source) return t('flow.walk.reachedBy', { trigger: incoming.trigger });+ return t('flow.walk.reachedFrom', { source: source.title, trigger: incoming.trigger });+ };+ const pathText = [position ? t('flow.walk.position', position) : undefined, reachedText()]+ .filter(Boolean)+ .join(' · ');+ const attemptLabel = (item: FlowAttempt, index: number) =>+ index === 0+ ? t('flow.walk.latestAttempt', { number: item.sequence })+ : t('flow.walk.attempt', { number: item.sequence });++ const accept = async () => {+ if (!attempt) return;+ setSaving(true);+ try {+ await verifyService.reviewFlowStep({+ id: acceptanceId,+ attemptId: attempt.id,+ review: 'accepted',+ comment: attempt.reviewComment ?? '',+ annotations: attempt.reviewDetail?.annotations,+ fileIds: attempt.reviewDetail?.fileIds,+ });+ await onSaved();+ } catch (error) {+ console.error(error);+ toast.error(t('flow.saveError'));+ } finally {+ setSaving(false);+ }+ };++ const reject = () => {+ if (!attempt) return;+ openCheckRejectModal({+ checkTitle: node.title,+ draftKey: attempt.id,+ evidence: (attempt.evidence ?? [])+ .filter((e) => e.type === 'screenshot' && e.fileUrl)+ .map((e) => ({ id: e.id, fileUrl: e.fileUrl! })),+ initialAnnotations: attempt.reviewDetail?.annotations,+ initialComment: attempt.reviewComment ?? '',+ onConfirm: async (feedback) => {+ try {+ await verifyService.reviewFlowStep({+ id: acceptanceId,+ attemptId: attempt.id,+ review: 'rejected',+ ...feedback,+ });+ await onSaved();+ return true;+ } catch (error) {+ console.error(error);+ toast.error(t('flow.saveError'));+ return false;+ }+ },+ });+ };+return (<Flexbox {...stylex.props(styles.panel)}><Flexboxhorizontal- align="center"+ align="flex-start"gap={12}justify="space-between"{...stylex.props(styles.header)}>- <Flexbox horizontal align="center" gap={10} wrap="wrap">- <Text strong fontSize={16}>- {node.title}- </Text>- {attempt && (- <Flexbox horizontal align="center" gap={4} style={{ flex: 'none' }}>- <Icon color={flowStateColor(attempt.verdict)} icon={ClipboardCheck} size={14} />- <Text fontSize={12} style={{ color: flowStateColor(attempt.verdict) }}>- {t(`flow.state.${attempt.verdict}`)}- </Text>- </Flexbox>- )}+ <Flexbox gap={4} style={{ minWidth: 0 }}>+ {pathText && <span {...stylex.props(styles.path)}>{pathText}</span>}+ <h2 {...stylex.props(styles.title)}>{node.title}</h2>+ <Flexbox horizontal align="center" gap={8} wrap="wrap">+ <span {...sx(styles.status, { color: flowStateColor(attempt?.verdict) })}>+ <Icon icon={flowStateIcon(attempt?.verdict)} size={14} />+ {t('acceptance.focus.judgeLabel')} ·{' '}+ {t(`flow.state.${attempt?.verdict ?? 'pending'}`)}+ </span>+ {attempt && (+ <span+ {...stylex.props(+ styles.status,+ attempt.review === 'accepted' && styles.statusAccepted,+ attempt.review === 'rejected' && styles.statusRejected,+ )}+ >+ {attempt.review === 'accepted' && <Icon icon={BadgeCheck} size={14} />}+ {attempt.review === 'rejected' && <Icon icon={RotateCcw} size={14} />}+ {t(REVIEW_LABEL_KEY[attempt.review ?? 'pending'])}+ </span>+ )}+ </Flexbox></Flexbox><ActionIconaria-label={t('flow.closeResults')}@@ -232,75 +287,87 @@ export function FlowResults({/></Flexbox><Flexbox gap={16} {...stylex.props(styles.body)}>- {selectedEdge && (- <Text type="secondary">- {selectedEdge.trigger}- {selectedEdge.condition ? ` · ${selectedEdge.condition}` : ''}- </Text>- )}- {attempt ? (- <>- <Flexbox gap={10}>- <Flexbox horizontal align="center" gap={6}>- <Icon icon={History} size={14} />- <Text fontSize={12} type="secondary">- {t('flow.resultHistory', { count: attempts.length })}- </Text>- </Flexbox>- <Select- value={attempt.id}- options={ordered.map((a, i) => ({- value: a.id,- label: `${i === 0 ? t('flow.latestResult') : `#${a.sequence}`} · ${edges.find((e) => e.id === a.incomingEdgeId)?.trigger ?? node.title} · ${t(`flow.state.${a.verdict}`)}`,- }))}- onChange={(id) => setAttemptId(String(id))}- />- </Flexbox>- <Flexbox gap={4}>- <Text fontSize={12} type="secondary">- {t('flow.actual')}+ {ordered.length > 1 &&+ (ordered.length <= MAX_ATTEMPT_TABS ? (+ <div aria-label={t('flow.attempts')} role="group" {...stylex.props(styles.attemptTabs)}>+ {ordered.map((item, index) => (+ <button+ aria-pressed={item.id === attempt?.id}+ key={item.id}+ type="button"+ {...stylex.props(+ styles.attemptTab,+ item.id === attempt?.id && styles.attemptTabActive,+ )}+ onClick={() => setAttemptId(item.id)}+ >+ {attemptLabel(item, index)}+ </button>+ ))}+ </div>+ ) : (+ <Select+ aria-label={t('flow.attempts')}+ value={attempt?.id}+ options={ordered.map((item, index) => ({+ value: item.id,+ label: `${attemptLabel(item, index)} · ${t(`flow.state.${item.verdict}`)}`,+ }))}+ onChange={(id) => setAttemptId(String(id))}+ />+ ))}+ {attempt && evidence.length > 0 && <EvidenceList evidence={evidence} overlays={overlays} />}+ <dl {...stylex.props(styles.compare)}>+ <dt {...stylex.props(styles.compareTerm)}>{t('flow.walk.expected')}</dt>+ <dd {...stylex.props(styles.compareValue)}>{node.expected}</dd>+ <dt {...stylex.props(styles.compareTerm)}>{t('flow.walk.observed')}</dt>+ <dd {...stylex.props(styles.compareValue)}>+ {attempt ? attempt.observation : <Text type="secondary">{t('flow.unvisited')}</Text>}+ </dd>+ </dl>+ {attempt && hasReviewRecord(attempt) && (+ <Flexbox gap={4}>+ <Text fontSize={12} type="secondary">+ {t('flow.comment')}+ </Text>+ {attempt.reviewComment && (+ <Text style={{ whiteSpace: 'pre-wrap' }}>{attempt.reviewComment}</Text>+ )}+ {attempt.reviewDetail?.annotations?.map((annotation, index) => (+ <Text fontSize={12} key={`${annotation.evidenceId}:${index}`} type="secondary">+ {index + 1}. {annotation.comment}</Text>- <Text {...stylex.props(styles.observation)}>{attempt.observation}</Text>- </Flexbox>- </>- ) : (- <Text type="secondary">{t('flow.unvisited')}</Text>+ ))}+ <AttachmentThumbs attachments={attempt.reviewAttachments} />+ </Flexbox>)}- <Flexbox gap={4}>- <Text fontSize={12} type="secondary">- {t('flow.expected')}- </Text>- <Text>{node.expected}</Text>- </Flexbox><details {...stylex.props(styles.plan)} open={!attempt}><summary {...stylex.props(styles.planSummary)}>{t('flow.instruction')}</summary><Text>{node.instruction}</Text></details>- {attempt && (- <Flexbox gap={10}>- <Text strong>{t('flow.evidence')}</Text>- {evidence.length ? (- <EvidenceList evidence={evidence} overlays={overlays} />- ) : (- <Text type="secondary">{t('flow.noAttachments')}</Text>- )}- </Flexbox>- )}- {attempt && canReview && (- <AttemptReview- acceptanceId={acceptanceId}- attempt={attempt}- key={attempt.id}- onSaved={onSaved}- />- )}- {attempt?.review && !canReview && (- <Text>- {t(`flow.review.${attempt.review}`)}- {attempt.reviewComment ? ` · ${attempt.reviewComment}` : ''}- </Text>- )}</Flexbox>+ {attempt && canReview && (+ <Flexbox+ horizontal+ align="center"+ gap={8}+ justify="flex-end"+ {...stylex.props(styles.footer)}+ >+ <Button disabled={saving} icon={<Icon icon={MessageSquareX} />} onClick={reject}>+ {t('acceptance.review.reject')}+ </Button>+ <Button+ disabled={saving || attempt.review === 'accepted'}+ icon={<Icon icon={Check} />}+ loading={saving}+ type="primary"+ onClick={accept}+ >+ {t('acceptance.review.accept')}+ </Button>+ </Flexbox>+ )}</Flexbox>);}diff --git a/src/features/Acceptance/Viewer/Flow/FlowToolbar.tsx b/src/features/Acceptance/Viewer/Flow/FlowToolbar.tsxnew file mode 100644index 00000000000..10e06d08ec1--- /dev/null+++ b/src/features/Acceptance/Viewer/Flow/FlowToolbar.tsx@@ -0,0 +1,129 @@+import { ActionIcon, Button, Flexbox, Icon, Select, Text } from '@lobehub/ui';+import { ChevronLeft, ChevronRight, Maximize2, Minimize2 } from 'lucide-react';+import type { ComponentProps, Ref } from 'react';+import { useTranslation } from 'react-i18next';++import { AcceptancePlanReview } from '../Plan/AcceptancePlanReview';+import type { walkNeighbors } from './flowStoryboard';++interface FlowToolbarProps {+ activeKey: string | undefined;+ crumbs: { id: string; title: string }[];+ fullscreen: boolean;+ fullscreenButtonRef: Ref<HTMLButtonElement>;+ keys: string[];+ onDisplayChange: (display: 'graph' | 'outline') => void;+ onFocus: (id: string | undefined) => void;+ onRoundChange: (key: string) => void;+ onSelect: (id: string) => void;+ onToggleFullscreen: () => void;+ runId: ComponentProps<typeof AcceptancePlanReview>['runId'];+ showOutline: boolean;+ stepCount: number;+ walk: ReturnType<typeof walkNeighbors>;+}++export const FlowToolbar = ({+ activeKey,+ crumbs,+ fullscreen,+ fullscreenButtonRef,+ keys,+ onDisplayChange,+ onFocus,+ onRoundChange,+ onSelect,+ onToggleFullscreen,+ runId,+ showOutline,+ stepCount,+ walk,+}: FlowToolbarProps) => {+ const { t } = useTranslation('verify');++ return (+ <>+ <Flexbox horizontal align="center" gap={4}>+ <Button size="small" type="text" onClick={() => onFocus(undefined)}>+ {t('flow.allGroups')}+ </Button>+ {crumbs.map((crumb) => (+ <Flexbox horizontal align="center" gap={4} key={crumb.id}>+ <Text type="secondary">/</Text>+ <Button size="small" type="text" onClick={() => onFocus(crumb.id)}>+ {crumb.title}+ </Button>+ </Flexbox>+ ))}+ </Flexbox>+ <Flexbox horizontal align="center" gap={8} wrap="wrap">+ <AcceptancePlanReview runId={runId} />+ {!showOutline && stepCount > 1 && (+ <>+ {walk.previous && (+ <Button+ aria-label={t('flow.walk.previous', { title: walk.previous.title })}+ icon={<Icon icon={ChevronLeft} />}+ size="small"+ style={{ maxWidth: 200 }}+ onClick={() => onSelect(walk.previous!.id)}+ >+ {walk.previous.title}+ </Button>+ )}+ {walk.next && (+ <Button+ size="small"+ style={{ maxWidth: 240 }}+ onClick={() => onSelect(walk.next!.id)}+ >+ {t(walk.position ? 'flow.walk.next' : 'flow.walk.start', {+ title: walk.next.title,+ })}+ <Icon icon={ChevronRight} />+ </Button>+ )}+ </>+ )}+ <Flexbox horizontal gap={2} role="group">+ <Button+ aria-pressed={showOutline}+ size="small"+ type={showOutline ? 'fill' : 'text'}+ onClick={() => onDisplayChange('outline')}+ >+ {t('flow.outlineView')}+ </Button>+ <Button+ aria-pressed={!showOutline}+ size="small"+ type={showOutline ? 'text' : 'fill'}+ onClick={() => onDisplayChange('graph')}+ >+ {t('flow.graphView')}+ </Button>+ </Flexbox>+ <Select+ size="small"+ style={{ width: 120, flexShrink: 0 }}+ value={activeKey}+ options={keys.map((key) => ({+ value: key,+ label:+ key === 'pending'+ ? t('flow.pendingPlan')+ : t('acceptance.round', { round: Number(key) }),+ }))}+ onChange={onRoundChange}+ />+ <ActionIcon+ aria-label={t(fullscreen ? 'flow.exitFullscreen' : 'flow.fullscreen')}+ icon={fullscreen ? Minimize2 : Maximize2}+ ref={fullscreenButtonRef}+ title={t(fullscreen ? 'flow.exitFullscreen' : 'flow.fullscreen')}+ onClick={onToggleFullscreen}+ />+ </Flexbox>+ </>+ );+};diff --git a/src/features/Acceptance/Viewer/Flow/flowAnchor.ts b/src/features/Acceptance/Viewer/Flow/flowAnchor.tsindex b2ce47fd377..d1baccf5dba 100644--- a/src/features/Acceptance/Viewer/Flow/flowAnchor.ts+++ b/src/features/Acceptance/Viewer/Flow/flowAnchor.ts@@ -5,4 +5,4 @@ import { createContext } from 'react';* of the group the user just toggled is handed to the canvas here, so it can* bring that group back into view once the new layout lands.*/-export const FlowAnchorContext = createContext<{ current: string | null }>({ current: null });+export const FlowAnchorContext = createContext<(nodeId: string | null) => void>(() => {});diff --git a/src/features/Acceptance/Viewer/Flow/flowGraph.ts b/src/features/Acceptance/Viewer/Flow/flowGraph.tsindex e02b7eef97d..e82f5272fb8 100644--- a/src/features/Acceptance/Viewer/Flow/flowGraph.ts+++ b/src/features/Acceptance/Viewer/Flow/flowGraph.ts@@ -2,14 +2,18 @@ import type { Edge, Node } from '@xyflow/react';import type { FlowVersion } from './flowNavigation';import { getFlowNodeState } from './flowNodeState';+import { latestThumbnail } from './flowStoryboard';export interface FlowGraphData extends Record<string, unknown> {collapsed?: boolean;onEnter?: () => void;onToggle?: () => void;+ order?: number;passed?: number;+ review?: 'accepted' | 'rejected';reviewed?: number;state?: 'passed' | 'failed' | 'uncertain' | 'blocked' | 'partial';+ thumbnail?: string;title: string;total?: number;}@@ -137,8 +141,8 @@ export function buildFlowGraph(if (stacked) for (const node of siblings) depths.set(node.id, 0);const parts = orderedSiblings.map((node) => {const id = graphId(view, node.id);- // Two title lines, two expected lines and the footer; the card clamps to this box.- if (!node.subFlowId) return { node, id, width: 260, height: 132 };+ // The screenshot frame, two title lines and the footer; the card clamps to this box.+ if (!node.subFlowId) return { node, id, width: 260, height: 244 };const child = collapsed.has(id) ? undefined : layout(view, node.id, id);return { node, id, child, width: child?.width ?? 320, height: child?.height ?? 96 };});@@ -184,6 +188,8 @@ export function buildFlowGraph(node.entryRequired,),attempts: visits.length,+ review: visits.at(-1)?.review ?? undefined,+ thumbnail: latestThumbnail(visits),evidence: visits.flatMap((v) => v.evidence.filter((e) => e.fileUrl)).length,};resultNodes.push({diff --git a/src/features/Acceptance/Viewer/Flow/flowStoryboard.test.ts b/src/features/Acceptance/Viewer/Flow/flowStoryboard.test.tsnew file mode 100644index 00000000000..41173cec6d3--- /dev/null+++ b/src/features/Acceptance/Viewer/Flow/flowStoryboard.test.ts@@ -0,0 +1,74 @@+import { describe, expect, it } from 'vitest';++import { hasReviewRecord, latestThumbnail, walkNeighbors, walkOrder } from './flowStoryboard';++const node = (id: string, type: string, title = id) => ({ data: { title }, id, type });++describe('walkOrder', () => {+ it('numbers only the states, in the order the canvas lays them out', () => {+ expect(+ walkOrder([+ node('g', 'flowGroup'),+ node('a', 'state', 'Sidebar'),+ node('b', 'state', 'Usage'),+ ]),+ ).toEqual([+ { id: 'a', title: 'Sidebar' },+ { id: 'b', title: 'Usage' },+ ]);+ });+});++describe('walkNeighbors', () => {+ const order = [+ { id: 'a', title: 'A' },+ { id: 'b', title: 'B' },+ { id: 'c', title: 'C' },+ ];++ it('offers the first state when nothing is selected yet', () => {+ expect(walkNeighbors(order, undefined)).toEqual({+ next: order[0],+ position: 0,+ previous: undefined,+ });+ });++ it('steps both ways from the middle and stops at the ends', () => {+ expect(walkNeighbors(order, 'b')).toEqual({ next: order[2], position: 2, previous: order[0] });+ expect(walkNeighbors(order, 'c')).toEqual({ next: undefined, position: 3, previous: order[1] });+ });+});++describe('latestThumbnail', () => {+ const shot = (fileUrl: string | null, type = 'screenshot') => ({ fileUrl, type });++ it('takes the first screenshot of the newest visit that has one', () => {+ expect(+ latestThumbnail([+ { evidence: [shot('old.png')] },+ { evidence: [shot(null), shot('clip.mp4', 'video'), shot('new.png')] },+ ]),+ ).toBe('new.png');+ });++ it('falls back to an earlier visit when the newest left no picture', () => {+ expect(latestThumbnail([{ evidence: [shot('old.png')] }, { evidence: [] }])).toBe('old.png');+ });++ it('has nothing to show for a state never captured', () => {+ expect(latestThumbnail([])).toBeUndefined();+ });+});++describe('hasReviewRecord', () => {+ it('counts a rejection that carries only circled regions or only an attachment', () => {+ expect(hasReviewRecord({})).toBe(false);+ expect(hasReviewRecord({ reviewComment: 'Range resets' })).toBe(true);+ expect(hasReviewRecord({ reviewDetail: { annotations: [{}] } })).toBe(true);+ expect(hasReviewRecord({ reviewAttachments: [{}] })).toBe(true);+ expect(hasReviewRecord({ reviewAttachments: [], reviewDetail: { annotations: [] } })).toBe(+ false,+ );+ });+});diff --git a/src/features/Acceptance/Viewer/Flow/flowStoryboard.ts b/src/features/Acceptance/Viewer/Flow/flowStoryboard.tsnew file mode 100644index 00000000000..e84b0e736b3--- /dev/null+++ b/src/features/Acceptance/Viewer/Flow/flowStoryboard.ts@@ -0,0 +1,40 @@+export interface WalkStep {+ id: string;+ title: string;+}++export const walkOrder = (+ nodes: { data: { title: string }; id: string; type?: string }[],+): WalkStep[] =>+ nodes+ .filter((node) => node.type === 'state')+ .map((node) => ({ id: node.id, title: node.data.title }));++export const walkNeighbors = (order: WalkStep[], selectedId: string | undefined) => {+ const index = order.findIndex((step) => step.id === selectedId);+ if (index < 0) return { next: order[0], position: 0, previous: undefined };+ return { next: order[index + 1], position: index + 1, previous: order[index - 1] };+};++const THUMBNAIL_TYPES = new Set(['screenshot', 'gif']);++export const latestThumbnail = (+ visits: { evidence: { fileUrl?: string | null; type: string }[] }[],+): string | undefined => {+ for (const visit of [...visits].reverse()) {+ const picture = visit.evidence.find((item) => item.fileUrl && THUMBNAIL_TYPES.has(item.type));+ if (picture?.fileUrl) return picture.fileUrl;+ }+ return undefined;+};++export const hasReviewRecord = (attempt: {+ reviewAttachments?: unknown[] | null;+ reviewComment?: string | null;+ reviewDetail?: { annotations?: unknown[] | null } | null;+}) =>+ Boolean(+ attempt.reviewComment ||+ attempt.reviewDetail?.annotations?.length ||+ attempt.reviewAttachments?.length,+ );diff --git a/src/features/Acceptance/Viewer/Flow/flowViewport.test.ts b/src/features/Acceptance/Viewer/Flow/flowViewport.test.tsindex 2aa8d6c3dc8..14f154c0f5d 100644--- a/src/features/Acceptance/Viewer/Flow/flowViewport.test.ts+++ b/src/features/Acceptance/Viewer/Flow/flowViewport.test.ts@@ -1,6 +1,6 @@import { describe, expect, it, vi } from 'vitest';-import { getSelectedFlowNodeId, isRectVisible, panNodeIntoView } from './flowViewport';+import { getSelectedFlowNodeId, isRectVisible, panNodeIntoView, revealNode } from './flowViewport';const size = { height: 600, width: 1000 };@@ -91,3 +91,29 @@ describe('getSelectedFlowNodeId', () => {expect(getSelectedFlowNodeId([{ data: {}, id: 'a' }])).toBeUndefined();});});++describe('revealNode', () => {+ const size = { height: 600, width: 800 };+ const flowAt = (+ viewport: { x: number; y: number; zoom: number },+ bounds = { height: 200, width: 260, x: 1000, y: 100 },+ ) => {+ const setViewport = vi.fn();+ return {+ flow: { getNodesBounds: () => bounds, getViewport: () => viewport, setViewport },+ setViewport,+ };+ };++ it('brings a half-clipped state fully inside, which a click would have left alone', () => {+ const { flow, setViewport } = flowAt({ x: -300, y: 0, zoom: 1 });+ revealNode(flow, size, 'n');+ expect(setViewport).toHaveBeenCalledWith({ x: -484, y: 0, zoom: 1 });+ });++ it('leaves the canvas still when the state is already whole on screen', () => {+ const { flow, setViewport } = flowAt({ x: -700, y: 0, zoom: 1 });+ revealNode(flow, size, 'n');+ expect(setViewport).not.toHaveBeenCalled();+ });+});diff --git a/src/features/Acceptance/Viewer/Flow/flowViewport.ts b/src/features/Acceptance/Viewer/Flow/flowViewport.tsindex c42cc31d294..6b6bda9d5d7 100644--- a/src/features/Acceptance/Viewer/Flow/flowViewport.ts+++ b/src/features/Acceptance/Viewer/Flow/flowViewport.ts@@ -43,6 +43,21 @@ const axisShift = (start: number, length: number, extent: number) => {return overflow > 0 ? -overflow : 0;};+export const revealNode = (flow: FlowViewportApi, size: CanvasSize, id: string | undefined) => {+ if (!id) return;+ const bounds = flow.getNodesBounds([id]);+ if (!bounds.width || !bounds.height) return;+ const viewport = flow.getViewport();+ const x =+ viewport.x ++ axisShift(bounds.x * viewport.zoom + viewport.x, bounds.width * viewport.zoom, size.width);+ const y =+ viewport.y ++ axisShift(bounds.y * viewport.zoom + viewport.y, bounds.height * viewport.zoom, size.height);+ if (x === viewport.x && y === viewport.y) return;+ flow.setViewport({ ...viewport, x, y });+};+/*** Rescue a node that the narrower canvas pushed off screen entirely, by panning* the least possible distance and never by zooming.@@ -60,14 +75,6 @@ export const panNodeIntoView = (if (!id) return;const bounds = flow.getNodesBounds([id]);if (!bounds.width || !bounds.height) return;- const viewport = flow.getViewport();- if (isRectVisible(bounds, viewport, size)) return;- const x =- viewport.x +- axisShift(bounds.x * viewport.zoom + viewport.x, bounds.width * viewport.zoom, size.width);- const y =- viewport.y +- axisShift(bounds.y * viewport.zoom + viewport.y, bounds.height * viewport.zoom, size.height);- if (x === viewport.x && y === viewport.y) return;- flow.setViewport({ ...viewport, x, y });+ if (isRectVisible(bounds, flow.getViewport(), size)) return;+ revealNode(flow, size, id);};diff --git a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsxindex f7ec1d2ca63..269565e08c3 100644--- a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx@@ -4,7 +4,7 @@ import type { AcceptanceChecklistItem } from '@lobechat/types';import { Button, Flexbox, Icon, Text, useResponsive } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import { ArrowLeft, ChevronDown, ChevronLeft, ChevronRight, Plus } from 'lucide-react';+import { ArrowLeft, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Plus } from 'lucide-react';import { useState } from 'react';import { useTranslation } from 'react-i18next';@@ -25,13 +25,10 @@ const phone = '@media (width <= 767px)';// ('visible') and acceptanceFocusedLayout.contentPaddingBlock ('32px 24px') from// ../layout: StyleX cannot read constants from another module.const styles = stylex.create({- mobileNavigation: {- position: 'sticky',- zIndex: 2,- insetBlockStart: '-16px',+ phoneStep: {flex: 'none',- paddingBlock: '8px',- backgroundColor: cssVar.colorBgContainer,+ minWidth: '44px',+ minHeight: '44px',},countBadge: {paddingBlock: '1px',@@ -73,8 +70,8 @@ const styles = stylex.create({paddingInline: { default: '32px', [phone]: '16px' },},content: {- flex: 'none',- width: 'min(880px, 100%)',+ flex: { default: 'none', [phone]: '1 0 auto' },+ width: 'min(1120px, 100%)',marginInline: 'auto',},});@@ -124,10 +121,6 @@ const AcceptanceFocusReview = ({return (<div {...stylex.props(styles.layout)}><Flexbox {...stylex.props(styles.outline)}>- {/* The phone top line is a breadcrumb, not a nav bar: it introduces the- check and hands off to the outline. The row below it already owns- 44px targets for stepping between checks, so stacking another- 44px band here just pushed the check itself down the screen. */}<Flexboxalign={md ? undefined : 'center'}flex={'none'}@@ -142,9 +135,9 @@ const AcceptanceFocusReview = ({size={'small'}type={'text'}style={{- alignSelf: 'flex-start',- minHeight: md ? undefined : 30,- minWidth: md ? undefined : 30,+ alignSelf: md ? 'flex-start' : undefined,+ minHeight: md ? undefined : 44,+ minWidth: md ? undefined : 44,}}onClick={onBack}>@@ -153,20 +146,42 @@ const AcceptanceFocusReview = ({{!md && (<Buttonaria-expanded={outlineOpen}- icon={<Icon icon={outlineOpen ? ChevronDown : ChevronRight} size={14} />}- size={'small'}+ icon={<Icon icon={outlineOpen ? ChevronUp : ChevronDown} size={16} />}+ iconPosition={'end'}type={'text'}style={{- fontSize: 13,- minHeight: 30,- paddingInline: 6,- textAlign: 'start',+ flex: 1,+ fontSize: 14,+ justifyContent: 'flex-start',+ minHeight: 44,+ minWidth: 0,+ paddingInline: 8,}}onClick={() => setOutlineOpen((open) => !open)}>{t('acceptance.checks.title')} · {currentIndex + 1} / {orderedChecks.length}</Button>)}+ {!md && (+ <Button+ aria-label={t('acceptance.focus.previous')}+ className={stylex.props(styles.phoneStep).className}+ disabled={currentIndex <= 0}+ icon={<Icon icon={ChevronLeft} size={20} />}+ type={'text'}+ onClick={() => onSelectCheck(orderedChecks[currentIndex - 1].id)}+ />+ )}+ {!md && (+ <Button+ aria-label={t('acceptance.focus.next')}+ className={stylex.props(styles.phoneStep).className}+ disabled={currentIndex >= orderedChecks.length - 1}+ icon={<Icon icon={ChevronRight} size={20} />}+ type={'text'}+ onClick={() => onSelectCheck(orderedChecks[currentIndex + 1].id)}+ />+ )}{md && (<Flexbox gap={4} paddingInline={4}><Text strong style={{ fontSize: 15 }}>@@ -174,7 +189,7 @@ const AcceptanceFocusReview = ({</Text><Flexbox horizontal align={'center'} gap={6}><AcceptanceStatusPill size={12} status={status} />- <Text fontSize={11} type={'secondary'}>+ <Text fontSize={12} type={'secondary'}>{t('acceptance.roundCount', { count: roundCount })}</Text></Flexbox>@@ -182,7 +197,7 @@ const AcceptanceFocusReview = ({)}{md && (<Flexbox horizontal align={'center'} gap={8} paddingInline={4}>- <Text strong style={{ fontSize: 13 }}>+ <Text strong style={{ fontSize: 14 }}>{t('acceptance.checks.title')}</Text><span {...stylex.props(styles.countBadge)}>@@ -219,27 +234,6 @@ const AcceptanceFocusReview = ({</Flexbox><Flexbox key={focusedCheck.id} {...stylex.props(styles.main)}>- {!md && (- <Flexbox horizontal align={'center'} gap={8} {...stylex.props(styles.mobileNavigation)}>- <Button- aria-label={t('acceptance.focus.previous')}- disabled={currentIndex <= 0}- icon={<Icon icon={ChevronLeft} />}- style={{ minHeight: 44, minWidth: 44 }}- onClick={() => onSelectCheck(orderedChecks[currentIndex - 1].id)}- />- <Text style={{ flex: 1, textAlign: 'center' }}>- {currentIndex + 1} / {orderedChecks.length}- </Text>- <Button- aria-label={t('acceptance.focus.next')}- disabled={currentIndex >= orderedChecks.length - 1}- icon={<Icon icon={ChevronRight} />}- style={{ minHeight: 44, minWidth: 44 }}- onClick={() => onSelectCheck(orderedChecks[currentIndex + 1].id)}- />- </Flexbox>- )}<Flexbox gap={16} {...stylex.props(styles.content)}><FocusCheckHeadingcheck={focusedCheck}diff --git a/src/features/Acceptance/Viewer/Focus/FocusCheckHeading.tsx b/src/features/Acceptance/Viewer/Focus/FocusCheckHeading.tsxindex 8e02bb9c706..2039c0e4e61 100644--- a/src/features/Acceptance/Viewer/Focus/FocusCheckHeading.tsx+++ b/src/features/Acceptance/Viewer/Focus/FocusCheckHeading.tsx@@ -89,7 +89,7 @@ export const FocusCheckHeading = memo<FocusCheckHeadingProps>(</Text></Flexbox>{showVerdictDescription && (- <Text fontSize={13} type={'secondary'}>+ <Text fontSize={14} type={'secondary'}>{t(`acceptance.focus.verifierDescription.${verdict}`)}</Text>)}diff --git a/src/features/Acceptance/Viewer/Focus/FocusOutline.tsx b/src/features/Acceptance/Viewer/Focus/FocusOutline.tsxindex cca35b8f76c..3c4f8b3803e 100644--- a/src/features/Acceptance/Viewer/Focus/FocusOutline.tsx+++ b/src/features/Acceptance/Viewer/Focus/FocusOutline.tsx@@ -89,7 +89,7 @@ export const FocusOutline = memo<FocusOutlineProps>(style={{color: cssVar.colorTextQuaternary,fontFamily: cssVar.fontFamilyCode,- fontSize: 11,+ fontSize: 12,}}>C{check.seq}@@ -103,7 +103,7 @@ export const FocusOutline = memo<FocusOutlineProps>(})}{standingChecks.length > 0 && onEditStandingCheck && (<Flexbox gap={4} paddingBlock={8} paddingInline={8} {...stylex.props(styles.row)}>- <Text fontSize={11} type={'secondary'}>+ <Text fontSize={12} type={'secondary'}>{t('acceptance.checkCreate.pendingGroup')}</Text>{standingChecks.map((item) => (diff --git a/src/features/Acceptance/Viewer/Gate/GateDecision.tsx b/src/features/Acceptance/Viewer/Gate/GateDecision.tsxnew file mode 100644index 00000000000..aafd7891e7a--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/GateDecision.tsx@@ -0,0 +1,200 @@+'use client';++import type { GoalReleaseGateDossier } from '@lobechat/types';+import { Button, TextArea, toast } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { useState } from 'react';+import { useTranslation } from 'react-i18next';++import { verifyService } from '@/services/verify';+import { useVerifyStore } from '@/store/verify';++import { useAcceptanceScope } from '../AcceptanceScope';+import { useAcceptanceComments } from '../Comments/hooks';+import { useAcceptanceBundle } from '../useAcceptanceBundle';+import { canReviewAcceptance, isReadOnlyAcceptanceDecider } from '../visibility';+import { latestRound } from './dossier';++export type GateDecisionKind = 'release' | 'revise';++const styles = stylex.create({+ actions: {+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ },+ bar: {+ display: 'flex',+ flexWrap: 'wrap',+ rowGap: '12px',+ columnGap: '16px',+ alignItems: 'center',+ },+ footer: {+ display: 'flex',+ flexDirection: 'column',+ gap: '12px',+ paddingBlockStart: '16px',+ borderBlockStartWidth: '1px',+ borderBlockStartStyle: 'solid',+ borderBlockStartColor: cssVar.colorBorderSecondary,+ },+ footerInModal: {+ paddingBlockEnd: '16px',+ paddingInline: '24px',+ backgroundColor: cssVar.colorBgElevated,+ },+ footerOnPage: {+ position: 'sticky',+ zIndex: 1,+ insetBlockEnd: 0,+ paddingBlockEnd: '24px',+ backgroundColor: cssVar.colorBgContainer,+ },+ hint: {+ flex: '1',+ minWidth: '160px',+ },+ hintText: {+ maxWidth: '520px',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+});++interface GateDecisionProps {+ dossier: GoalReleaseGateDossier;+ inModal?: boolean;+ onDecided?: (decision: GateDecisionKind) => void;+}++const GateDecision = ({ dossier, inModal, onDecided }: GateDecisionProps) => {+ const { t } = useTranslation('verify');+ const { acceptanceId } = useAcceptanceScope();+ const { data, mutate } = useAcceptanceBundle(acceptanceId);+ const [revising, setRevising] = useState(false);+ const [correction, setCorrection] = useState('');+ const [pending, setPending] = useState(false);+ const { canApprove } = useAcceptanceComments(acceptanceId);+ const readOnly = isReadOnlyAcceptanceDecider(data, canApprove);+ if (!data || (!canReviewAcceptance(data) && !readOnly)) return null;++ const footer = stylex.props(styles.footer, inModal ? styles.footerInModal : styles.footerOnPage);++ const status = data.acceptance.status;+ if (status === 'accepted' || status === 'rejected')+ return (+ <div {...footer}>+ <div {...stylex.props(styles.hintText)}>+ {status === 'accepted'+ ? t('acceptance.gate.decidedRelease', { wave: dossier.wave })+ : t('acceptance.gate.decidedRevise')}+ </div>+ </div>+ );++ const run = async (decision: GateDecisionKind, action: () => Promise<unknown>) => {+ setPending(true);+ try {+ await action();+ await mutate();+ void useVerifyStore.getState().refreshAcceptanceLists();+ onDecided?.(decision);+ } catch (cause) {+ toast.error(cause instanceof Error ? cause.message : t('acceptance.actionError'));+ } finally {+ setPending(false);+ }+ };++ // The dossier on screen is the latest round's; a revised plan arriving in+ // the meantime makes the server refuse this decision rather than approve it.+ const roundId = latestRound(data)?.run.id;++ const releaseLabel =+ dossier.kind === 'probes'+ ? t('acceptance.gate.startBatch', { count: dossier.nextWave.length })+ : t('acceptance.gate.releaseWave', { count: dossier.nextWave.length, wave: dossier.wave });++ const hint = (text: string) => (+ <div {...stylex.props(styles.hint)}>+ <div {...stylex.props(styles.hintText)}>{text}</div>+ </div>+ );++ // A teammate who cannot sign the gate still sees what it asks and who signs it.+ if (readOnly)+ return (+ <div {...footer}>+ <div {...stylex.props(styles.bar)}>+ {hint(t('acceptance.bar.readOnlyReason'))}+ <div {...stylex.props(styles.actions)}>+ <Button disabled>{t('acceptance.gate.revise')}</Button>+ <Button disabled type={'primary'}>+ {releaseLabel}+ </Button>+ </div>+ </div>+ </div>+ );++ return (+ <div {...footer}>+ {revising && (+ <TextArea+ autoFocus+ autoSize={{ maxRows: 6, minRows: 3 }}+ placeholder={t('acceptance.gate.revisePlaceholder')}+ value={correction}+ onChange={(event) => setCorrection(event.target.value)}+ />+ )}+ <div {...stylex.props(styles.bar)}>+ {hint(revising ? t('acceptance.gate.reviseHint') : t('acceptance.gate.decisionHint'))}+ {revising ? (+ <div {...stylex.props(styles.actions)}>+ <Button disabled={pending} onClick={() => setRevising(false)}>+ {t('acceptance.gate.cancel')}+ </Button>+ <Button+ danger+ disabled={!correction.trim()}+ loading={pending}+ onClick={() =>+ run('revise', () =>+ verifyService.rejectDelivery(data.acceptance.id, correction.trim(), {+ dispatch: false,+ roundId,+ }),+ )+ }+ >+ {t('acceptance.gate.reviseSubmit')}+ </Button>+ </div>+ ) : (+ <div {...stylex.props(styles.actions)}>+ <Button disabled={pending} onClick={() => setRevising(true)}>+ {t('acceptance.gate.revise')}+ </Button>+ <Button+ loading={pending}+ type={'primary'}+ onClick={() =>+ run('release', () =>+ verifyService.acceptDelivery(data.acceptance.id, undefined, { roundId }),+ )+ }+ >+ {releaseLabel}+ </Button>+ </div>+ )}+ </div>+ </div>+ );+};++export default GateDecision;diff --git a/src/features/Acceptance/Viewer/Gate/GateLead.tsx b/src/features/Acceptance/Viewer/Gate/GateLead.tsxnew file mode 100644index 00000000000..96dbd0071c7--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/GateLead.tsx@@ -0,0 +1,95 @@+'use client';++import type { GoalReleaseGateDossier } from '@lobechat/types';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { useTranslation } from 'react-i18next';++import { GoalDecisionAsker } from '@/features/AgentGoals/GoalDecision';++const styles = stylex.create({+ body: {+ maxWidth: '640px',+ margin: 0,+ fontSize: '14px',+ lineHeight: '22px',+ color: cssVar.colorTextSecondary,+ },+ diagnosis: {+ maxWidth: '640px',+ margin: 0,+ fontSize: '14px',+ lineHeight: '22px',+ color: cssVar.colorText,+ },+ root: {+ display: 'flex',+ flexDirection: 'column',+ gap: '8px',+ },+ title: {+ margin: 0,+ fontSize: '20px',+ fontWeight: 600,+ lineHeight: '28px',+ color: cssVar.colorText,+ },+});++interface GateLeadProps {+ dossier: GoalReleaseGateDossier;+ remaining: number;+ reworked: string[];+ showAsker: boolean;+}++const GateLead = ({ dossier, remaining, reworked, showAsker }: GateLeadProps) => {+ const { i18n, t } = useTranslation('verify');++ const lead = () => {+ switch (dossier.kind) {+ case 'probes': {+ return t('acceptance.gate.leadProbes', { count: dossier.units.length, remaining });+ }+ case 'escalated': {+ return t('acceptance.gate.lead.escalated', { wave: dossier.wave - 1 });+ }+ case 'unattended': {+ return t('acceptance.gate.lead.unattended', { wave: dossier.wave - 1 });+ }+ }+ };++ const rework =+ reworked.length > 0+ ? t('acceptance.gate.leadRework', {+ codes: new Intl.ListFormat(i18n.language, { type: 'conjunction' }).format(reworked),+ })+ : undefined;++ return (+ <div {...stylex.props(styles.root)}>+ {showAsker && (+ <GoalDecisionAsker+ agentId={dossier.agentId}+ category={'judgment'}+ size={20}+ subtitle={t('acceptance.gate.asker', { goal: dossier.goalTitle })}+ />+ )}+ <h2 {...stylex.props(styles.title)}>+ {dossier.kind === 'probes'+ ? t('acceptance.gate.titleProbes')+ : t('acceptance.gate.titleWave', { wave: dossier.wave })}+ </h2>+ <p {...stylex.props(styles.body)}>{[lead(), rework].filter(Boolean).join(' ')}</p>+ {dossier.diagnosis && (+ <p {...stylex.props(styles.diagnosis)}>+ {t('acceptance.gate.agentSays', { reason: dossier.diagnosis })}+ </p>+ )}+ </div>+ );+};++export default GateLead;diff --git a/src/features/Acceptance/Viewer/Gate/GateReview.tsx b/src/features/Acceptance/Viewer/Gate/GateReview.tsxindex ded0e9eee2a..a743f9f0630 100644--- a/src/features/Acceptance/Viewer/Gate/GateReview.tsx+++ b/src/features/Acceptance/Viewer/Gate/GateReview.tsx@@ -1,67 +1,32 @@'use client';-import type { GoalReleaseGateDossier, GoalReleaseGateUnit } from '@lobechat/types';-import {- ActionIcon,- Button,- DraggablePanel,- Flexbox,- Icon,- Markdown,- Text,- TextArea,- toast,-} from '@lobehub/ui';+import type { GoalReleaseGateDossier } from '@lobechat/types';+import { ActionIcon } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import {- CircleCheck,- CircleDashed,- PanelLeftCloseIcon,- PanelLeftOpenIcon,- TriangleAlert,- X,-} from 'lucide-react';-import { memo, type ReactNode, useState } from 'react';+import { X } from 'lucide-react';+import { use, useState } from 'react';+import { createPortal } from 'react-dom';import { useTranslation } from 'react-i18next';-import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';import { GoalDecisionAsker } from '@/features/AgentGoals/GoalDecision';-import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';-import { verifyService } from '@/services/verify';-import { useVerifyStore } from '@/store/verify';-import { useAcceptanceScope } from '../AcceptanceScope';-import { useAcceptanceComments } from '../Comments/hooks';-import { acceptanceOverviewPath } from '../routes';-import { useAcceptanceBundle } from '../useAcceptanceBundle';-import { canReviewAcceptance, isReadOnlyAcceptanceDecider } from '../visibility';-import { latestRound } from './dossier';-import SkillDirectory from './SkillDirectory';-import UnitArtifacts from './UnitArtifacts';-import { usePlanFiles } from './usePlanFiles';+import { FlowPanelHostContext } from '../Flow/FlowPanelHost';+import GateDecision, { type GateDecisionKind } from './GateDecision';+import GateLead from './GateLead';+import GateSection from './GateSection';+import { formatTokenEstimate, summarizeGate } from './gateSummary';+import PlanSection from './PlanSection';+import { gateStyles } from './styles';+import UnitPanel, { type GateSelection, selectionKey } from './UnitPanel';+import { NextRow, ResultRow, UnitList } from './UnitRows';++export type { GateDecisionKind } from './GateDecision';const styles = stylex.create({- body: {- fontSize: cssVar.fontSize,- lineHeight: 1.7,- },- // The same action band as the approval island's cards: one tinted strip the- // decision lives in, apart from the report it decides on.- footer: {- paddingBlock: '12px',- paddingInline: '24px',- borderBlockStartWidth: '1px',- borderBlockStartStyle: 'solid',- borderBlockStartColor: cssVar.colorBorder,- backgroundColor: `color-mix(in srgb, ${cssVar.colorBgElevated} 92%, ${cssVar.colorFillSecondary})`,- },- footerOnPage: {- position: 'sticky',- zIndex: 1,- insetBlockEnd: 0,- paddingInline: 0,- backgroundColor: cssVar.colorBgContainer,+ asker: {+ flex: '1',+ minWidth: 0,},frame: {overflow: 'hidden',@@ -69,6 +34,11 @@ const styles = stylex.create({flexDirection: 'column',maxHeight: '84vh',},+ frameBody: {+ display: 'flex',+ flex: '1',+ minHeight: 0,+ },header: {display: 'flex',gap: '8px',@@ -77,394 +47,31 @@ const styles = stylex.create({paddingInline: '24px',borderBlockEndWidth: '1px',borderBlockEndStyle: 'solid',- borderBlockEndColor: cssVar.colorBorder,- },- link: {- fontSize: cssVar.fontSizeSM,- color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },- },- list: {- overflow: 'hidden',- borderWidth: '1px',- borderStyle: 'solid',- borderColor: cssVar.colorBorder,- borderRadius: cssVar.borderRadiusLG,+ borderBlockEndColor: cssVar.colorBorderSecondary,},- meta: {- fontSize: cssVar.fontSizeSM,- fontVariantNumeric: 'tabular-nums',- color: cssVar.colorTextTertiary,- },- panel: {- overflowX: 'hidden',- overflowY: 'auto',- height: '100%',- paddingBlock: '16px',- paddingInline: '16px',- },- plan: {- paddingBlock: '4px',- paddingInline: '20px',- borderWidth: '1px',- borderStyle: 'solid',- borderColor: cssVar.colorBorder,- borderRadius: cssVar.borderRadiusLG,+ main: {+ display: 'flex',+ flex: '1',+ flexDirection: 'column',+ minWidth: 0,},- row: {- cursor: 'pointer',- paddingBlock: '12px',- paddingInline: '16px',- // Rows only ever sit next to other rows in a list (the old `& + &`).- borderBlockStartWidth: { 'default': null, ':not(:first-child)': '1px' },- borderBlockStartStyle: { 'default': null, ':not(:first-child)': 'solid' },- borderBlockStartColor: { 'default': null, ':not(:first-child)': cssVar.colorBorder },- backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },+ mainOnPage: { gap: '24px' },+ page: {+ display: 'flex',+ gap: '24px',},- rowActive: {- backgroundColor: { 'default': cssVar.colorFillTertiary, ':hover': cssVar.colorFillTertiary },+ report: {+ display: 'flex',+ flexDirection: 'column',+ gap: '32px',},scroll: {overflowY: 'auto',flex: '1',- minWidth: 0,- },- section: {- fontSize: cssVar.fontSizeLG,- fontWeight: 600,- },- title: {- margin: 0,- fontSize: cssVar.fontSizeHeading4,- fontWeight: 600,- lineHeight: 1.4,- },-});--/** "A10 返工 #20851 首页 inbox …" → code "A10" and the rest of the title. */-const splitUnitTitle = (title: string) => {- const [code, ...rest] = title.split(' ');- return rest.length > 0 && code.length <= 6 ? { code, name: rest.join(' ') } : { name: title };-};--/** Token counts read as 50.4M / 1.2B in every language — the unit models are quoted in. */-const formatTokens = (tokens: number) =>- new Intl.NumberFormat('en-US', { maximumFractionDigits: 1, notation: 'compact' }).format(tokens);--/** A unit the owner has to look at: it was reworked, or did not settle cleanly. */-const isException = (unit: GoalReleaseGateUnit) => unit.runs > 1 || unit.status !== 'resolved';--/** The detail panel opens at this width; its edge drags it between the bounds. */-const PANEL_WIDTH = { default: 360, max: 720, min: 280 };--/** What the side panel shows: a unit that ran, or one the next wave would start. */-type Selection =- { kind: 'result'; unit: GoalReleaseGateUnit } | { brief?: string; kind: 'next'; title: string };--const UnitTitle = ({ title }: { title: string }) => {- const { code, name } = splitUnitTitle(title);- return (- <span- style={{- flex: 1,- minWidth: 0,- overflow: 'hidden',- textOverflow: 'ellipsis',- whiteSpace: 'nowrap',- }}- >- {code && <b style={{ fontWeight: 600, marginInlineEnd: 8 }}>{code}</b>}- {name}- </span>- );-};--const Section = ({- children,- extra,- title,- titleExtra,-}: {- children: ReactNode;- extra?: ReactNode;- title: string;- /** A control that belongs to the title itself, set right after it. */- titleExtra?: ReactNode;-}) => (- <Flexbox gap={12}>- <Flexbox horizontal align={'center'} justify={'space-between'}>- <Flexbox horizontal align={'center'} gap={4}>- <span {...stylex.props(styles.section)}>{title}</span>- {titleExtra}- </Flexbox>- {extra}- </Flexbox>- {children}- </Flexbox>-);--const ResultRow = memo<{- active: boolean;- average: number;- onSelect: () => void;- unit: GoalReleaseGateUnit;-}>(({ active, average, onSelect, unit }) => {- const { t } = useTranslation('verify');- const exception = isException(unit);- const ratio = average > 0 ? unit.tokens / average : 0;- return (- <Flexbox gap={4} {...stylex.props(styles.row, active && styles.rowActive)} onClick={onSelect}>- <Flexbox horizontal align={'center'} gap={12}>- <Icon- color={exception ? cssVar.colorWarning : cssVar.colorSuccess}- icon={exception ? TriangleAlert : CircleCheck}- size={16}- />- <UnitTitle title={unit.title} />- <span {...stylex.props(styles.meta)}>- {[- unit.acceptance?.checks &&- t('acceptance.gate.unitAcceptance', {- passed: unit.acceptance.checks.passed,- total: unit.acceptance.checks.total,- }),- t('acceptance.gate.unitMeta', {- runs: unit.runs,- tokens: formatTokens(unit.tokens),- }),- ]- .filter(Boolean)- .join(' · ')}- </span>- </Flexbox>- {exception && (- <Text style={{ paddingInlineStart: 28 }} type={'warning'}>- {unit.status !== 'resolved'- ? t('acceptance.gate.unitUnsettled')- : ratio >= 1.5- ? t('acceptance.gate.unitReworkedCostly', {- ratio: ratio.toFixed(1),- rework: unit.runs - 1,- })- : t('acceptance.gate.unitReworked', { rework: unit.runs - 1 })}- </Text>- )}- </Flexbox>- );-});--const NextRow = memo<{ active: boolean; onSelect: () => void; title: string }>(- ({ active, onSelect, title }) => {- const { t } = useTranslation('verify');- return (- <Flexbox- horizontal- align={'center'}- gap={12}- {...stylex.props(styles.row, active && styles.rowActive)}- onClick={onSelect}- >- <Icon color={cssVar.colorTextQuaternary} icon={CircleDashed} size={16} />- <UnitTitle title={title} />- <span {...stylex.props(styles.meta)}>{t('acceptance.gate.unitWaiting')}</span>- </Flexbox>- );- },-);--const DetailPanel = memo<{ onClose: () => void; selection: Selection }>(- ({ onClose, selection }) => {- const { t } = useTranslation('verify');- const workspaceSlug = useActiveWorkspaceSlug();- const title = selection.kind === 'result' ? selection.unit.title : selection.title;- const brief = selection.kind === 'result' ? selection.unit.brief : selection.brief;- return (- <DraggablePanel- backgroundColor={'transparent'}- classNames={{ content: stylex.props(styles.panel).className }}- defaultSize={{ height: '100%', width: PANEL_WIDTH.default }}- expandable={false}- maxWidth={PANEL_WIDTH.max}- minWidth={PANEL_WIDTH.min}- placement={'right'}- >- <Flexbox gap={12}>- <Flexbox horizontal align={'flex-start'} gap={8}>- <Text strong style={{ flex: 1, minWidth: 0 }}>- {title}- </Text>- <ActionIcon icon={X} size={'small'} onClick={onClose} />- </Flexbox>- {selection.kind === 'result' ? (- <Flexbox gap={8}>- <span {...stylex.props(styles.meta)}>- {t('acceptance.gate.unitMeta', {- runs: selection.unit.runs,- tokens: formatTokens(selection.unit.tokens),- })}- </span>- {selection.unit.acceptance && (- <a- className={stylex.props(styles.link).className}- rel="noreferrer"- target="_blank"- href={buildWorkspaceAwarePath(- acceptanceOverviewPath(selection.unit.acceptance.id),- workspaceSlug,- )}- >- {selection.unit.acceptance.checks- ? t('acceptance.gate.unitAcceptance', {- passed: selection.unit.acceptance.checks.passed,- total: selection.unit.acceptance.checks.total,- })- : t('acceptance.gate.unitAcceptanceOpen')}- </a>- )}- </Flexbox>- ) : (- <span {...stylex.props(styles.meta)}>{t('acceptance.gate.unitWaitingHint')}</span>- )}- {brief && (- <Flexbox gap={4}>- <span {...stylex.props(styles.meta)}>{t('acceptance.gate.unitBrief')}</span>- <Markdown fontSize={13} variant={'chat'}>- {brief.replace(/^\[origin=\w+\]\s*/, '')}- </Markdown>- </Flexbox>- )}- {selection.kind === 'result' && <UnitArtifacts unit={selection.unit} />}- </Flexbox>- </DraggablePanel>- );+ minHeight: 0,+ paddingBlock: '24px',+ paddingInline: '24px',},-);--/** How the owner settled the gate: let the next wave run, or send the plan back. */-export type GateDecisionKind = 'release' | 'revise';--const GateDecision = memo<{- dossier: GoalReleaseGateDossier;- inModal?: boolean;- onDecided?: (decision: GateDecisionKind) => void;-}>(({ dossier, inModal, onDecided }) => {- const { t } = useTranslation('verify');- const { acceptanceId } = useAcceptanceScope();- const { data, mutate } = useAcceptanceBundle(acceptanceId);- const [revising, setRevising] = useState(false);- const [correction, setCorrection] = useState('');- const [pending, setPending] = useState(false);- const { canApprove } = useAcceptanceComments(acceptanceId);- const readOnly = isReadOnlyAcceptanceDecider(data, canApprove);- if (!data || (!canReviewAcceptance(data) && !readOnly)) return null;-- const status = data.acceptance.status;- if (status === 'accepted' || status === 'rejected')- return (- <Flexbox {...stylex.props(styles.footer, !inModal && styles.footerOnPage)}>- <Text type={'secondary'}>- {status === 'accepted'- ? t('acceptance.gate.decidedRelease', { wave: dossier.wave })- : t('acceptance.gate.decidedRevise')}- </Text>- </Flexbox>- );-- const run = async (decision: GateDecisionKind, action: () => Promise<unknown>) => {- setPending(true);- try {- await action();- await mutate();- void useVerifyStore.getState().refreshAcceptanceLists();- onDecided?.(decision);- } catch (cause) {- toast.error(cause instanceof Error ? cause.message : t('acceptance.actionError'));- } finally {- setPending(false);- }- };-- // The dossier on screen is the latest round's; a revised plan arriving in- // the meantime makes the server refuse this decision rather than approve it.- const roundId = latestRound(data)?.run.id;-- const releaseLabel =- dossier.kind === 'probes'- ? t('acceptance.gate.startBatch', { count: dossier.nextWave.length })- : t('acceptance.gate.releaseWave', { count: dossier.nextWave.length, wave: dossier.wave });-- // A teammate who cannot sign the gate still sees what it asks and who signs it.- if (readOnly)- return (- <Flexbox {...stylex.props(styles.footer, !inModal && styles.footerOnPage)}>- <Flexbox horizontal align={'center'} gap={8}>- <Text style={{ flex: 1, minWidth: 0 }} type={'secondary'}>- {t('acceptance.bar.readOnlyReason')}- </Text>- <Button disabled>{t('acceptance.gate.revise')}</Button>- <Button disabled type={'primary'}>- {releaseLabel}- </Button>- </Flexbox>- </Flexbox>- );-- return (- <Flexbox gap={12} {...stylex.props(styles.footer, !inModal && styles.footerOnPage)}>- {revising && (- <TextArea- autoFocus- autoSize={{ maxRows: 6, minRows: 3 }}- placeholder={t('acceptance.gate.revisePlaceholder')}- value={correction}- onChange={(event) => setCorrection(event.target.value)}- />- )}- <Flexbox horizontal align={'center'} gap={8}>- <Text style={{ flex: 1, minWidth: 0 }} type={'secondary'}>- {revising ? t('acceptance.gate.reviseHint') : t('acceptance.gate.decisionHint')}- </Text>- {revising ? (- <>- <Button disabled={pending} onClick={() => setRevising(false)}>- {t('acceptance.gate.cancel')}- </Button>- <Button- danger- disabled={!correction.trim()}- loading={pending}- onClick={() =>- run('revise', () =>- verifyService.rejectDelivery(data.acceptance.id, correction.trim(), {- dispatch: false,- roundId,- }),- )- }- >- {t('acceptance.gate.reviseSubmit')}- </Button>- </>- ) : (- <>- <Button disabled={pending} onClick={() => setRevising(true)}>- {t('acceptance.gate.revise')}- </Button>- <Button- loading={pending}- type={'primary'}- onClick={() =>- run('release', () =>- verifyService.acceptDelivery(data.acceptance.id, undefined, { roundId }),- )- }- >- {releaseLabel}- </Button>- </>- )}- </Flexbox>- </Flexbox>- );});interface GateReviewProps {@@ -475,124 +82,58 @@ interface GateReviewProps {onDecided?: (decision: GateDecisionKind) => void;}-/**- * A Goal decision gate, reported to the owner the way an approval is: who is- * asking, the plan the batch will copy, what the experiments delivered, and- * what starts on approval. Any row opens its detail beside the report.- */-const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided }) => {+const GateReview = ({ dossier, inModal, onClose, onDecided }: GateReviewProps) => {const { t } = useTranslation('verify');- const [selected, setSelected] = useState<Selection>();- const { extraFiles, filesOpen, toggleFiles } = usePlanFiles(- dossier.plan.skillId,- dossier.plan.revision,- );- const average =- dossier.units.reduce((sum, unit) => sum + unit.tokens, 0) / Math.max(1, dossier.units.length);- const probes = dossier.kind === 'probes';- const reworked = dossier.units.filter((unit) => unit.runs > 1);- const units = [...dossier.units].sort((a, b) => Number(isException(b)) - Number(isException(a)));- const estimate = average * (dossier.nextWave.length + dossier.remainingAfter);- const selectedKey = selected?.kind === 'result' ? selected.unit.nodeId : selected?.title;+ const [selected, setSelected] = useState<GateSelection>();+ const panelHost = use(FlowPanelHostContext);+ const summary = summarizeGate(dossier);+ const selectedKey = selectionKey(selected);const report = (- <Flexbox gap={32} style={{ padding: inModal ? 24 : 0 }}>- <Flexbox gap={8}>- <h2 {...stylex.props(styles.title)}>- {probes- ? t('acceptance.gate.titleProbes')- : t('acceptance.gate.titleWave', { wave: dossier.wave })}- </h2>- <Text type={'secondary'} {...stylex.props(styles.body)}>- {probes- ? t('acceptance.gate.leadProbes', {- count: dossier.units.length,- remaining: dossier.nextWave.length + dossier.remainingAfter,- })- : dossier.kind === 'escalated'- ? t('acceptance.gate.lead.escalated', { wave: dossier.wave - 1 })- : t('acceptance.gate.lead.unattended', { wave: dossier.wave - 1 })}- {reworked.length > 0 &&- ` ${t('acceptance.gate.leadRework', {- codes: reworked- .map((unit) => splitUnitTitle(unit.title).code ?? unit.title)- .join('、'),- })}`}- </Text>- {dossier.diagnosis && (- <Text {...stylex.props(styles.body)}>- {t('acceptance.gate.agentSays', { reason: dossier.diagnosis })}- </Text>- )}- </Flexbox>+ <div {...stylex.props(styles.report)}>+ <GateLead+ dossier={dossier}+ remaining={summary.remaining}+ reworked={summary.reworked}+ showAsker={!inModal}+ />- <Section- title={t('acceptance.gate.planTitle')}- extra={- dossier.plan.skillName && (- <span {...stylex.props(styles.meta)}>- {dossier.plan.skillName} · v{dossier.plan.revision}- {extraFiles > 0 && ` · ${t('acceptance.gate.planFiles', { count: extraFiles + 1 })}`}- </span>- )- }- titleExtra={- dossier.plan.skillId && (- <ActionIcon- icon={filesOpen ? PanelLeftCloseIcon : PanelLeftOpenIcon}- size={'small'}- title={t(filesOpen ? 'acceptance.gate.hideFiles' : 'acceptance.gate.showFiles')}- onClick={toggleFiles}- />- )- }- >- {dossier.plan.skillId ? (- <SkillDirectory- fallbackContent={dossier.plan.content}- filesOpen={filesOpen}- revision={dossier.plan.revision}- skillId={dossier.plan.skillId}- />- ) : (- <div {...stylex.props(styles.plan)}>- <Markdown fontSize={14} variant={'chat'}>- {dossier.plan.content}- </Markdown>- </div>- )}- </Section>+ <PlanSection plan={dossier.plan} />- <Section- title={probes ? t('acceptance.gate.resultsProbes') : t('acceptance.gate.resultsWave')}+ <GateSectionextra={- <span {...stylex.props(styles.meta)}>- {t('acceptance.gate.unitCount', { count: dossier.units.length })}+ <span {...stylex.props(gateStyles.meta)}>+ {t('acceptance.gate.unitCount', { count: summary.units.length })}</span>}+ title={+ dossier.kind === 'probes'+ ? t('acceptance.gate.resultsProbes')+ : t('acceptance.gate.resultsWave')+ }>- <div {...stylex.props(styles.list)}>- {units.map((unit) => (+ <UnitList>+ {summary.units.map((unit) => (<ResultRowactive={selectedKey === unit.nodeId}- average={average}+ average={summary.average}key={unit.nodeId}unit={unit}onSelect={() => setSelected({ kind: 'result', unit })}/>))}- </div>- </Section>+ </UnitList>+ </GateSection>- <Section+ <GateSectiontitle={t('acceptance.gate.nextWaveTitle', { wave: dossier.wave })}extra={- <span {...stylex.props(styles.meta)}>+ <span {...stylex.props(gateStyles.meta)}>{t('acceptance.gate.unitCount', { count: dossier.nextWave.length })}</span>}>- <div {...stylex.props(styles.list)}>+ <UnitList>{dossier.nextWave.map((unit) => (<NextRowactive={selectedKey === unit.title}@@ -601,62 +142,66 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecidedonSelect={() => setSelected({ brief: unit.brief, kind: 'next', title: unit.title })}/>))}- </div>- <span {...stylex.props(styles.meta)}>+ </UnitList>+ <p {...stylex.props(gateStyles.note)}>{t('acceptance.gate.remaining', {count: dossier.remainingAfter,- estimate: formatTokens(estimate),+ estimate: formatTokenEstimate(summary.estimate),})}- </span>- </Section>-- <span {...stylex.props(styles.meta)}>- {t('acceptance.gate.checks', {- passed: dossier.checks.filter((check) => check.passed).length,- total: dossier.checks.length,- })}- </span>- </Flexbox>+ </p>+ <p {...stylex.props(gateStyles.note)}>{t('acceptance.gate.checks', summary.checks)}</p>+ </GateSection>+ </div>);- const panel = selected && (- <DetailPanel selection={selected} onClose={() => setSelected(undefined)} />- );+ const closePanel = () => setSelected(undefined);if (!inModal)return (- <Flexbox gap={24}>- <Flexbox horizontal gap={24}>- <Flexbox flex={1} style={{ minWidth: 0 }}>- {report}- </Flexbox>- {panel}- </Flexbox>- <GateDecision dossier={dossier} onDecided={onDecided} />- </Flexbox>+ <div {...stylex.props(styles.page)}>+ <div {...stylex.props(styles.main, styles.mainOnPage)}>+ {report}+ <GateDecision dossier={dossier} onDecided={onDecided} />+ </div>+ {selected &&+ (panelHost ? (+ createPortal(<UnitPanel docked selection={selected} onClose={closePanel} />, panelHost)+ ) : (+ <UnitPanel selection={selected} onClose={closePanel} />+ ))}+ </div>);+ const panel = selected && <UnitPanel selection={selected} onClose={closePanel} />;+return (<div {...stylex.props(styles.frame)}><div {...stylex.props(styles.header)}>- <div style={{ flex: 1, minWidth: 0 }}>+ <div {...stylex.props(styles.asker)}><GoalDecisionAskeragentId={dossier.agentId}category={'judgment'}subtitle={t('acceptance.gate.asker', { goal: dossier.goalTitle })}/></div>- {onClose && <ActionIcon icon={X} size={'small'} onClick={onClose} />}+ {onClose && (+ <ActionIcon+ icon={X}+ size={'small'}+ title={t('acceptance.gate.panelClose')}+ onClick={onClose}+ />+ )}</div>- <Flexbox horizontal style={{ flex: 1, minHeight: 0 }}>- <div {...stylex.props(styles.scroll)}>{report}</div>+ <div {...stylex.props(styles.frameBody)}>+ <div {...stylex.props(styles.main)}>+ <div {...stylex.props(styles.scroll)}>{report}</div>+ <GateDecision inModal dossier={dossier} onDecided={onDecided} />+ </div>{panel}- </Flexbox>- <GateDecision inModal dossier={dossier} onDecided={onDecided} />+ </div></div>);-});--GateReview.displayName = 'AcceptanceGateReview';+};export default GateReview;diff --git a/src/features/Acceptance/Viewer/Gate/GateSection.tsx b/src/features/Acceptance/Viewer/Gate/GateSection.tsxnew file mode 100644index 00000000000..b594a97c107--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/GateSection.tsx@@ -0,0 +1,48 @@+'use client';++import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import type { ReactNode } from 'react';++const styles = stylex.create({+ head: {+ display: 'flex',+ gap: '8px',+ alignItems: 'center',+ minHeight: '24px',+ },+ root: {+ display: 'flex',+ flexDirection: 'column',+ gap: '12px',+ },+ spacer: { flex: '1' },+ title: {+ margin: 0,+ fontSize: '16px',+ fontWeight: 600,+ lineHeight: '24px',+ color: cssVar.colorText,+ },+});++interface GateSectionProps {+ children: ReactNode;+ extra?: ReactNode;+ title: string;+ titleExtra?: ReactNode;+}++const GateSection = ({ children, extra, title, titleExtra }: GateSectionProps) => (+ <section {...stylex.props(styles.root)}>+ <div {...stylex.props(styles.head)}>+ <h3 {...stylex.props(styles.title)}>{title}</h3>+ {titleExtra}+ <span {...stylex.props(styles.spacer)} />+ {extra}+ </div>+ {children}+ </section>+);++export default GateSection;diff --git a/src/features/Acceptance/Viewer/Gate/PlanSection.tsx b/src/features/Acceptance/Viewer/Gate/PlanSection.tsxnew file mode 100644index 00000000000..cc29c7beec0--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/PlanSection.tsx@@ -0,0 +1,149 @@+'use client';++import type { GoalReleaseGateDossier } from '@lobechat/types';+import { ActionIcon, Icon, Markdown } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { ChevronDown, ChevronRight, PanelLeftCloseIcon, PanelLeftOpenIcon } from 'lucide-react';+import { useState } from 'react';+import { useTranslation } from 'react-i18next';++import GateSection from './GateSection';+import { planDigest } from './gateSummary';+import SkillDirectory from './SkillDirectory';+import { gateStyles } from './styles';+import { usePlanFiles } from './usePlanFiles';++const styles = stylex.create({+ card: {+ display: 'flex',+ flexDirection: 'column',+ paddingBlock: '12px',+ paddingInline: '16px',+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: cssVar.colorBorderSecondary,+ borderRadius: '12px',+ fontSize: '14px',+ lineHeight: '22px',+ color: cssVar.colorTextSecondary,+ },+ content: { marginBlockStart: '12px' },+ fold: {+ cursor: 'pointer',+ display: 'inline-flex',+ gap: '4px',+ alignItems: 'center',+ alignSelf: 'flex-start',+ margin: 0,+ padding: 0,+ borderWidth: 0,+ borderStyle: 'none',+ borderColor: 'currentcolor',+ borderRadius: '4px',+ font: 'inherit',+ fontSize: '12px',+ lineHeight: '20px',+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },+ appearance: 'none',+ backgroundColor: 'transparent',+ outlineWidth: { 'default': null, ':focus-visible': '2px' },+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimary },+ outlineOffset: '2px',+ },+ foldAfterDigest: { marginBlockStart: '4px' },+ summary: { margin: 0 },+ summaryClamped: {+ overflow: 'hidden',+ display: '-webkit-box',+ WebkitBoxOrient: 'vertical',+ WebkitLineClamp: 3,+ },+ title: {+ fontWeight: 500,+ color: cssVar.colorText,+ },+});++const PlanSection = ({ plan }: { plan: GoalReleaseGateDossier['plan'] }) => {+ const { t } = useTranslation('verify');+ const [opened, setOpened] = useState(false);+ const { extraFiles, filesOpen, toggleFiles } = usePlanFiles(plan.skillId, plan.revision);+ const digest = planDigest(plan.content);+ const hasDigest = !!digest.title || !!digest.summary;+ const foldable = hasDigest && (!!plan.skillId || digest.hasMore);+ const open = opened || !hasDigest;+ const treeShown = open && filesOpen;++ const toggleTree = () => {+ if (open) {+ toggleFiles();+ return;+ }+ setOpened(true);+ if (!filesOpen) toggleFiles();+ };++ return (+ <GateSection+ title={t('acceptance.gate.planTitle')}+ extra={+ plan.skillName && (+ <span {...stylex.props(gateStyles.meta)}>+ {plan.skillName} · v{plan.revision}+ {extraFiles > 0 && ` · ${t('acceptance.gate.planFiles', { count: extraFiles + 1 })}`}+ </span>+ )+ }+ titleExtra={+ plan.skillId && (+ <ActionIcon+ icon={treeShown ? PanelLeftCloseIcon : PanelLeftOpenIcon}+ size={'small'}+ title={t(treeShown ? 'acceptance.gate.hideFiles' : 'acceptance.gate.showFiles')}+ onClick={toggleTree}+ />+ )+ }+ >+ <div {...stylex.props(styles.card)}>+ {!open && digest.title && <div {...stylex.props(styles.title)}>{digest.title}</div>}+ {!open && digest.summary && (+ <p {...stylex.props(styles.summary, foldable && styles.summaryClamped)}>+ {digest.summary}+ </p>+ )}+ {foldable && (+ <button+ aria-expanded={open}+ type="button"+ {...stylex.props(styles.fold, !open && styles.foldAfterDigest)}+ onClick={() => setOpened(!open)}+ >+ <Icon icon={open ? ChevronDown : ChevronRight} size={14} />+ {t(open ? 'acceptance.gate.planFold' : 'acceptance.gate.planRead')}+ </button>+ )}+ {open && (+ <div {...stylex.props(foldable && styles.content)}>+ {plan.skillId ? (+ <SkillDirectory+ fallbackContent={plan.content}+ filesOpen={filesOpen}+ revision={plan.revision}+ skillId={plan.skillId}+ />+ ) : (+ <Markdown fontSize={14} variant={'chat'}>+ {plan.content}+ </Markdown>+ )}+ </div>+ )}+ </div>+ </GateSection>+ );+};++export default PlanSection;diff --git a/src/features/Acceptance/Viewer/Gate/UnitArtifacts.tsx b/src/features/Acceptance/Viewer/Gate/UnitArtifacts.tsxindex af994a04d9e..a4dc45fc98e 100644--- a/src/features/Acceptance/Viewer/Gate/UnitArtifacts.tsx+++ b/src/features/Acceptance/Viewer/Gate/UnitArtifacts.tsx@@ -2,7 +2,7 @@import type { GoalReleaseGateUnit, WorkSummaryItem } from '@lobechat/types';import { Block, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';-import { ExternalLink, FileDown, FileText } from 'lucide-react';+import { ArrowUpRight, ExternalLink, FileDown, FileText } from 'lucide-react';import { createElement, memo, useCallback } from 'react';import { useTranslation } from 'react-i18next';@@ -26,14 +26,22 @@ type ExternalItem = Parameters<(typeof WORK_TYPE_DESCRIPTORS)['external']['getIcconst externalItem = (artifact: Artifact) =>({ resourceType: artifact.resourceType, status: artifact.status ?? null }) as ExternalItem;-const iconOf = (artifact: Artifact): WorkIcon =>- artifact.type === 'external'- ? WORK_TYPE_DESCRIPTORS.external.getIcon(externalItem(artifact))- : artifact.type === 'document'- ? FileText- : artifact.type === 'file'- ? FileDown- : ExternalLink;+const iconOf = (artifact: Artifact): WorkIcon => {+ switch (artifact.type) {+ case 'external': {+ return WORK_TYPE_DESCRIPTORS.external.getIcon(externalItem(artifact));+ }+ case 'document': {+ return FileText;+ }+ case 'file': {+ return FileDown;+ }+ default: {+ return ExternalLink;+ }+ }+};/*** Opens a unit's output where it lives. Not the Work gallery's `useOpenWork`:@@ -78,7 +86,8 @@ const ArtifactRow = memo<{ artifact: Artifact }>(({ artifact }) => {align={'center'}clickable={!!url}gap={8}- padding={8}+ paddingBlock={8}+ paddingInline={12}title={url}variant={'outlined'}onClick={url ? () => window.open(url, '_blank', 'noopener,noreferrer') : undefined}@@ -95,7 +104,7 @@ const ArtifactRow = memo<{ artifact: Artifact }>(({ artifact }) => {</Text>)}</Flexbox>- {url && <Icon color={cssVar.colorTextQuaternary} icon={ExternalLink} size={14} />}+ {url && <Icon color={cssVar.colorTextQuaternary} icon={ArrowUpRight} size={14} />}</Block>);});@@ -112,7 +121,7 @@ const UnitArtifacts = memo<{ unit: GoalReleaseGateUnit }>(({ unit }) => {const openWork = useOpenUnitWork();const artifacts = unitArtifacts(unit);return (- <Flexbox gap={4}>+ <Flexbox gap={8}><Text fontSize={12} type={'secondary'}>{t('acceptance.gate.unitArtifacts')}</Text>@@ -129,9 +138,7 @@ const UnitArtifacts = memo<{ unit: GoalReleaseGateUnit }>(({ unit }) => {<ArtifactRow artifact={artifact} key={artifact.url ?? `${artifact.title}-${index}`} />))) : (- <Text fontSize={13} type={'secondary'}>- {t('acceptance.gate.unitArtifactsEmpty')}- </Text>+ <Text type={'secondary'}>{t('acceptance.gate.unitArtifactsEmpty')}</Text>)}</Flexbox>);diff --git a/src/features/Acceptance/Viewer/Gate/UnitPanel.tsx b/src/features/Acceptance/Viewer/Gate/UnitPanel.tsxnew file mode 100644index 00000000000..e95d33fdda9--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/UnitPanel.tsx@@ -0,0 +1,146 @@+'use client';++import type { GoalReleaseGateUnit } from '@lobechat/types';+import { ActionIcon, DraggablePanel, Markdown } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { X } from 'lucide-react';+import { useTranslation } from 'react-i18next';++import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';+import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';++import { acceptanceOverviewPath } from '../routes';+import { splitUnitTitle } from './gateSummary';+import { gateStyles } from './styles';+import UnitArtifacts from './UnitArtifacts';+import { useUnitMeta } from './useUnitMeta';++const PANEL_WIDTH = { default: 360, max: 720, min: 280 };++const ORIGIN_TAG = /^\[origin=\w+\]\s*/;++export type GateSelection =+ { kind: 'result'; unit: GoalReleaseGateUnit } | { brief?: string; kind: 'next'; title: string };++export const selectionKey = (selection?: GateSelection) =>+ selection?.kind === 'result' ? selection.unit.nodeId : selection?.title;++const styles = stylex.create({+ body: {+ display: 'flex',+ flexDirection: 'column',+ gap: '16px',+ },+ head: {+ display: 'flex',+ gap: '8px',+ alignItems: 'flex-start',+ },+ link: {+ alignSelf: 'flex-start',+ fontSize: '12px',+ lineHeight: '20px',+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },+ textDecorationLine: 'underline',+ textUnderlineOffset: '2px',+ },+ name: {+ flex: '1',+ minWidth: 0,+ fontSize: '14px',+ fontWeight: 600,+ lineHeight: '22px',+ color: cssVar.colorText,+ overflowWrap: 'anywhere',+ },+ docked: {+ overflowX: 'hidden',+ overflowY: 'auto',+ height: '100%',+ paddingBlock: '24px',+ paddingInline: '24px',+ borderInlineStartWidth: '1px',+ borderInlineStartStyle: 'solid',+ borderInlineStartColor: cssVar.colorBorderSecondary,+ backgroundColor: cssVar.colorBgContainer,+ },+ panel: {+ overflowX: 'hidden',+ overflowY: 'auto',+ height: '100%',+ paddingBlock: '24px',+ paddingInline: '16px',+ },+ titleCode: { paddingBlockStart: '1px' },+});++interface UnitPanelProps {+ docked?: boolean;+ onClose: () => void;+ selection: GateSelection;+}++const UnitPanel = ({ docked, onClose, selection }: UnitPanelProps) => {+ const { t } = useTranslation('verify');+ const workspaceSlug = useActiveWorkspaceSlug();+ const unitMeta = useUnitMeta();+ const unit = selection.kind === 'result' ? selection.unit : undefined;+ const { brief, title } = selection.kind === 'result' ? selection.unit : selection;+ const { code, name } = splitUnitTitle(title);++ const body = (+ <div {...stylex.props(styles.body)}>+ <div {...stylex.props(styles.head)}>+ {code && <span {...stylex.props(gateStyles.code, styles.titleCode)}>{code}</span>}+ <span {...stylex.props(styles.name)}>{name}</span>+ <ActionIcon+ icon={X}+ size={'small'}+ title={t('acceptance.gate.panelClose')}+ onClick={onClose}+ />+ </div>+ <span {...stylex.props(gateStyles.label)}>+ {unit ? unitMeta(unit) : t('acceptance.gate.unitWaitingHint')}+ </span>+ {unit?.acceptance && (+ <a+ href={buildWorkspaceAwarePath(acceptanceOverviewPath(unit.acceptance.id), workspaceSlug)}+ rel="noreferrer"+ target="_blank"+ {...stylex.props(styles.link)}+ >+ {t('acceptance.gate.unitAcceptanceOpen')}+ </a>+ )}+ {brief && (+ <div>+ <div {...stylex.props(gateStyles.label)}>{t('acceptance.gate.unitBrief')}</div>+ <Markdown fontSize={14} variant={'chat'}>+ {brief.replace(ORIGIN_TAG, '')}+ </Markdown>+ </div>+ )}+ {unit && <UnitArtifacts unit={unit} />}+ </div>+ );++ if (docked) return <div {...stylex.props(styles.docked)}>{body}</div>;++ return (+ <DraggablePanel+ backgroundColor={'transparent'}+ classNames={{ content: stylex.props(styles.panel).className }}+ defaultSize={{ height: '100%', width: PANEL_WIDTH.default }}+ expandable={false}+ maxWidth={PANEL_WIDTH.max}+ minWidth={PANEL_WIDTH.min}+ placement={'right'}+ >+ {body}+ </DraggablePanel>+ );+};++export default UnitPanel;diff --git a/src/features/Acceptance/Viewer/Gate/UnitRows.tsx b/src/features/Acceptance/Viewer/Gate/UnitRows.tsxnew file mode 100644index 00000000000..66af0dfe411--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/UnitRows.tsx@@ -0,0 +1,184 @@+'use client';++import type { GoalReleaseGateUnit } from '@lobechat/types';+import { Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { Check, CircleDashed, Info, type LucideIcon, TriangleAlert } from 'lucide-react';+import type { ReactNode } from 'react';+import { useTranslation } from 'react-i18next';++import { splitUnitTitle, type UnitRemark, unitRemark } from './gateSummary';+import { gateStyles } from './styles';+import { useUnitMeta } from './useUnitMeta';++const compact = '@media (width <= 767px)';++const styles = stylex.create({+ glyph: { display: 'inline-flex', width: '16px' },+ list: {+ display: 'grid',+ // A fixed first track would lose the row's inline padding: a subgrid's+ // padding is taken out of its edge tracks.+ gridTemplateColumns: 'auto auto minmax(0, 1fr) auto',+ columnGap: '8px',+ borderBlockWidth: '1px',+ borderBlockStyle: 'solid',+ borderBlockColor: cssVar.colorBorderSecondary,+ },+ meta: {+ gridColumnEnd: { default: null, [compact]: '-1' },+ gridColumnStart: { default: null, [compact]: '3' },+ whiteSpace: { default: 'nowrap', [compact]: 'normal' },+ },+ name: {+ overflow: 'hidden',+ minWidth: 0,+ fontSize: '14px',+ lineHeight: '22px',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ },+ nameWithoutCode: { gridColumnEnd: '4', gridColumnStart: '2' },+ remark: {+ gridColumnEnd: '-1',+ gridColumnStart: '3',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorWarningText,+ },+ remarkWithoutCode: { gridColumnEnd: '-1', gridColumnStart: '2' },+ row: {+ cursor: 'pointer',+ display: 'grid',+ gridColumnEnd: '-1',+ gridColumnStart: '1',+ gridTemplateColumns: 'subgrid',+ rowGap: 0,+ alignItems: 'center',+ minHeight: '48px',+ margin: 0,+ paddingBlock: '12px',+ paddingInline: '16px',+ borderInlineWidth: 0,+ borderBlockEndWidth: 0,+ borderBlockStartWidth: { 'default': 0, ':not(:first-child)': '1px' },+ borderStyle: 'solid',+ borderColor: cssVar.colorBorderSecondary,+ font: 'inherit',+ color: cssVar.colorText,+ textAlign: 'start',+ appearance: 'none',+ backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillQuaternary },+ outlineWidth: { 'default': null, ':focus-visible': '2px' },+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimary },+ outlineOffset: '-2px',+ },+ rowActive: {+ backgroundColor: { 'default': cssVar.colorFillTertiary, ':hover': cssVar.colorFillTertiary },+ },+});++export const UnitList = ({ children }: { children: ReactNode }) => (+ <div {...stylex.props(styles.list)}>{children}</div>+);++interface UnitRowProps {+ active: boolean;+ glyph: { color: string; icon: LucideIcon };+ meta: string;+ onSelect: () => void;+ remark?: string;+ title: string;+}++const UnitRow = ({ active, glyph, meta, onSelect, remark, title }: UnitRowProps) => {+ const { code, name } = splitUnitTitle(title);+ return (+ <button+ aria-pressed={active}+ type="button"+ {...stylex.props(styles.row, active && styles.rowActive)}+ onClick={onSelect}+ >+ <span {...stylex.props(styles.glyph)}>+ <Icon color={glyph.color} icon={glyph.icon} size={16} />+ </span>+ {code && <span {...stylex.props(gateStyles.code)}>{code}</span>}+ <span {...stylex.props(styles.name, !code && styles.nameWithoutCode)}>{name}</span>+ <span {...stylex.props(gateStyles.meta, styles.meta)}>{meta}</span>+ {remark && (+ <span {...stylex.props(styles.remark, !code && styles.remarkWithoutCode)}>{remark}</span>+ )}+ </button>+ );+};++const SETTLED_GLYPH = { color: cssVar.colorSuccess, icon: Check };+const WAITING_GLYPH = { color: cssVar.colorTextQuaternary, icon: CircleDashed };+const REMARK_GLYPH: Record<UnitRemark['kind'], UnitRowProps['glyph']> = {+ reworked: { color: cssVar.colorWarning, icon: Info },+ reworkedCostly: { color: cssVar.colorWarning, icon: Info },+ unsettled: { color: cssVar.colorWarning, icon: TriangleAlert },+};++interface ResultRowProps {+ active: boolean;+ average: number;+ onSelect: () => void;+ unit: GoalReleaseGateUnit;+}++export const ResultRow = ({ active, average, onSelect, unit }: ResultRowProps) => {+ const { t } = useTranslation('verify');+ const unitMeta = useUnitMeta();+ const remark = unitRemark(unit, average);++ const remarkText = () => {+ switch (remark?.kind) {+ case 'unsettled': {+ return t('acceptance.gate.unitUnsettled');+ }+ case 'reworkedCostly': {+ return t('acceptance.gate.unitReworkedCostly', {+ count: remark.rework,+ ratio: remark.ratio,+ });+ }+ case 'reworked': {+ return t('acceptance.gate.unitReworked', { count: remark.rework });+ }+ }+ };++ return (+ <UnitRow+ active={active}+ glyph={remark ? REMARK_GLYPH[remark.kind] : SETTLED_GLYPH}+ meta={unitMeta(unit)}+ remark={remarkText()}+ title={unit.title}+ onSelect={onSelect}+ />+ );+};++interface NextRowProps {+ active: boolean;+ onSelect: () => void;+ title: string;+}++export const NextRow = ({ active, onSelect, title }: NextRowProps) => {+ const { t } = useTranslation('verify');+ return (+ <UnitRow+ active={active}+ glyph={WAITING_GLYPH}+ meta={t('acceptance.gate.unitWaiting')}+ title={title}+ onSelect={onSelect}+ />+ );+};diff --git a/src/features/Acceptance/Viewer/Gate/gateSummary.test.ts b/src/features/Acceptance/Viewer/Gate/gateSummary.test.tsnew file mode 100644index 00000000000..c01b9ba8958--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/gateSummary.test.ts@@ -0,0 +1,191 @@+import type { GoalReleaseGateDossier, GoalReleaseGateUnit } from '@lobechat/types';+import { describe, expect, it } from 'vitest';++import {+ formatTokenEstimate,+ formatTokens,+ orderUnits,+ planDigest,+ splitUnitTitle,+ summarizeGate,+ unitRemark,+} from './gateSummary';++const unit = (patch: Partial<GoalReleaseGateUnit>) =>+ ({+ artifacts: [],+ nodeId: patch.title ?? 'node',+ runs: 1,+ status: 'resolved',+ title: 'Unit',+ tokens: 1_000_000,+ ...patch,+ }) as GoalReleaseGateUnit;++describe('splitUnitTitle', () => {+ it('reads a short leading code apart from the name', () => {+ expect(splitUnitTitle('A2 Balance card')).toEqual({ code: 'A2', name: 'Balance card' });+ });++ it('keeps a title whose first word is not a code whole', () => {+ expect(splitUnitTitle('Migrate the balance card')).toEqual({+ name: 'Migrate the balance card',+ });+ expect(splitUnitTitle('Balance')).toEqual({ name: 'Balance' });+ });+});++describe('formatTokens', () => {+ it('keeps one decimal on a compact count', () => {+ expect(formatTokens(5_000_000)).toBe('5.0M');+ expect(formatTokens(2_840_000)).toBe('2.8M');+ expect(formatTokens(50_400_000)).toBe('50.4M');+ expect(formatTokens(1_200_000_000)).toBe('1.2B');+ expect(formatTokens(12_300)).toBe('12.3K');+ });++ it('leaves a count under a thousand whole', () => {+ expect(formatTokens(0)).toBe('0');+ expect(formatTokens(950)).toBe('950');+ });+});++describe('formatTokenEstimate', () => {+ it('rounds an estimate to two significant digits', () => {+ expect(formatTokenEstimate(56_400_000)).toBe('56M');+ expect(formatTokenEstimate(5_640_000)).toBe('5.6M');+ expect(formatTokenEstimate(123_000_000)).toBe('120M');+ });+});++describe('unitRemark', () => {+ it('has nothing to say about a unit that settled in one run', () => {+ expect(unitRemark(unit({}), 1_000_000)).toBeUndefined();+ });++ it('flags a unit that did not settle, reworked or not', () => {+ expect(unitRemark(unit({ runs: 3, status: 'failed' as never }), 1_000_000)).toEqual({+ kind: 'unsettled',+ });+ });++ it('counts the rework rounds of a reworked unit', () => {+ expect(unitRemark(unit({ runs: 2, tokens: 1_200_000 }), 1_000_000)).toEqual({+ kind: 'reworked',+ rework: 1,+ });+ });++ it('adds the cost ratio once a reworked unit used 1.5× the average', () => {+ expect(unitRemark(unit({ runs: 3, tokens: 5_000_000 }), 3_133_333)).toEqual({+ kind: 'reworkedCostly',+ ratio: '1.6',+ rework: 2,+ });+ });++ it('does not compare against an empty average', () => {+ expect(unitRemark(unit({ runs: 2, tokens: 0 }), 0)).toEqual({ kind: 'reworked', rework: 1 });+ });+});++describe('orderUnits', () => {+ it('leads with unsettled units, then reworked ones, and keeps the rest in report order', () => {+ const units = [+ unit({ title: 'A1' }),+ unit({ runs: 2, title: 'A2' }),+ unit({ title: 'A3' }),+ unit({ status: 'failed' as never, title: 'A4' }),+ unit({ runs: 3, title: 'A5' }),+ ];+ expect(orderUnits(units).map((item) => item.title)).toEqual(['A4', 'A2', 'A5', 'A1', 'A3']);+ });++ it('does not reorder the dossier it was given', () => {+ const units = [unit({ title: 'A1' }), unit({ runs: 2, title: 'A2' })];+ orderUnits(units);+ expect(units.map((item) => item.title)).toEqual(['A1', 'A2']);+ });+});++describe('summarizeGate', () => {+ const dossier = {+ checks: [{ passed: true }, { passed: true }, { passed: false }],+ nextWave: [{ title: 'A4 Profile' }, { title: 'A5 Appearance' }, { title: 'A6 Hotkeys' }],+ remainingAfter: 12,+ units: [+ unit({ title: 'A1 Usage page', tokens: 2_800_000 }),+ unit({ runs: 2, title: 'A2 Balance card', tokens: 5_000_000 }),+ unit({ runs: 2, title: 'Request log', tokens: 1_600_000 }),+ ],+ } as unknown as GoalReleaseGateDossier;++ it('derives the counts the report quotes', () => {+ const summary = summarizeGate(dossier);+ expect(summary.average).toBeCloseTo(3_133_333.33, 1);+ expect(summary.remaining).toBe(15);+ expect(summary.estimate).toBeCloseTo(47_000_000, 0);+ expect(summary.checks).toEqual({ passed: 2, total: 3 });+ });++ it('names reworked units by code, or by title when they carry none', () => {+ expect(summarizeGate(dossier).reworked).toEqual(['A2', 'Request log']);+ });++ it('lists the reworked units first', () => {+ expect(summarizeGate(dossier).units.map((item) => item.title)).toEqual([+ 'A2 Balance card',+ 'Request log',+ 'A1 Usage page',+ ]);+ });++ it('reports no average for a gate without units', () => {+ const summary = summarizeGate({ ...dossier, units: [] });+ expect(summary.average).toBe(0);+ expect(summary.estimate).toBe(0);+ });+});++describe('planDigest', () => {+ it('reads the leading heading as the title and the next paragraph as the summary', () => {+ expect(+ planDigest(+ '# Migrate one settings page to StyleX\n\nMove the page’s `createStaticStyles` blocks to **stylex.create**.\nKeep tokens through [cssVar](https://example.com).\n\n## Steps\n- one',+ ),+ ).toEqual({+ hasMore: true,+ summary:+ 'Move the page’s createStaticStyles blocks to stylex.create. Keep tokens through cssVar.',+ title: 'Migrate one settings page to StyleX',+ });+ });++ it('skips the skill frontmatter', () => {+ expect(planDigest('---\nname: settings-stylex\n---\n\n# Title\n\nBody')).toEqual({+ hasMore: false,+ summary: 'Body',+ title: 'Title',+ });+ });++ it('summarizes a plan that opens on prose without inventing a title', () => {+ expect(+ planDigest('Persist the resource, show stale data first.\n\n## Pitfalls\n- Scope'),+ ).toEqual({+ hasMore: true,+ summary: 'Persist the resource, show stale data first.',+ });+ });++ it('reads a list that opens the plan as its summary', () => {+ expect(planDigest('- Persist the resource\n- Revalidate')).toEqual({+ hasMore: false,+ summary: 'Persist the resource Revalidate',+ });+ });++ it('is empty for an empty plan', () => {+ expect(planDigest('')).toEqual({ hasMore: false });+ });+});diff --git a/src/features/Acceptance/Viewer/Gate/gateSummary.ts b/src/features/Acceptance/Viewer/Gate/gateSummary.tsnew file mode 100644index 00000000000..90ba1557307--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/gateSummary.ts@@ -0,0 +1,125 @@+import type { GoalReleaseGateDossier, GoalReleaseGateUnit } from '@lobechat/types';++import { parseSkillMarkdownFrontmatter } from '@/utils/skillMarkdown';++const MAX_UNIT_CODE_LENGTH = 6;+const COSTLY_RATIO = 1.5;++export const splitUnitTitle = (title: string): { code?: string; name: string } => {+ const [code, ...rest] = title.split(' ');+ return rest.length > 0 && code.length <= MAX_UNIT_CODE_LENGTH+ ? { code, name: rest.join(' ') }+ : { name: title };+};++const compactTokens = new Intl.NumberFormat('en-US', {+ maximumFractionDigits: 1,+ minimumFractionDigits: 1,+ notation: 'compact',+});++const compactEstimate = new Intl.NumberFormat('en-US', {+ maximumSignificantDigits: 2,+ notation: 'compact',+});++export const formatTokens = (tokens: number) =>+ tokens < 1000 ? String(Math.round(tokens)) : compactTokens.format(tokens);++export const formatTokenEstimate = (tokens: number) => compactEstimate.format(tokens);++const isUnsettled = (unit: GoalReleaseGateUnit) => unit.status !== 'resolved';+const isReworked = (unit: GoalReleaseGateUnit) => unit.runs > 1;++export type UnitRemark =+ | { kind: 'reworked'; rework: number }+ | { kind: 'reworkedCostly'; ratio: string; rework: number }+ | { kind: 'unsettled' };++export const unitRemark = (unit: GoalReleaseGateUnit, average: number): UnitRemark | undefined => {+ if (isUnsettled(unit)) return { kind: 'unsettled' };+ if (!isReworked(unit)) return undefined;+ const rework = unit.runs - 1;+ const ratio = average > 0 ? unit.tokens / average : 0;+ return ratio >= COSTLY_RATIO+ ? { kind: 'reworkedCostly', ratio: ratio.toFixed(1), rework }+ : { kind: 'reworked', rework };+};++const attentionRank = (unit: GoalReleaseGateUnit) => {+ if (isUnsettled(unit)) return 0;+ if (isReworked(unit)) return 1;+ return 2;+};++export const orderUnits = (units: GoalReleaseGateUnit[]) =>+ units.toSorted((a, b) => attentionRank(a) - attentionRank(b));++export const summarizeGate = (+ dossier: Pick<GoalReleaseGateDossier, 'checks' | 'nextWave' | 'remainingAfter' | 'units'>,+) => {+ const average =+ dossier.units.reduce((sum, unit) => sum + unit.tokens, 0) / Math.max(1, dossier.units.length);+ const remaining = dossier.nextWave.length + dossier.remainingAfter;+ return {+ average,+ checks: {+ passed: dossier.checks.filter((check) => check.passed).length,+ total: dossier.checks.length,+ },+ estimate: average * remaining,+ remaining,+ reworked: dossier.units+ .filter(isReworked)+ .map((unit) => splitUnitTitle(unit.title).code ?? unit.title),+ units: orderUnits(dossier.units),+ };+};++const HEADING = /^#{1,6}\s+(.+?)\s*#*$/;+const LINE_MARKER = /^(?:[-*+]|\d+[.)]|>)\s+/;++const plainLine = (line: string) =>+ line+ .trim()+ .replace(LINE_MARKER, '')+ .replaceAll(/!?\[([^\]]*)\]\([^)]*\)/g, '$1')+ .replaceAll(/\*\*|__|`/g, '');++export interface PlanDigest {+ hasMore: boolean;+ summary?: string;+ title?: string;+}++export const planDigest = (content: string): PlanDigest => {+ const blocks = parseSkillMarkdownFrontmatter(content)+ .body.split(/\n\s*\n/)+ .map((block) => block.trim())+ .filter(Boolean);++ let title: string | undefined;+ const [firstLine, ...restLines] = (blocks[0] ?? '').split('\n');+ const heading = firstLine.match(HEADING);+ if (heading) {+ title = plainLine(heading[1]);+ blocks.shift();+ if (restLines.length > 0) blocks.unshift(restLines.join('\n'));+ }++ let summary: string | undefined;+ if (blocks[0] && !HEADING.test(blocks[0].split('\n')[0])) {+ summary = blocks+ .shift()!+ .split('\n')+ .map((line) => plainLine(line))+ .filter(Boolean)+ .join(' ');+ }++ return {+ hasMore: blocks.length > 0,+ ...(summary && { summary }),+ ...(title && { title }),+ };+};diff --git a/src/features/Acceptance/Viewer/Gate/styles.ts b/src/features/Acceptance/Viewer/Gate/styles.tsnew file mode 100644index 00000000000..a3e2aa33622--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/styles.ts@@ -0,0 +1,29 @@+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';++export const gateStyles = stylex.create({+ code: {+ fontFamily: cssVar.fontFamilyCode,+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ label: {+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ meta: {+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,+ },+ note: {+ margin: 0,+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+});diff --git a/src/features/Acceptance/Viewer/Gate/useUnitMeta.ts b/src/features/Acceptance/Viewer/Gate/useUnitMeta.tsnew file mode 100644index 00000000000..ce044cb5f15--- /dev/null+++ b/src/features/Acceptance/Viewer/Gate/useUnitMeta.ts@@ -0,0 +1,20 @@+import type { GoalReleaseGateUnit } from '@lobechat/types';+import { useTranslation } from 'react-i18next';++import { formatTokens } from './gateSummary';++export const useUnitMeta = () => {+ const { t } = useTranslation('verify');+ return (unit: GoalReleaseGateUnit) =>+ [+ unit.acceptance?.checks &&+ t('acceptance.gate.unitAcceptance', {+ passed: unit.acceptance.checks.passed,+ total: unit.acceptance.checks.total,+ }),+ t('acceptance.gate.unitRuns', { count: unit.runs }),+ t('acceptance.gate.unitTokens', { tokens: formatTokens(unit.tokens) }),+ ]+ .filter(Boolean)+ .join(' · ');+};diff --git a/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsxindex 5fb52b2df7c..805e9d6f4db 100644--- a/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx@@ -41,7 +41,7 @@ const styles = stylex.create({transition: 'opacity 150ms ease',},metaRow: {- fontSize: '13px',+ fontSize: '14px',color: cssVar.colorTextSecondary,},});diff --git a/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsxindex 894025dca77..564cbac46b3 100644--- a/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx+++ b/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx@@ -53,7 +53,7 @@ const AcceptanceStatusPill = ({ menu, pending, size = 13, status }: AcceptanceSt><Icon icon={verdictMeta.icon} size={size} spin={verdictMeta.spin} />{verdictMeta.label}- {menu ? <Icon icon={ChevronDown} size={11} /> : null}+ {menu ? <Icon icon={ChevronDown} size={12} /> : null}</span>);diff --git a/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx b/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsxindex 6a78c00487e..dd0d00049d9 100644--- a/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx+++ b/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx@@ -1,6 +1,6 @@'use client';-import { DraggablePanel, Flexbox, Icon, Text, useResponsive } from '@lobehub/ui';+import { DraggablePanel, Flexbox, Icon, useResponsive } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { PanelRightOpen } from 'lucide-react';@@ -11,23 +11,41 @@ import { AcceptanceDrawer } from '../../AcceptanceDrawer';import ReportViewer from '../../Report/ReportViewer';import { resolveRoundParam } from '../../utils';import { useAcceptanceScope } from '../AcceptanceScope';-import { checkFilterState } from '../Checks/checkState';import { originTopicPanelProps } from '../Conversation/originConversation';import { useAcceptanceBundle } from '../useAcceptanceBundle';import { canViewAcceptanceHistory } from '../visibility';-import LedgerPanel, { type AcceptanceRound } from './LedgerPanel';+import AcceptanceInteractionCost from './AcceptanceInteractionCost';+import LedgerPanel from './LedgerPanel';+import { type AcceptanceRound, buildRoundCards } from './roundState';import { useAcceptanceRailState } from './useAcceptanceRailState';const styles = stylex.create({- chipCount: { fontSize: '11px', fontWeight: 500, color: cssVar.colorTextSecondary },+ chipCount: {+ fontSize: '12px',+ fontWeight: 500,+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },toggle: {cursor: 'pointer',position: 'absolute',zIndex: 10,insetBlockStart: '16px',insetInlineEnd: '12px',+ display: 'flex',+ flexDirection: 'column',+ gap: '4px',+ alignItems: 'center',+ appearance: 'none',+ margin: '0',paddingBlock: '8px',- paddingInline: '5px',+ paddingInline: '4px',+ font: 'inherit',+ color: cssVar.colorText,+ outlineWidth: { 'default': null, ':focus-visible': '2px' },+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimary },+ outlineOffset: { 'default': null, ':focus-visible': '2px' },borderWidth: '1px',borderStyle: 'solid',borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },@@ -57,19 +75,6 @@ const AcceptanceLedgerRail = () => {const urlRoundRaw = searchParams.get('report');const reportRound = embedded ? null : resolveRoundParam(data.rounds, urlRoundRaw);- const reviewableChecks = data.checks;- const reviewByRound = (() => {- const map = new Map<number, { accepted: number; total: number }>();- for (const check of reviewableChecks) {- const round = check.resultRound;- if (round === undefined || round === null) continue;- const cur = map.get(round) ?? { accepted: 0, total: 0 };- cur.total += 1;- if (checkFilterState(check) === 'accepted') cur.accepted += 1;- map.set(round, cur);- }- return map;- })();const openReport = (round: AcceptanceRound | null) => {if (embedded) return;@@ -104,10 +109,10 @@ const AcceptanceLedgerRail = () => {const ledger = (<LedgerPanel+ cards={buildRoundCards(data)}+ footer={<AcceptanceInteractionCost data={data} />}hideCollapse={isNarrowViewport}highlight={highlightRound}- reviewByRound={reviewByRound}- rounds={data.rounds}onCollapse={() => onExpandChange(false)}onOpenReport={openReport}/>@@ -116,16 +121,16 @@ const AcceptanceLedgerRail = () => {return (<>{!focused && !expand && (- <Flexbox- align={'center'}- className={stylex.props(styles.toggle).className}- gap={5}+ <button+ aria-label={t('acceptance.ledger.expand')}title={t('acceptance.ledger.expand')}+ type={'button'}+ {...stylex.props(styles.toggle)}onClick={() => onExpandChange(true)}><Icon icon={PanelRightOpen} size={14} />- <Text className={stylex.props(styles.chipCount).className}>{data.rounds.length}</Text>- </Flexbox>+ <span {...stylex.props(styles.chipCount)}>{(data.rounds ?? []).length}</span>+ </button>)}{isNarrowViewport ? (<AcceptanceDrawerdiff --git a/src/features/Acceptance/Viewer/History/LedgerPanel.tsx b/src/features/Acceptance/Viewer/History/LedgerPanel.tsxindex 6280fd13986..da28c94a462 100644--- a/src/features/Acceptance/Viewer/History/LedgerPanel.tsx+++ b/src/features/Acceptance/Viewer/History/LedgerPanel.tsx@@ -1,125 +1,46 @@'use client';-import { ActionIcon, Flexbox, Icon, Text } from '@lobehub/ui';+import { ActionIcon, Flexbox, Icon } from '@lobehub/ui';import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import dayjs from 'dayjs';-import {- CheckCircle2,- ChevronRight,- Circle,- CircleAlert,- FileClock,- Loader2,- PanelRightClose,- RefreshCw,- RotateCcw,-} from 'lucide-react';-import { memo } from 'react';+import { FileClock, PanelRightClose } from 'lucide-react';+import { memo, type ReactNode } from 'react';import { useTranslation } from 'react-i18next';-import { useIsHydrated } from '@/hooks/useIsHydrated';-import type { AcceptanceBundle } from '@/services/verify';--import { roundCardMarker } from '../markers.stylex';--export type AcceptanceRound = AcceptanceBundle['rounds'][number];--/** Per-round acceptance tally (how many of the round's own checks the user signed off). */-export interface RoundReview {- accepted: number;- total: number;-}+import RoundCard from './RoundCard';+import type { AcceptanceRound, RoundCardModel } from './roundState';const styles = stylex.create({- countBadge: {- paddingBlock: '1px',- paddingInline: '7px',- borderRadius: '99px',+ title: { fontSize: '14px', fontWeight: 600, lineHeight: '22px', color: cssVar.colorText },+ count: {fontSize: '12px',fontVariantNumeric: 'tabular-nums',- color: cssVar.colorTextSecondary,- backgroundColor: cssVar.colorFillTertiary,- },- round: {- paddingBlock: '10px',- paddingInline: '12px',- borderWidth: '1px',- borderStyle: 'solid',- borderColor: cssVar.colorBorderSecondary,- borderRadius: cssVar.borderRadius,- transition: 'box-shadow 0.2s ease, border-color 0.2s ease',- },- roundActive: {- borderColor: cssVar.colorPrimary,- boxShadow: `0 0 0 2px ${cssVar.colorPrimaryBg}`,- },- // The whole card is the report affordance — no inner button.- roundClickable: {- cursor: 'pointer',- borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },- backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },- },- // An active card that is also clickable: hover still wins over the active- // border, as `.roundClickable:hover` outranked `.roundActive` before.- roundActiveClickable: {- borderColor: { 'default': cssVar.colorPrimary, ':hover': cssVar.colorBorder },- boxShadow: `0 0 0 2px ${cssVar.colorPrimaryBg}`,- },- openHint: {- opacity: { default: 0, [stylex.when.ancestor(':hover', roundCardMarker)]: 1 },- transition: 'opacity 0.2s ease',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,},});-/** Only the still-running states keep a machine indicator; a settled round is- reframed as an ACCEPTANCE state (已验收 / 待验收), not a verification verdict. */-const RUNNING_META: Record<string, { color: string; icon: typeof CheckCircle2 }> = {- errored: { color: cssVar.colorWarning, icon: CircleAlert },- repairing: { color: cssVar.colorWarning, icon: RefreshCw },- verifying: { color: cssVar.colorInfo, icon: Loader2 },-};--/** Is the round still executing (so it has no settled result to accept yet)? */-const isRunningRound = (round: AcceptanceRound): boolean => {- const status = round.run.status;- if (status === 'verifying' || status === 'repairing' || status === 'errored') return true;- // No report yet and no terminal status → still spinning up.- return !round.report && status !== 'passed' && status !== 'failed';-};-interface LedgerPanelProps {+ cards: RoundCardModel[];+ footer?: ReactNode;/** The hosting surface already provides a close affordance (narrow-modeDrawer) — a second collapse icon here would read as two closes. */hideCollapse?: boolean;highlight: number | null;onCollapse: () => void;onOpenReport: (round: AcceptanceRound) => void;- /** Per-round acceptance tally, keyed by round index (the round's own checks). */- reviewByRound: Map<number, RoundReview>;- rounds: AcceptanceRound[];}-/**- * The execution history, demoted to an audit side panel (P-13). Each row is a- * round; the state it reports is the user's ACCEPTANCE progress on that round's- * checks (已验收 / 待验收), not the raw verification verdict — the panel speaks- * the same acceptance language as the checklist.- */const LedgerPanel = memo<LedgerPanelProps>(- ({ hideCollapse, highlight, onCollapse, onOpenReport, reviewByRound, rounds }) => {+ ({ cards, footer, hideCollapse, highlight, onCollapse, onOpenReport }) => {const { t } = useTranslation('verify');- const hydrated = useIsHydrated();- const latestIndex = rounds.at(-1)?.run.roundIndex;return (<Flexbox gap={12} padding={16}><Flexbox horizontal align={'center'} gap={8}><Icon color={cssVar.colorTextSecondary} icon={FileClock} size={16} />- <Text strong style={{ fontSize: 13 }}>- {t('acceptance.ledger.title')}- </Text>- <span {...stylex.props(styles.countBadge)}>{rounds.length}</span>+ <span {...stylex.props(styles.title)}>{t('acceptance.ledger.title')}</span>+ <span {...stylex.props(styles.count)}>{cards.length}</span><Flexbox flex={1} />{!hideCollapse && (<ActionIcon@@ -130,117 +51,15 @@ const LedgerPanel = memo<LedgerPanelProps>(/>)}</Flexbox>- {[...rounds].reverse().map((round) => {- const running = isRunningRound(round);- const runStatus = round.run.status ?? 'verifying';- const runningMeta = running ? (RUNNING_META[runStatus] ?? RUNNING_META.verifying) : null;- const rv =- round.run.roundIndex != null ? reviewByRound.get(round.run.roundIndex) : undefined;- const total = rv?.total ?? 0;- const accepted = rv?.accepted ?? 0;- const allAccepted = total > 0 && accepted >= total;-- // A round the user sent back is a distinct outcome, not "still- // pending" — without this it renders identically to an unreviewed- // round, so the ledger cannot show which round triggered a rerun.- const rejected = round.run.userDecision === 'reject';-- const stateColor = runningMeta- ? runningMeta.color- : rejected- ? cssVar.colorError- : allAccepted- ? cssVar.colorSuccess- : cssVar.colorTextTertiary;- const stateIcon = runningMeta- ? runningMeta.icon- : rejected- ? RotateCcw- : allAccepted- ? CheckCircle2- : Circle;- const stateLabel = runningMeta- ? t(`acceptance.roundStatus.${runStatus}` as 'acceptance.roundStatus.verifying', {- defaultValue: runStatus,- })- : rejected- ? t('acceptance.status.rejected')- : allAccepted- ? t('acceptance.ledger.accepted')- : t('acceptance.ledger.pending');-- // Acceptance-framed stats: how many of THIS round's checks are signed- // off (accepted/total), or all still awaiting. A rejected round shows- // the reason instead — it is the input that seeded the next round.- const stats = rejected- ? round.run.decisionDetail?.comment || t('acceptance.banner.rejectedHint')- : running || total === 0- ? null- : accepted > 0- ? t('acceptance.ledger.acceptedStats', { accepted, total })- : t('acceptance.ledger.awaitingStats', { total });-- const openable = Boolean(round.report);-- return (- <Flexbox- aria-label={openable ? t('acceptance.ledger.viewReport') : undefined}- gap={6}- key={round.run.id}- role={openable ? 'button' : undefined}- {...stylex.props(- styles.round,- openable && styles.roundClickable,- openable && roundCardMarker,- highlight === round.run.roundIndex &&- (openable ? styles.roundActiveClickable : styles.roundActive),- )}- onClick={openable ? () => onOpenReport(round) : undefined}- >- <Flexbox horizontal align={'center'} gap={8}>- <Text strong style={{ fontSize: 13 }}>- {t('acceptance.round', { round: round.run.roundIndex })}- </Text>- {round.run.roundIndex === latestIndex && (- <Text fontSize={12} type={'secondary'}>- {t('acceptance.ledger.latest')}- </Text>- )}- <Flexbox- horizontal- align={'center'}- gap={4}- style={{ color: stateColor, fontSize: 12 }}- >- <Icon icon={stateIcon} size={13} spin={running} />- {stateLabel}- </Flexbox>- <Flexbox flex={1} />- <Text fontSize={12} type={'secondary'}>- {hydrated ? dayjs(round.run.createdAt).format('MM-DD HH:mm') : null}- </Text>- {openable && (- <Icon- color={cssVar.colorTextTertiary}- icon={ChevronRight}- size={14}- {...stylex.props(styles.openHint)}- />- )}- </Flexbox>- {round.run.title && (- <Text fontSize={12} style={{ lineHeight: 1.5 }} type={'secondary'}>- {round.run.title}- </Text>- )}- {stats && (- <Text fontSize={12} type={'secondary'}>- {stats}- </Text>- )}- </Flexbox>- );- })}+ {cards.map((card) => (+ <RoundCard+ active={highlight !== null && highlight === card.round.run.roundIndex}+ card={card}+ key={card.round.run.id}+ onOpen={onOpenReport}+ />+ ))}+ {footer}</Flexbox>);},diff --git a/src/features/Acceptance/Viewer/History/RoundCard.tsx b/src/features/Acceptance/Viewer/History/RoundCard.tsxnew file mode 100644index 00000000000..5225385e779--- /dev/null+++ b/src/features/Acceptance/Viewer/History/RoundCard.tsx@@ -0,0 +1,150 @@+'use client';++import { Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import dayjs from 'dayjs';+import { ChevronRight } from 'lucide-react';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { useIsHydrated } from '@/hooks/useIsHydrated';++import DecisionStrip from '../Review/DecisionStrip';+import { type AcceptanceRound, type RoundCardModel, roundStateMeta } from './roundState';++const styles = stylex.create({+ card: {+ display: 'flex',+ flexDirection: 'column',+ gap: '4px',+ width: '100%',+ margin: '0',+ paddingBlock: '12px',+ paddingInline: '12px',+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: cssVar.colorBorderSecondary,+ borderRadius: '8px',+ font: 'inherit',+ color: cssVar.colorText,+ textAlign: 'start',+ backgroundColor: cssVar.colorBgContainer,+ backgroundImage: 'none',+ },+ openable: {+ cursor: 'pointer',+ appearance: 'none',+ borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },+ outlineWidth: { 'default': null, ':focus-visible': '2px' },+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimary },+ outlineOffset: { 'default': null, ':focus-visible': '2px' },+ },+ active: {+ borderColor: { 'default': cssVar.colorPrimary, ':hover': cssVar.colorPrimary },+ },+ line: { display: 'flex', gap: '8px', alignItems: 'center', minWidth: 0 },+ name: { fontSize: '14px', fontWeight: 600, lineHeight: '22px' },+ spacer: { flex: '1' },+ secondary: { fontSize: '12px', lineHeight: '20px', color: cssVar.colorTextSecondary },+ tertiary: {+ flex: 'none',+ fontSize: '12px',+ fontVariantNumeric: 'tabular-nums',+ lineHeight: '20px',+ color: cssVar.colorTextTertiary,+ },+ chevron: { display: 'inline-flex', flex: 'none', color: cssVar.colorTextQuaternary },+ wrap: { overflowWrap: 'anywhere' },+ state: {+ display: 'inline-flex',+ flex: 'none',+ gap: '4px',+ alignItems: 'center',+ fontSize: '12px',+ lineHeight: '20px',+ },+ error: { color: cssVar.colorErrorText },+ info: { color: cssVar.colorInfo },+ neutral: { color: cssVar.colorTextSecondary },+ success: { color: cssVar.colorSuccessText },+ warning: { color: cssVar.colorWarningText },+ strip: { marginBlockStart: '4px' },+});++interface RoundCardProps {+ active: boolean;+ card: RoundCardModel;+ onOpen: (round: AcceptanceRound) => void;+}++const RoundCard = memo<RoundCardProps>(({ active, card, onOpen }) => {+ const { t } = useTranslation('verify');+ const hydrated = useIsHydrated();+ const { accepted, isLatest, openable, round, segments, state, total } = card;+ const meta = roundStateMeta(state, t);+ const reason =+ state === 'rejected' ? card.reason || t('acceptance.banner.rejectedHint') : undefined;++ const body = (+ <>+ <span {...stylex.props(styles.line)}>+ <span {...stylex.props(styles.name)}>+ {t('acceptance.round', { round: round.run.roundIndex })}+ </span>+ {isLatest && (+ <span {...stylex.props(styles.secondary)}>{t('acceptance.ledger.latest')}</span>+ )}+ <span {...stylex.props(styles.spacer)} />+ <span {...stylex.props(styles.tertiary)}>+ {hydrated ? dayjs(round.run.createdAt).format('MM-DD HH:mm') : null}+ </span>+ {openable && (+ <span {...stylex.props(styles.chevron)}>+ <Icon icon={ChevronRight} size={14} />+ </span>+ )}+ </span>+ {round.run.title && (+ <span {...stylex.props(styles.secondary, styles.wrap)}>{round.run.title}</span>+ )}+ <span {...stylex.props(styles.line)}>+ <span {...stylex.props(styles.state, styles[meta.tone])}>+ {meta.icon && <Icon icon={meta.icon} size={14} spin={meta.spin} />}+ {meta.label}+ </span>+ {state === 'toReview' && total > 0 && (+ <span {...stylex.props(styles.tertiary)}>+ {t('acceptance.roundState.summary', { accepted, total })}+ </span>+ )}+ </span>+ {reason && <span {...stylex.props(styles.secondary, styles.wrap)}>{reason}</span>}+ {total > 0 && (+ <DecisionStrip+ label={t('acceptance.bar.stripLabel', { accepted, total })}+ segments={segments}+ xstyle={styles.strip}+ />+ )}+ </>+ );++ if (!openable) return <div {...stylex.props(styles.card, active && styles.active)}>{body}</div>;++ return (+ <button+ title={t('acceptance.ledger.viewReport')}+ type={'button'}+ {...stylex.props(styles.card, styles.openable, active && styles.active)}+ onClick={() => onOpen(round)}+ >+ {body}+ </button>+ );+});++RoundCard.displayName = 'AcceptanceRoundCard';++export default RoundCard;diff --git a/src/features/Acceptance/Viewer/History/roundState.test.ts b/src/features/Acceptance/Viewer/History/roundState.test.tsnew file mode 100644index 00000000000..2b57b2c2467--- /dev/null+++ b/src/features/Acceptance/Viewer/History/roundState.test.ts@@ -0,0 +1,182 @@+import type { TFunction } from 'i18next';+import { BadgeCheck, Info, Loader2, RotateCcw, Wrench } from 'lucide-react';+import { describe, expect, it } from 'vitest';++import type { AcceptanceBundle } from '@/services/verify';++import { buildRoundCards, resolveRoundState, roundStateMeta } from './roundState';++const t = ((key: string) => key) as TFunction<'verify'>;++const settled = { accepted: 0, hasReport: true, status: 'passed', total: 8, userDecision: null };++describe('resolveRoundState', () => {+ it('names a round that has not started instead of leaking its raw status', () => {+ expect(resolveRoundState({ ...settled, hasReport: false, status: 'pending' })).toBe('waiting');+ expect(resolveRoundState({ ...settled, hasReport: false, status: 'planned' })).toBe('waiting');+ });++ it('reads a round without a status or report as running', () => {+ expect(resolveRoundState({ ...settled, hasReport: false, status: null })).toBe('running');+ expect(resolveRoundState({ ...settled, status: 'verifying' })).toBe('running');+ });++ it('keeps repairing and errored apart from running', () => {+ expect(resolveRoundState({ ...settled, status: 'repairing' })).toBe('repairing');+ expect(resolveRoundState({ ...settled, status: 'errored' })).toBe('errored');+ });++ it('waits on the reviewer until every check of the round is accepted', () => {+ expect(resolveRoundState(settled)).toBe('toReview');+ expect(resolveRoundState({ ...settled, accepted: 4 })).toBe('toReview');+ expect(resolveRoundState({ ...settled, accepted: 8 })).toBe('accepted');+ expect(resolveRoundState({ ...settled, total: 0 })).toBe('toReview');+ });++ it('reports a sent-back round as rejected whatever its tally', () => {+ expect(resolveRoundState({ ...settled, accepted: 8, userDecision: 'reject' })).toBe('rejected');+ });++ it('settles a failed or uncertain verification into a review state', () => {+ expect(resolveRoundState({ ...settled, hasReport: false, status: 'failed' })).toBe('toReview');+ expect(resolveRoundState({ ...settled, hasReport: false, status: 'uncertain' })).toBe(+ 'toReview',+ );+ });+});++describe('roundStateMeta', () => {+ it('speaks one vocabulary', () => {+ const labels = (+ ['waiting', 'running', 'repairing', 'errored', 'toReview', 'rejected', 'accepted'] as const+ ).map((state) => roundStateMeta(state, t).label);+ expect(labels).toEqual([+ 'acceptance.roundState.waiting',+ 'acceptance.roundState.running',+ 'acceptance.roundState.repairing',+ 'acceptance.roundState.errored',+ 'acceptance.roundState.toReview',+ 'acceptance.roundState.rejected',+ 'acceptance.roundState.accepted',+ ]);+ });++ it('spins only while the round is waiting or running', () => {+ expect(roundStateMeta('waiting', t)).toMatchObject({ icon: Loader2, spin: true, tone: 'info' });+ expect(roundStateMeta('running', t)).toMatchObject({ icon: Loader2, spin: true, tone: 'info' });+ expect(roundStateMeta('repairing', t)).toMatchObject({+ icon: Wrench,+ spin: false,+ tone: 'warning',+ });+ });++ it('shows an errored round with a static icon', () => {+ expect(roundStateMeta('errored', t)).toMatchObject({+ icon: Info,+ spin: false,+ tone: 'warning',+ });+ });++ it('leaves the review state as plain text', () => {+ const meta = roundStateMeta('toReview', t);+ expect(meta.icon).toBeUndefined();+ expect(meta.tone).toBe('neutral');+ });++ it('takes the settled icons from the acceptance verdict', () => {+ expect(roundStateMeta('rejected', t)).toMatchObject({+ icon: RotateCcw,+ spin: false,+ tone: 'error',+ });+ expect(roundStateMeta('accepted', t)).toMatchObject({+ icon: BadgeCheck,+ spin: false,+ tone: 'success',+ });+ });+});++const step = (roundIndex: number) => ({ evidence: [], roundIndex, state: 'passed', title: 'step' });++const check = (+ id: string,+ options: {+ reviews?: { action: 'accept' | 'ignore' | 'reject'; roundIndex: number }[];+ rounds: number[];+ },+) => {+ const reviews = options.reviews ?? [];+ const latest = reviews.at(-1);+ return {+ evidence: [],+ id,+ result: { id: `result-${id}` },+ resultRound: options.rounds.at(-1),+ reviews,+ state: 'passed',+ timeline: options.rounds.map(step),+ title: id,+ userReview: latest+ ? { ...latest, stale: latest.roundIndex !== options.rounds.at(-1) }+ : undefined,+ };+};++const round = (roundIndex: number, run: Record<string, unknown> = {}, report: unknown = {}) => ({+ report,+ run: { id: `run-${roundIndex}`, plan: [], roundIndex, status: 'passed', ...run },+});++const bundle = (value: { checks: unknown[]; rounds: unknown[] }) =>+ value as unknown as AcceptanceBundle;++describe('buildRoundCards', () => {+ it('lists the newest round first and marks it latest', () => {+ const cards = buildRoundCards(bundle({ checks: [], rounds: [round(1), round(2)] }));+ expect(cards.map((card) => card.round.run.roundIndex)).toEqual([2, 1]);+ expect(cards.map((card) => card.isLatest)).toEqual([true, false]);+ });++ it('tallies each round from the decisions made in that round', () => {+ const cards = buildRoundCards(+ bundle({+ checks: [+ check('a', {+ reviews: [+ { action: 'reject', roundIndex: 1 },+ { action: 'accept', roundIndex: 2 },+ ],+ rounds: [1, 2],+ }),+ check('b', { reviews: [{ action: 'accept', roundIndex: 1 }], rounds: [1, 2] }),+ check('c', { rounds: [1, 2] }),+ ],+ rounds: [+ round(1, { decisionDetail: { comment: 'Range resets.' }, userDecision: 'reject' }),+ round(2),+ ],+ }),+ );++ expect(cards[0]).toMatchObject({ accepted: 1, state: 'toReview', total: 3 });+ expect(cards[0].segments).toEqual(['accepted', 'pending', 'pending']);+ expect(cards[1]).toMatchObject({+ accepted: 1,+ reason: 'Range resets.',+ state: 'rejected',+ total: 3,+ });+ expect(cards[1].segments).toEqual(['accepted', 'needsFix', 'pending']);+ });++ it('opens only the rounds that have a report', () => {+ const cards = buildRoundCards(+ bundle({ checks: [], rounds: [round(1), round(2, { status: 'pending' }, null)] }),+ );+ expect(cards.map((card) => card.openable)).toEqual([false, true]);+ expect(cards[0].state).toBe('waiting');+ });+});diff --git a/src/features/Acceptance/Viewer/History/roundState.ts b/src/features/Acceptance/Viewer/History/roundState.tsnew file mode 100644index 00000000000..857efdd14da--- /dev/null+++ b/src/features/Acceptance/Viewer/History/roundState.ts@@ -0,0 +1,136 @@+import type { TFunction } from 'i18next';+import { Info, type LucideIcon, Wrench } from 'lucide-react';++import type { AcceptanceBundle } from '@/services/verify';++import { type DecisionSegment, decisionSegments } from '../Checks/checkDecision';+import { checksForTurn } from '../turnChecks';+import { resolveAcceptanceVerdictMeta } from '../verdict';++export type AcceptanceRound = AcceptanceBundle['rounds'][number];++export type RoundState =+ 'accepted' | 'errored' | 'rejected' | 'repairing' | 'running' | 'toReview' | 'waiting';++export type RoundTone = 'error' | 'info' | 'neutral' | 'success' | 'warning';++const WAITING_STATUSES = new Set(['pending', 'planned']);+const SETTLED_STATUSES = new Set(['failed', 'passed', 'uncertain']);++export const resolveRoundState = ({+ accepted,+ hasReport,+ status,+ total,+ userDecision,+}: {+ accepted: number;+ hasReport: boolean;+ status?: string | null;+ total: number;+ userDecision?: string | null;+}): RoundState => {+ if (status === 'errored') return 'errored';+ if (status === 'repairing') return 'repairing';+ if (status === 'verifying') return 'running';+ if (!hasReport && !(status && SETTLED_STATUSES.has(status)))+ return status && WAITING_STATUSES.has(status) ? 'waiting' : 'running';+ if (userDecision === 'reject') return 'rejected';+ return total > 0 && accepted >= total ? 'accepted' : 'toReview';+};++const VERDICT_STATUS: Record<RoundState, string> = {+ accepted: 'accepted',+ errored: 'errored',+ rejected: 'rejected',+ repairing: 'repairing',+ running: 'verifying',+ toReview: 'delivered',+ waiting: 'pending',+};++const ROUND_STATE_TONE: Record<RoundState, RoundTone> = {+ accepted: 'success',+ errored: 'warning',+ rejected: 'error',+ repairing: 'warning',+ running: 'info',+ toReview: 'neutral',+ waiting: 'info',+};++const ROUND_STATE_LABEL_KEY = {+ accepted: 'acceptance.roundState.accepted',+ errored: 'acceptance.roundState.errored',+ rejected: 'acceptance.roundState.rejected',+ repairing: 'acceptance.roundState.repairing',+ running: 'acceptance.roundState.running',+ toReview: 'acceptance.roundState.toReview',+ waiting: 'acceptance.roundState.waiting',+} as const satisfies Record<RoundState, string>;++const STATIC_ICON: Partial<Record<RoundState, LucideIcon | null>> = {+ errored: Info,+ repairing: Wrench,+ toReview: null,+};++export interface RoundStateMeta {+ icon?: LucideIcon;+ label: string;+ spin: boolean;+ tone: RoundTone;+}++export const roundStateMeta = (state: RoundState, t: TFunction<'verify'>): RoundStateMeta => {+ const label = t(ROUND_STATE_LABEL_KEY[state]);+ const tone = ROUND_STATE_TONE[state];+ if (state in STATIC_ICON)+ return { icon: STATIC_ICON[state] ?? undefined, label, spin: false, tone };+ const verdict = resolveAcceptanceVerdictMeta(VERDICT_STATUS[state], t);+ return { icon: verdict.icon, label, spin: Boolean(verdict.spin), tone };+};++export interface RoundCardModel {+ accepted: number;+ isLatest: boolean;+ openable: boolean;+ reason: string | null;+ round: AcceptanceRound;+ segments: DecisionSegment[];+ state: RoundState;+ total: number;+}++const roundChecks = (data: AcceptanceBundle, roundIndex: number | null, isLatest: boolean) => {+ if (isLatest) return data.checks;+ if (roundIndex === null) return [];+ return checksForTurn(data, roundIndex);+};++export const buildRoundCards = (data: AcceptanceBundle): RoundCardModel[] => {+ const latestIndex = data.rounds.at(-1)?.run.roundIndex;+ return [...data.rounds].reverse().map((round) => {+ const roundIndex = round.run.roundIndex ?? null;+ const isLatest = roundIndex === latestIndex;+ const segments = decisionSegments(roundChecks(data, roundIndex, isLatest));+ const accepted = segments.filter((segment) => segment === 'accepted').length;+ const state = resolveRoundState({+ accepted,+ hasReport: Boolean(round.report),+ status: round.run.status,+ total: segments.length,+ userDecision: round.run.userDecision,+ });+ return {+ accepted,+ isLatest,+ openable: Boolean(round.report),+ reason: state === 'rejected' ? round.run.decisionDetail?.comment || null : null,+ round,+ segments,+ state,+ total: segments.length,+ };+ });+};diff --git a/src/features/Acceptance/Viewer/History/runsPanel.ts b/src/features/Acceptance/Viewer/History/runsPanel.tsnew file mode 100644index 00000000000..b3ea0ea3abc--- /dev/null+++ b/src/features/Acceptance/Viewer/History/runsPanel.ts@@ -0,0 +1,3 @@+import { createContext } from 'react';++export const RunsPanelContext = createContext(false);diff --git a/src/features/Acceptance/Viewer/QuietState.tsx b/src/features/Acceptance/Viewer/QuietState.tsxnew file mode 100644index 00000000000..fb9d8e3c941--- /dev/null+++ b/src/features/Acceptance/Viewer/QuietState.tsx@@ -0,0 +1,67 @@+'use client';++import { Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import type { StyleXStyles } from '@stylexjs/stylex';+import * as stylex from '@stylexjs/stylex';+import type { LucideIcon } from 'lucide-react';+import type { ReactNode } from 'react';++const styles = stylex.create({+ root: {+ display: 'flex',+ flexDirection: 'column',+ gap: '8px',+ alignItems: 'center',+ justifyContent: 'center',+ paddingBlock: '24px',+ paddingInline: '24px',+ textAlign: 'center',+ },+ icon: { display: 'inline-flex' },+ muted: { color: cssVar.colorTextTertiary },+ warning: { color: cssVar.colorWarning },+ title: {+ fontSize: '14px',+ fontWeight: 600,+ lineHeight: '22px',+ color: cssVar.colorText,+ },+ description: {+ maxWidth: '280px',+ margin: '0',+ fontSize: '14px',+ lineHeight: '22px',+ color: cssVar.colorTextSecondary,+ },+ action: { marginBlockStart: '4px' },+});++interface QuietStateProps {+ action?: ReactNode;+ description?: ReactNode;+ icon: LucideIcon;+ title: ReactNode;+ tone?: 'muted' | 'warning';+ xstyle?: StyleXStyles;+}++const QuietState = ({+ action,+ description,+ icon,+ title,+ tone = 'muted',+ xstyle,+}: QuietStateProps) => (+ <div {...stylex.props(styles.root, xstyle)}>+ <span {...stylex.props(styles.icon, styles[tone])}>+ <Icon icon={icon} size={24} />+ </span>+ <div {...stylex.props(styles.title)}>{title}</div>+ {description && <p {...stylex.props(styles.description)}>{description}</p>}+ {action && <div {...stylex.props(styles.action)}>{action}</div>}+ </div>+);++export default QuietState;diff --git a/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx b/src/features/Acceptance/Viewer/ReadOnly/Checks.tsxindex 8ff513b4ed2..108da013f93 100644--- a/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx+++ b/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx@@ -117,7 +117,7 @@ const ReadCheck = ({</Text>) : check.result?.toulmin?.reasoning ? (<Flexbox gap={4} paddingBlock={8} paddingInline={10}>- <Text fontSize={11} type={'secondary'}>+ <Text fontSize={12} type={'secondary'}>{t('acceptance.checks.judgeReason')}</Text><Text fontSize={12} style={{ whiteSpace: 'pre-wrap' }}>diff --git a/src/features/Acceptance/Viewer/ReadOnly/Discussion.tsx b/src/features/Acceptance/Viewer/ReadOnly/Discussion.tsxindex de03b6e837d..d7d67752e1a 100644--- a/src/features/Acceptance/Viewer/ReadOnly/Discussion.tsx+++ b/src/features/Acceptance/Viewer/ReadOnly/Discussion.tsx@@ -1,7 +1,7 @@import type { AcceptanceCommentItem } from '@lobechat/types';-import { Avatar, Button, Empty, Flexbox, Spin, Text } from '@lobehub/ui';+import { Avatar, Button, Flexbox, Icon, Spin, Text } from '@lobehub/ui';import * as stylex from '@stylexjs/stylex';-import { BadgeCheck, GitCommitHorizontal } from 'lucide-react';+import { BadgeCheck, GitCommitHorizontal, Info, MessagesSquare, RefreshCw } from 'lucide-react';import { useTranslation } from 'react-i18next';import { useActivityTime } from '@/hooks/useActivityTime';@@ -15,6 +15,7 @@ import { styles } from '../Comments/styles';import { groupCommentThreads } from '../Comments/threads';import TimelineEvent from '../Comments/TimelineEvent';import { useAcceptanceCommentList } from '../Comments/useAcceptanceCommentList';+import QuietState from '../QuietState';import { useAcceptanceBundle } from '../useAcceptanceBundle';export const ReadComment = ({@@ -75,9 +76,16 @@ const ReadDiscussion = () => {if (!data && isLoading) return <Spin size="middle" />;if (!data && error)return (- <Empty description={t('acceptance.comments.loadFailed')}>- <Button onClick={() => void mutate()}>{t('report.actions.retry')}</Button>- </Empty>+ <QuietState+ icon={Info}+ title={t('acceptance.comments.loadFailedTitle')}+ tone={'warning'}+ action={+ <Button icon={<Icon icon={RefreshCw} />} onClick={() => void mutate()}>+ {t('report.actions.retry')}+ </Button>+ }+ />);const items = data?.items ?? [];@@ -91,7 +99,8 @@ const ReadDiscussion = () => {})),threads: groupCommentThreads(items),});- if (timeline.length === 0) return <Empty description={t('acceptance.comments.empty')} />;+ if (timeline.length === 0)+ return <QuietState icon={MessagesSquare} title={t('acceptance.comments.emptyTitle')} />;return (<Flexbox gap={16}>diff --git a/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsxindex fbad99a2d12..c4108863997 100644--- a/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx+++ b/src/features/Acceptance/Viewer/Review/AcceptanceDecision.tsx@@ -11,6 +11,7 @@ import { verifyService } from '@/services/verify';import { useVerifyStore } from '@/store/verify';import { useAcceptanceScope } from '../AcceptanceScope';+import { decisionSegments } from '../Checks/checkDecision';import { isException } from '../Checks/checkState';import { useAcceptanceComments } from '../Comments/hooks';import { flowPlanPhase } from '../Plan/planReview';@@ -138,6 +139,7 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {repairing={acceptance.status === 'repairing'}rerunAvailable={embedded}rerunPending={false}+ segments={decisionSegments(checks)}state={barState}statusText={statusText}subText={subTextWithApprovals || undefined}@@ -235,7 +237,6 @@ const AcceptanceDecision = ({ onDraftToComposer }: AcceptanceDecisionProps) => {}}}/>- <Flexbox style={{ height: 8 }} /><FeedbackDrawerentries={feedbackEntries}open={feedbackOpen}diff --git a/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsx b/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsxindex 59bb8a06f7b..e33f36d68a7 100644--- a/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsx+++ b/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsx@@ -1,21 +1,98 @@'use client';-import { createModal, Flexbox, Text, useResponsive } from '@lobehub/ui';+import { createModal, Flexbox, useResponsive } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';import { memo } from 'react';+import { useTranslation } from 'react-i18next';import { DesktopEvidenceReview } from '../Evidence/DesktopEvidenceReview';import { MobileEvidenceReview } from '../Evidence/MobileEvidenceReview';-import { checkRejectModalShell, rejectModalTitle } from './rejectModalShell';+import { checkRejectModalShell, rejectModalHeading, rejectModalTitle } from './rejectModalShell';import type { RejectReviewInput } from './useRejectReview';import { useRejectReview } from './useRejectReview';export type { RejectableEvidence } from './rejectDraft';+const styles = stylex.create({+ heading: {+ overflow: 'hidden',+ display: 'flex',+ gap: '8px',+ alignItems: 'baseline',+ minWidth: 0,+ maxWidth: '100%',+ fontSize: '14px',+ lineHeight: '22px',+ },+ code: {+ flex: 'none',+ fontFamily: cssVar.fontFamilyCode,+ fontSize: '12px',+ fontWeight: 400,+ color: cssVar.colorTextSecondary,+ },+ action: {+ flex: 'none',+ fontWeight: 600,+ color: cssVar.colorText,+ },+ phoneSubject: {+ fontSize: '14px',+ fontWeight: 400,+ lineHeight: '22px',+ color: cssVar.colorTextSecondary,+ overflowWrap: 'anywhere',+ whiteSpace: 'normal',+ },+ subject: {+ overflow: 'hidden',+ minWidth: 0,+ fontWeight: 400,+ color: cssVar.colorTextSecondary,+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ },+});+interface CheckRejectModalProps extends RejectReviewInput {checkDescription?: string;checkTitle: string;}+const CheckRejectModalTitle = memo<Pick<CheckRejectModalProps, 'checkDescription' | 'checkTitle'>>(+ ({ checkDescription, checkTitle }) => {+ const { t } = useTranslation('verify');+ const { md = true } = useResponsive();+ const modalTitle = rejectModalTitle(checkTitle, checkDescription);++ const heading = rejectModalHeading(modalTitle.title);++ if (!md)+ return (+ <Flexbox gap={2}>+ <div {...stylex.props(styles.heading)}>+ {heading.code && <span {...stylex.props(styles.code)}>{heading.code}</span>}+ <span {...stylex.props(styles.action)}>{t('acceptance.review.reject')}</span>+ </div>+ <span {...stylex.props(styles.phoneSubject)}>{heading.title}</span>+ </Flexbox>+ );++ return (+ <div {...stylex.props(styles.heading)}>+ {heading.code && <span {...stylex.props(styles.code)}>{heading.code}</span>}+ <span {...stylex.props(styles.action)}>{t('acceptance.review.reject')}</span>+ <span {...stylex.props(styles.subject)} title={modalTitle.description ?? heading.title}>+ {heading.title}+ </span>+ </div>+ );+ },+);++CheckRejectModalTitle.displayName = 'AcceptanceCheckRejectModalTitle';+/*** The reject's state lives here; where it goes on screen does not.*@@ -46,7 +123,6 @@ CheckRejectModalContent.displayName = 'AcceptanceCheckRejectModalContent';/** Per-check reject modal — media gets a near-fullscreen annotation surface without losing context. */export const openCheckRejectModal = (options: CheckRejectModalProps) => {- const modalTitle = rejectModalTitle(options.checkTitle, options.checkDescription);const shell = checkRejectModalShell(options.evidence.length);return createModal({@@ -55,16 +131,10 @@ export const openCheckRejectModal = (options: CheckRejectModalProps) => {footer: null,maskClosable: true,title: (- <Flexbox gap={2}>- <Text strong style={{ overflowWrap: 'anywhere', whiteSpace: 'normal' }}>- {modalTitle.title}- </Text>- {modalTitle.description && (- <Text fontSize={12} type={'secondary'}>- {modalTitle.description}- </Text>- )}- </Flexbox>+ <CheckRejectModalTitle+ checkDescription={options.checkDescription}+ checkTitle={options.checkTitle}+ />),});};diff --git a/src/features/Acceptance/Viewer/Review/DecisionActions.tsx b/src/features/Acceptance/Viewer/Review/DecisionActions.tsxnew file mode 100644index 00000000000..64bb836863b--- /dev/null+++ b/src/features/Acceptance/Viewer/Review/DecisionActions.tsx@@ -0,0 +1,130 @@+import type { ButtonProps } from '@lobehub/ui';+import { Button, Flexbox, Icon } from '@lobehub/ui';+import * as stylex from '@stylexjs/stylex';+import { MessageSquarePlus } from 'lucide-react';+import { useTranslation } from 'react-i18next';++import { decisionBarStyles as styles } from './decisionBarStyles';+import type { DecisionBarState } from './DecisionMarks';++const ActionButton = (props: ButtonProps) => (+ <Button {...props} {...stylex.props(styles.actionButton)} />+);++interface DecisionActionsProps {+ allConfirmed: boolean;+ embedded?: boolean;+ hasFeedback: boolean;+ onAccept: () => void;+ onAddComment: () => void;+ onCopyReview: () => void;+ onRejectComment: () => void;+ onRerun: () => void;+ pending: boolean;+ readOnlyReason?: string;+ rejectOnlyReason?: string;+ rerunAvailable: boolean;+ rerunPending: boolean;+ state: DecisionBarState;+}++export const DecisionActions = ({+ allConfirmed,+ embedded,+ hasFeedback,+ onAccept,+ onAddComment,+ onCopyReview,+ onRejectComment,+ onRerun,+ pending,+ readOnlyReason,+ rejectOnlyReason,+ rerunAvailable,+ rerunPending,+ state,+}: DecisionActionsProps) => {+ const { t } = useTranslation('verify');++ if (readOnlyReason) {+ // Not this viewer's call: the decision they are waiting on stays in view,+ // disabled, so the bar says who decides instead of vanishing.+ if (state !== 'settled') return null;+ return (+ <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>+ <ActionButton disabled title={readOnlyReason} type={'text'}>+ {t('acceptance.bar.rejectComment')}+ </ActionButton>+ <ActionButton disabled title={readOnlyReason} type={'fill'}>+ {t('acceptance.actions.accept')}+ </ActionButton>+ </Flexbox>+ );+ }++ if (rejectOnlyReason) {+ if (state !== 'settled') return null;+ return (+ <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>+ <ActionButton disabled={pending} type={'fill'} onClick={onRejectComment}>+ {t('acceptance.bar.rejectComment')}+ </ActionButton>+ <ActionButton disabled title={rejectOnlyReason} type={'fill'}>+ {t('acceptance.actions.accept')}+ </ActionButton>+ </Flexbox>+ );+ }++ const repairHandoff = hasFeedback || state === 'rejected';++ return (+ <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>+ {/* A dispatched send-back keeps the copy entry alive: the reviewer may+ still hand the prompt to another agent. Embedded, the composer beside+ the bar already receives the draft. */}+ {state === 'live' && hasFeedback && !embedded && (+ <ActionButton disabled={pending} type={'fill'} onClick={onCopyReview}>+ {t('acceptance.bar.copyReview')}+ </ActionButton>+ )}++ {(state === 'settled' || state === 'rejected') &&+ (repairHandoff ? (+ <>+ <ActionButton+ disabled={pending}+ icon={<Icon icon={MessageSquarePlus} />}+ type={'fill'}+ onClick={onAddComment}+ >+ {t('acceptance.bar.addComment')}+ </ActionButton>+ {(!embedded || rerunAvailable) && (+ <ActionButton+ disabled={pending}+ loading={embedded && rerunPending}+ type={'primary'}+ onClick={embedded ? onRerun : onCopyReview}+ >+ {t(embedded ? 'acceptance.bar.rerun' : 'acceptance.bar.copyReview')}+ </ActionButton>+ )}+ </>+ ) : (+ <>+ <ActionButton disabled={pending} type={'text'} onClick={onRejectComment}>+ {t('acceptance.bar.rejectComment')}+ </ActionButton>+ <ActionButton+ disabled={pending}+ type={allConfirmed ? 'primary' : 'fill'}+ onClick={onAccept}+ >+ {t('acceptance.actions.accept')}+ </ActionButton>+ </>+ ))}+ </Flexbox>+ );+};diff --git a/src/features/Acceptance/Viewer/Review/DecisionBar.test.ts b/src/features/Acceptance/Viewer/Review/DecisionBar.test.tsindex 82bcae41e3f..a4b1afd862c 100644--- a/src/features/Acceptance/Viewer/Review/DecisionBar.test.ts+++ b/src/features/Acceptance/Viewer/Review/DecisionBar.test.ts@@ -177,3 +177,57 @@ it('a decider keeps live Reject and Accept without a reason line', () => {expect(screen.getByRole('button', { name: 'acceptance.actions.accept' })).toBeEnabled();expect(screen.queryByTestId('acceptance-decision-reason')).toBeNull();});++describe('the docked overview', () => {+ it('draws one strip segment per check, coloured by the reviewer decision', () => {+ render(+ createElement(DecisionBar, {+ ...props,+ acceptedCount: 2,+ feedbackCount: 0,+ needsFixCount: 1,+ segments: ['accepted', 'accepted', 'needsFix', 'pending'],+ totalCount: 4,+ }),+ );++ const strip = screen.getByRole('img', { name: 'acceptance.bar.stripLabel' });+ expect([...strip.children].map((node) => node.getAttribute('data-decision'))).toEqual([+ 'accepted',+ 'accepted',+ 'needsFix',+ 'pending',+ ]);+ });++ it('spells the tally out beside the state line while a decision is open', () => {+ render(+ createElement(DecisionBar, {+ ...props,+ acceptedCount: 2,+ feedbackCount: 0,+ needsFixCount: 1,+ segments: ['accepted', 'accepted', 'needsFix', 'pending'],+ totalCount: 4,+ }),+ );++ expect(screen.getByText('acceptance.bar.tally.accepted')).toBeVisible();+ expect(screen.getByText('acceptance.bar.tally.needsFix')).toBeVisible();+ expect(screen.getByText('acceptance.bar.tally.pending')).toBeVisible();+ expect(screen.queryByText('acceptance.bar.tally.ignored')).toBeNull();+ });++ it('drops the tally once the delivery is decided', () => {+ render(+ createElement(DecisionBar, {+ ...props,+ feedbackCount: 0,+ segments: ['accepted'],+ state: 'accepted',+ }),+ );++ expect(screen.queryByText('acceptance.bar.tally.accepted')).toBeNull();+ });+});diff --git a/src/features/Acceptance/Viewer/Review/DecisionBar.tsx b/src/features/Acceptance/Viewer/Review/DecisionBar.tsxindex e9b736104fc..3c26c429187 100644--- a/src/features/Acceptance/Viewer/Review/DecisionBar.tsx+++ b/src/features/Acceptance/Viewer/Review/DecisionBar.tsx@@ -1,212 +1,18 @@'use client';-import type { ButtonProps } from '@lobehub/ui';import { Button, Flexbox, Icon, Text } from '@lobehub/ui';-import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';-import {- BadgeCheck,- CircleAlert,- ListTodo,- Loader2,- Lock,- MessageSquarePlus,- RotateCcw,- UsersRound,- Wrench,-} from 'lucide-react';-import { memo, useEffect, useRef } from 'react';+import { ListTodo, Lock, UsersRound } from 'lucide-react';+import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { sx } from '@/styles/sx';--import { acceptanceContentLayout } from '../layout';--const orbit = stylex.keyframes({- to: { transform: 'rotate(360deg)' },-});--const completePop = stylex.keyframes({- '0%': { opacity: 0, transform: 'scale(0.5)' },- '55%': { transform: 'scale(1)' },- '100%': { opacity: 1, transform: 'scale(1)' },-});--const reducedMotion = '@media (prefers-reduced-motion: reduce)';-const phone = '@media (width <= 767px)';-const narrow = '@media (width <= 480px)';--// The page's text measure, from the shared layout constants StyleX cannot read.-const barMaxWidth = acceptanceContentLayout.maxWidth - 2 * acceptanceContentLayout.paddingInline;--const styles = stylex.create({- repairingArc: {- transformOrigin: 'center',- animationName: { default: orbit, [reducedMotion]: 'none' },- animationDuration: { default: '1.2s', [reducedMotion]: '0s' },- animationTimingFunction: { default: 'linear', [reducedMotion]: 'ease' },- animationIterationCount: { default: 'infinite', [reducedMotion]: 1 },- },- // Floats over the scrolling checklist — the decision stays reachable- // however deep the review goes.- bar: {- position: 'sticky',- zIndex: 20,- insetBlockEnd: { default: '16px', [phone]: 'max(8px, env(safe-area-inset-bottom))' },- display: 'flex',- flexWrap: 'wrap',- gap: '12px',- alignItems: 'center',- width: '100%',- marginInline: 'auto',- paddingBlock: '12px',- paddingInline: { default: '16px', [phone]: '12px' },- borderWidth: '1px',- borderStyle: 'solid',- borderColor: cssVar.colorBorderSecondary,- borderRadius: cssVar.borderRadiusLG,- backgroundColor: cssVar.colorBgElevated,- backgroundImage: 'none',- boxShadow: cssVar.boxShadowTertiary,- },- summary: {- flex: '1',- minWidth: '160px',- },- actions: {- flex: 'none',- flexWrap: 'wrap',- justifyContent: 'flex-end',- width: { default: null, [narrow]: '100%' },- },- // The bar's own buttons (the old `.actions > button`).- actionButton: {- flex: { default: 'none', [narrow]: '1' },- },- // The completion mark springs in the instant review finishes — the felt beat- // the abrupt ring→disc swap never had, landing at the decision bar where the- // user's next action (accept / send back) already is, not behind a filter.- completePop: {- animationName: { default: completePop, [reducedMotion]: 'none' },- animationDuration: { default: '0.2s', [reducedMotion]: '0s' },- animationTimingFunction: { default: 'ease-out', [reducedMotion]: 'ease' },- animationFillMode: { default: 'both', [reducedMotion]: 'none' },- },-});--const ActionButton = (props: ButtonProps) => (- <Button {...props} {...stylex.props(styles.actionButton)} />-);--type BarState = 'accepted' | 'live' | 'rejected' | 'settled';--/**- * The review-progress dial: how many checks the user has signed off, of all.- * At zero it reads as a dashed "not started" circle; the completed state is- * rendered by the bar as the BadgeCheck disc, not here.- */-/**- * A repair round in flight: a steady wrench — what is happening — inside a- * travelling arc — that it is still happening. Same ring geometry as the review- * dial, so the bar's marks read as one family instead of a spinning reload glyph.- */-const RepairingMark = memo(() => {- const size = 20;- const stroke = 2;- const radius = (size - stroke) / 2;- const circumference = 2 * Math.PI * radius;-- return (- <div style={{ flex: 'none', height: size, position: 'relative', width: size }}>- <svg height={size} width={size}>- <circle- cx={size / 2}- cy={size / 2}- fill={'none'}- r={radius}- stroke={cssVar.colorWarningBg}- strokeWidth={stroke}- />- <circle- {...stylex.props(styles.repairingArc)}- cx={size / 2}- cy={size / 2}- fill={'none'}- r={radius}- stroke={cssVar.colorWarning}- strokeDasharray={`${circumference * 0.3} ${circumference}`}- strokeLinecap={'round'}- strokeWidth={stroke}- />- </svg>- <Flexbox align={'center'} justify={'center'} style={{ inset: 0, position: 'absolute' }}>- <Icon color={cssVar.colorWarning} icon={Wrench} size={10} />- </Flexbox>- </div>- );-});--RepairingMark.displayName = 'AcceptanceRepairingMark';--const ProgressRing = memo<{ done: number; total: number }>(({ done, total }) => {- const size = 20;- const stroke = 2;- const radius = (size - stroke) / 2;- const circumference = 2 * Math.PI * radius;- const ratio = total > 0 ? Math.min(done / total, 1) : 0;-- if (done <= 0)- return (- <svg height={size} style={{ flex: 'none' }} width={size}>- <circle- cx={size / 2}- cy={size / 2}- fill={'none'}- r={radius}- stroke={cssVar.colorTextQuaternary}- strokeDasharray={'3 5'}- strokeLinecap={'round'}- strokeWidth={stroke}- />- </svg>- );-- return (- <div style={{ flex: 'none', height: size, position: 'relative', width: size }}>- <svg height={size} width={size}>- <circle- cx={size / 2}- cy={size / 2}- fill={'none'}- r={radius}- stroke={cssVar.colorFillSecondary}- strokeWidth={stroke}- />- <circle- cx={size / 2}- cy={size / 2}- fill={'none'}- r={radius}- stroke={cssVar.colorPrimary}- strokeDasharray={`${circumference * ratio} ${circumference}`}- strokeLinecap={'round'}- strokeWidth={stroke}- style={{ transition: 'stroke-dasharray 0.3s ease' }}- transform={`rotate(-90 ${size / 2} ${size / 2})`}- />- </svg>- <Flexbox- align={'center'}- justify={'center'}- style={{ fontSize: 10, fontVariantNumeric: 'tabular-nums', inset: 0, position: 'absolute' }}- >- <span style={{ color: cssVar.colorTextSecondary, fontWeight: 600 }}>{done}</span>- </Flexbox>- </div>- );-});--ProgressRing.displayName = 'AcceptanceProgressRing';+import type { DecisionSegment } from '../Checks/checkDecision';+import { DecisionActions } from './DecisionActions';+import { decisionBarStyles as styles } from './decisionBarStyles';+import type { DecisionBarState } from './DecisionMarks';+import { DecisionStatusMark } from './DecisionMarks';+import DecisionStrip from './DecisionStrip';+import { DecisionTally } from './DecisionTally';interface DecisionBarProps {/** Checks the user has signed off, of `totalCount` reviewable ones. */@@ -244,7 +50,8 @@ interface DecisionBarProps {/** The origin conversation is known — the rerun dispatch has a target. */rerunAvailable: boolean;rerunPending: boolean;- state: BarState;+ segments?: DecisionSegment[];+ state: DecisionBarState;/** The state line, prepared by the page (status + counts wording). */statusText: string;subText?: string;@@ -279,6 +86,7 @@ const DecisionBar = memo<DecisionBarProps>(repairing,rerunAvailable,rerunPending,+ segments,state,statusText,subText,@@ -286,15 +94,6 @@ const DecisionBar = memo<DecisionBarProps>(}) => {const { t } = useTranslation('verify');- const stateMeta = {- accepted: { color: cssVar.colorSuccess, icon: BadgeCheck },- // A repair round renders its own RepairingMark below; a plain verify- // stays a neutral info spinner.- live: { color: cssVar.colorInfo, icon: Loader2 },- rejected: { color: cssVar.colorError, icon: RotateCcw },- settled: null,- }[state];-const allConfirmed = totalCount > 0 && acceptedCount + ignoredCount >= totalCount;const hasFeedback = feedbackCount > 0;// The dial tracks DECIDED checks (accepted + 待修复), so a fully-reviewed@@ -308,52 +107,53 @@ const DecisionBar = memo<DecisionBarProps>(// Pop the completion mark only on the real IN-SESSION transition into a// finished review — never on mount-when-already-done (revisiting a settled- // acceptance) and never on an unrelated re-render. Seed the ref to `null`- // so the first render (whatever its state) is treated as the baseline, not- // a transition: `prev === false && now` is the one edge that fires.+ // acceptance) and never on an unrelated re-render. The first render seeds+ // the baseline, so only a later change of `reviewComplete` can fire.const reviewComplete = allConfirmed || settledNeedsFix;- const prevComplete = useRef<boolean | null>(null);- const justCompleted = prevComplete.current === false && reviewComplete;- useEffect(() => {- prevComplete.current = reviewComplete;- }, [reviewComplete]);+ const [seenComplete, setSeenComplete] = useState(reviewComplete);+ const [justCompleted, setJustCompleted] = useState(false);+ if (seenComplete !== reviewComplete) {+ setSeenComplete(reviewComplete);+ setJustCompleted(reviewComplete);+ }return (- <div {...sx(styles.bar, { maxWidth: barMaxWidth })}>- <Flexbox horizontal align={'center'} gap={8} {...stylex.props(styles.summary)}>- {state === 'live' && repairing ? (- <RepairingMark />- ) : stateMeta ? (- // accepted / live / rejected — a plain coloured status mark.- <Icon- color={stateMeta.color}- icon={stateMeta.icon}- size={22}- spin={state === 'live'}- style={{ flex: 'none' }}- />- ) : allConfirmed ? (- // Every check signed off — the same clean badge the accepted state carries.- <Icon- color={cssVar.colorSuccess}- icon={BadgeCheck}- size={22}- {...sx(justCompleted && styles.completePop, { flex: 'none' })}- />- ) : settledNeedsFix ? (- <Icon- color={cssVar.colorWarning}- icon={CircleAlert}- size={22}- {...sx(justCompleted && styles.completePop, { flex: 'none' })}+ <div {...stylex.props(styles.bar)}>+ {segments && segments.length > 0 && (+ <DecisionStrip+ segmentXstyle={styles.stripSegment}+ segments={segments}+ xstyle={styles.strip}+ label={t('acceptance.bar.stripLabel', {+ accepted: acceptedCount,+ total: segments.length,+ })}+ />+ )}+ <Flexbox horizontal align={'flex-start'} gap={10} {...stylex.props(styles.summary)}>+ <span {...stylex.props(styles.mark)}>+ <DecisionStatusMark+ allConfirmed={allConfirmed}+ decidedCount={decidedCount}+ justCompleted={justCompleted}+ repairing={repairing}+ settledNeedsFix={settledNeedsFix}+ state={state}+ totalCount={totalCount}/>- ) : (- <ProgressRing done={decidedCount} total={totalCount} />- )}- <Flexbox gap={2} style={{ flex: '0 1 auto', minWidth: 0 }}>- <Text ellipsis type={'secondary'}>+ </span>+ <Flexbox gap={0} style={{ flex: '0 1 auto', minWidth: 0 }}>+ <Text ellipsis {...stylex.props(styles.statusText)}>{statusText}</Text>+ {state === 'settled' && totalCount > 0 && (+ <DecisionTally+ acceptedCount={acceptedCount}+ ignoredCount={ignoredCount}+ needsFixCount={needsFixCount}+ pendingCount={Math.max(totalCount - decidedCount, 0)}+ />+ )}{subText && (<Text ellipsis fontSize={12} type={'secondary'}>{subText}@@ -393,88 +193,22 @@ const DecisionBar = memo<DecisionBarProps>(</Button>)}</Flexbox>- {readOnlyReason ? (- // Not this viewer's call: the decision they are waiting on stays in- // view, disabled, so the bar says who decides instead of vanishing.- state === 'settled' && (- <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>- <ActionButton disabled title={readOnlyReason} type={'text'}>- {t('acceptance.bar.rejectComment')}- </ActionButton>- <ActionButton disabled title={readOnlyReason} type={'fill'}>- {t('acceptance.actions.accept')}- </ActionButton>- </Flexbox>- )- ) : rejectOnlyReason ? (- // Granted reject access only: sending back is theirs, accepting is not.- state === 'settled' && (- <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>- <ActionButton disabled={pending} type={'fill'} onClick={onRejectComment}>- {t('acceptance.bar.rejectComment')}- </ActionButton>- <ActionButton disabled title={rejectOnlyReason} type={'fill'}>- {t('acceptance.actions.accept')}- </ActionButton>- </Flexbox>- )- ) : (- <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>- {/* A dispatched send-back (repairing) keeps the copy entry alive —- the reviewer may still hand the prompt to another agent. Embedded,- the composer beside it already receives the draft. */}- {state === 'live' && hasFeedback && !embedded && (- <ActionButton disabled={pending} type={'fill'} onClick={onCopyReview}>- {t('acceptance.bar.copyReview')}- </ActionButton>- )}-- {(state === 'settled' || state === 'rejected') &&- (hasFeedback || state === 'rejected' ? (- // Feedback is queued — the delivery isn't being accepted now; the- // bar's job is getting the repair round started.- <>- {/* Last words before the repair leaves — a global note the next- round reads, for what the queued per-check feedback missed. */}- <ActionButton- disabled={pending}- icon={<Icon icon={MessageSquarePlus} />}- type={'fill'}- onClick={onAddComment}- >- {t('acceptance.bar.addComment')}- </ActionButton>- {/* One commit action per host: standalone copies the repair- prompt; embedded drafts it into the composer beside the bar. */}- {(!embedded || rerunAvailable) && (- <ActionButton- disabled={pending}- loading={embedded && rerunPending}- type={'primary'}- onClick={embedded ? onRerun : onCopyReview}- >- {t(embedded ? 'acceptance.bar.rerun' : 'acceptance.bar.copyReview')}- </ActionButton>- )}- </>- ) : (- // Clean review — accept carries primary weight only once every- // check is signed off; before that it stays a quiet option.- <>- <ActionButton disabled={pending} type={'text'} onClick={onRejectComment}>- {t('acceptance.bar.rejectComment')}- </ActionButton>- <ActionButton- disabled={pending}- type={allConfirmed ? 'primary' : 'fill'}- onClick={onAccept}- >- {t('acceptance.actions.accept')}- </ActionButton>- </>- ))}- </Flexbox>- )}+ <DecisionActions+ allConfirmed={allConfirmed}+ embedded={embedded}+ hasFeedback={hasFeedback}+ pending={pending}+ readOnlyReason={readOnlyReason}+ rejectOnlyReason={rejectOnlyReason}+ rerunAvailable={rerunAvailable}+ rerunPending={rerunPending}+ state={state}+ onAccept={onAccept}+ onAddComment={onAddComment}+ onCopyReview={onCopyReview}+ onRejectComment={onRejectComment}+ onRerun={onRerun}+ /></div>);},diff --git a/src/features/Acceptance/Viewer/Review/DecisionMarks.tsx b/src/features/Acceptance/Viewer/Review/DecisionMarks.tsxnew file mode 100644index 00000000000..793fb56f5dc--- /dev/null+++ b/src/features/Acceptance/Viewer/Review/DecisionMarks.tsx@@ -0,0 +1,172 @@+import { Flexbox, Icon } from '@lobehub/ui';+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';+import { BadgeCheck, CircleAlert, Loader2, RotateCcw, Wrench } from 'lucide-react';+import { memo } from 'react';++import { sx } from '@/styles/sx';++import { decisionBarStyles as styles } from './decisionBarStyles';++export type DecisionBarState = 'accepted' | 'live' | 'rejected' | 'settled';++const RepairingMark = memo(() => {+ const size = 20;+ const stroke = 2;+ const radius = (size - stroke) / 2;+ const circumference = 2 * Math.PI * radius;++ return (+ <div style={{ flex: 'none', height: size, position: 'relative', width: size }}>+ <svg height={size} width={size}>+ <circle+ cx={size / 2}+ cy={size / 2}+ fill={'none'}+ r={radius}+ stroke={cssVar.colorWarningBg}+ strokeWidth={stroke}+ />+ <circle+ {...stylex.props(styles.repairingArc)}+ cx={size / 2}+ cy={size / 2}+ fill={'none'}+ r={radius}+ stroke={cssVar.colorWarning}+ strokeDasharray={`${circumference * 0.3} ${circumference}`}+ strokeLinecap={'round'}+ strokeWidth={stroke}+ />+ </svg>+ <Flexbox align={'center'} justify={'center'} style={{ inset: 0, position: 'absolute' }}>+ <Icon color={cssVar.colorWarning} icon={Wrench} size={12} />+ </Flexbox>+ </div>+ );+});++RepairingMark.displayName = 'AcceptanceRepairingMark';++const ProgressRing = memo<{ done: number; total: number }>(({ done, total }) => {+ const size = 20;+ const stroke = 2;+ const radius = (size - stroke) / 2;+ const circumference = 2 * Math.PI * radius;+ const ratio = total > 0 ? Math.min(done / total, 1) : 0;++ if (done <= 0)+ return (+ <svg height={size} style={{ flex: 'none' }} width={size}>+ <circle+ cx={size / 2}+ cy={size / 2}+ fill={'none'}+ r={radius}+ stroke={cssVar.colorTextQuaternary}+ strokeDasharray={'3 5'}+ strokeLinecap={'round'}+ strokeWidth={stroke}+ />+ </svg>+ );++ return (+ <div style={{ flex: 'none', height: size, position: 'relative', width: size }}>+ <svg height={size} width={size}>+ <circle+ cx={size / 2}+ cy={size / 2}+ fill={'none'}+ r={radius}+ stroke={cssVar.colorFillSecondary}+ strokeWidth={stroke}+ />+ <circle+ cx={size / 2}+ cy={size / 2}+ fill={'none'}+ r={radius}+ stroke={cssVar.colorPrimary}+ strokeDasharray={`${circumference * ratio} ${circumference}`}+ strokeLinecap={'round'}+ strokeWidth={stroke}+ style={{ transition: 'stroke-dasharray 0.3s ease' }}+ transform={`rotate(-90 ${size / 2} ${size / 2})`}+ />+ </svg>+ <Flexbox+ align={'center'}+ justify={'center'}+ style={{ fontSize: 10, fontVariantNumeric: 'tabular-nums', inset: 0, position: 'absolute' }}+ >+ <span style={{ color: cssVar.colorTextSecondary, fontWeight: 600 }}>{done}</span>+ </Flexbox>+ </div>+ );+});++ProgressRing.displayName = 'AcceptanceProgressRing';++const STATE_MARK = {+ accepted: { color: cssVar.colorSuccess, icon: BadgeCheck },+ live: { color: cssVar.colorInfo, icon: Loader2 },+ rejected: { color: cssVar.colorError, icon: RotateCcw },+ settled: null,+} as const;++interface DecisionStatusMarkProps {+ allConfirmed: boolean;+ decidedCount: number;+ justCompleted: boolean;+ repairing?: boolean;+ settledNeedsFix: boolean;+ state: DecisionBarState;+ totalCount: number;+}++export const DecisionStatusMark = ({+ allConfirmed,+ decidedCount,+ justCompleted,+ repairing,+ settledNeedsFix,+ state,+ totalCount,+}: DecisionStatusMarkProps) => {+ if (state === 'live' && repairing) return <RepairingMark />;++ const stateMark = STATE_MARK[state];+ if (stateMark)+ return (+ <Icon+ color={stateMark.color}+ icon={stateMark.icon}+ size={22}+ spin={state === 'live'}+ style={{ flex: 'none' }}+ />+ );++ if (allConfirmed)+ return (+ <Icon+ color={cssVar.colorSuccess}+ icon={BadgeCheck}+ size={22}+ {...sx(justCompleted && styles.completePop, { flex: 'none' })}+ />+ );++ if (settledNeedsFix)+ return (+ <Icon+ color={cssVar.colorWarning}+ icon={CircleAlert}+ size={22}+ {...sx(justCompleted && styles.completePop, { flex: 'none' })}+ />+ );++ return <ProgressRing done={decidedCount} total={totalCount} />;+};diff --git a/src/features/Acceptance/Viewer/Review/DecisionStrip.tsx b/src/features/Acceptance/Viewer/Review/DecisionStrip.tsxnew file mode 100644index 00000000000..f9a572fd35e--- /dev/null+++ b/src/features/Acceptance/Viewer/Review/DecisionStrip.tsx@@ -0,0 +1,46 @@+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import type { StyleXStyles } from '@stylexjs/stylex';+import * as stylex from '@stylexjs/stylex';+import { memo } from 'react';++import type { DecisionSegment } from '../Checks/checkDecision';++const styles = stylex.create({+ strip: {+ display: 'flex',+ gap: '2px',+ height: '4px',+ },+ segment: {+ flex: '1',+ borderRadius: '2px',+ backgroundColor: cssVar.colorFillSecondary,+ },+ accepted: { backgroundColor: cssVar.colorSuccess },+ needsFix: { backgroundColor: cssVar.colorError },+ ignored: { backgroundColor: cssVar.colorTextQuaternary },+ pending: {},+});++interface DecisionStripProps {+ label: string;+ segments: DecisionSegment[];+ segmentXstyle?: StyleXStyles;+ xstyle?: StyleXStyles;+}++const DecisionStrip = memo<DecisionStripProps>(({ label, segmentXstyle, segments, xstyle }) => (+ <div aria-label={label} role={'img'} {...stylex.props(styles.strip, xstyle)}>+ {segments.map((segment, index) => (+ <i+ data-decision={segment}+ key={index}+ {...stylex.props(styles.segment, styles[segment], segmentXstyle)}+ />+ ))}+ </div>+));++DecisionStrip.displayName = 'AcceptanceDecisionStrip';++export default DecisionStrip;diff --git a/src/features/Acceptance/Viewer/Review/DecisionTally.tsx b/src/features/Acceptance/Viewer/Review/DecisionTally.tsxnew file mode 100644index 00000000000..c0b110380fa--- /dev/null+++ b/src/features/Acceptance/Viewer/Review/DecisionTally.tsx@@ -0,0 +1,43 @@+import * as stylex from '@stylexjs/stylex';+import { useTranslation } from 'react-i18next';++import { decisionBarStyles as styles } from './decisionBarStyles';++interface DecisionTallyProps {+ acceptedCount: number;+ ignoredCount: number;+ needsFixCount: number;+ pendingCount: number;+}++export const DecisionTally = ({+ acceptedCount,+ ignoredCount,+ needsFixCount,+ pendingCount,+}: DecisionTallyProps) => {+ const { t } = useTranslation('verify');++ return (+ <div {...stylex.props(styles.tallyRow)}>+ <span {...stylex.props(styles.tally)}>+ <i {...stylex.props(styles.dot, styles.dotAccepted)} />+ {t('acceptance.bar.tally.accepted', { count: acceptedCount })}+ </span>+ <span {...stylex.props(styles.tally)}>+ <i {...stylex.props(styles.dot, styles.dotNeedsFix)} />+ {t('acceptance.bar.tally.needsFix', { count: needsFixCount })}+ </span>+ {ignoredCount > 0 && (+ <span {...stylex.props(styles.tally)}>+ <i {...stylex.props(styles.dot, styles.dotIgnored)} />+ {t('acceptance.bar.tally.ignored', { count: ignoredCount })}+ </span>+ )}+ <span {...stylex.props(styles.tally)}>+ <i {...stylex.props(styles.dot)} />+ {t('acceptance.bar.tally.pending', { count: pendingCount })}+ </span>+ </div>+ );+};diff --git a/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx b/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsxindex 7fcf1069376..e4a911821ce 100644--- a/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx+++ b/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx@@ -16,7 +16,7 @@ const styles = stylex.create({backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },backgroundImage: { 'default': null, ':hover': 'none' },},- meta: { flex: 'none', fontSize: '11px', color: cssVar.colorTextQuaternary, whiteSpace: 'nowrap' },+ meta: { flex: 'none', fontSize: '12px', color: cssVar.colorTextQuaternary, whiteSpace: 'nowrap' },row: {paddingBlock: '20px',paddingInline: '8px',@@ -34,7 +34,7 @@ const styles = stylex.create({seq: {flex: 'none',fontFamily: cssVar.fontFamilyCode,- fontSize: '11px',+ fontSize: '12px',color: cssVar.colorTextSecondary,},});@@ -105,12 +105,12 @@ const EntryRow = memo<{{isCheck ? (<><span {...stylex.props(styles.seq)}>C{entry.checkSeq}</span>- <Text ellipsis style={{ fontSize: 13, minWidth: 0 }}>+ <Text ellipsis style={{ fontSize: 14, minWidth: 0 }}>{entry.title}</Text></>) : (- <Text ellipsis style={{ fontSize: 13, minWidth: 0 }}>+ <Text ellipsis style={{ fontSize: 14, minWidth: 0 }}>{entry.groupLabel? t('acceptance.feedback.group', { label: entry.groupLabel }): t('acceptance.feedback.global')}diff --git a/src/features/Acceptance/Viewer/Review/ProposalCard.tsx b/src/features/Acceptance/Viewer/Review/ProposalCard.tsxindex 33d3c5583a5..9c90f515413 100644--- a/src/features/Acceptance/Viewer/Review/ProposalCard.tsx+++ b/src/features/Acceptance/Viewer/Review/ProposalCard.tsx@@ -11,8 +11,8 @@ import type { CheckProposal } from './proposal';const styles = stylex.create({card: {- paddingBlock: '8px',- paddingInline: '10px',+ paddingBlock: '12px',+ paddingInline: '12px',borderWidth: '1px',borderStyle: 'dashed',borderColor: cssVar.colorBorder,@@ -27,15 +27,21 @@ const styles = stylex.create({textOverflow: 'ellipsis',whiteSpace: 'nowrap',},- muted: { fontSize: '11px', color: cssVar.colorTextQuaternary },+ muted: { fontSize: '12px', color: cssVar.colorTextTertiary },+ actions: {+ display: 'flex',+ flexDirection: 'column',+ gap: '8px',+ paddingBlockStart: '4px',+ },regionIndex: {flex: 'none',- width: '16px',- height: '16px',+ width: '20px',+ height: '20px',borderRadius: '50%',- fontSize: '10px',+ fontSize: '12px',fontWeight: 600,- lineHeight: '16px',+ lineHeight: '20px',color: '#fff',textAlign: 'center',backgroundColor: cssVar.colorError,@@ -94,8 +100,8 @@ const ProposalCard = memo<ProposalCardProps>(gap={6}onClick={() => onToggle(!open)}>- <Icon icon={open ? ChevronDown : ChevronRight} size={12} />- <Icon icon={Sparkles} size={12} />+ <Icon icon={open ? ChevronDown : ChevronRight} size={14} />+ <Icon icon={Sparkles} size={14} /><Text fontSize={12} style={{ flex: 'none' }} type={'secondary'}>{t('acceptance.proposal.title')}</Text>@@ -119,25 +125,21 @@ const ProposalCard = memo<ProposalCardProps>({open && (<>- {proposal.comment && <Text fontSize={12}>{proposal.comment}</Text>}+ {proposal.comment && <Text fontSize={14}>{proposal.comment}</Text>}{/* Numbers match the badges now drawn on the evidence image below. */}{regions.map((region, index) => (- <Flexbox horizontal align={'flex-start'} gap={6} key={index}>- <span- className={stylex.props(styles.regionIndex).className}- style={{ marginBlockStart: 2 }}- >- {index + 1}- </span>- <Text fontSize={12} type={'secondary'}>+ <Flexbox horizontal align={'flex-start'} gap={8} key={index}>+ <span className={stylex.props(styles.regionIndex).className}>{index + 1}</span>+ <Text fontSize={14} type={'secondary'}>{region.comment || t('acceptance.proposal.regionUnnamed')}</Text></Flexbox>))}- <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>+ <div {...stylex.props(styles.actions)}><Button+ blockdisabled={pending || Boolean(busy)}size={'small'}type={'primary'}@@ -146,6 +148,7 @@ const ProposalCard = memo<ProposalCardProps>({t('acceptance.proposal.confirm')}</Button><Button+ blockdisabled={pending || Boolean(busy)}loading={busy === 'not-an-issue'}size={'small'}@@ -154,6 +157,7 @@ const ProposalCard = memo<ProposalCardProps>({t('acceptance.proposal.notAnIssue')}</Button><Button+ blockdisabled={pending || Boolean(busy)}loading={busy === 'misidentified'}size={'small'}@@ -162,7 +166,7 @@ const ProposalCard = memo<ProposalCardProps>(>{t('acceptance.proposal.misidentified')}</Button>- </Flexbox>+ </div></>)}</Flexbox>diff --git a/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx b/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsxindex 3e612034dd0..eda2c620a8b 100644--- a/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx+++ b/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx@@ -111,7 +111,7 @@ const FeedbackRow = memo<{ item: RejectFeedbackItem }>(({ item }) => {{authorLabel}</Text>{metaBits.length > 0 && (- <Text ellipsis fontSize={11} type={'secondary'}>+ <Text ellipsis fontSize={12} type={'secondary'}>{metaBits.join(' · ')}</Text>)}@@ -133,9 +133,7 @@ const Notice = memo<{ icon: typeof MessagesSquare; spin?: boolean; text: string({ icon, spin, text }) => (<Flexbox horizontal align={'center'} gap={8} {...stylex.props(styles.box, styles.summary)}><Icon color={cssVar.colorTextTertiary} icon={icon} size={16} spin={spin} />- <Text fontSize={13} type={'secondary'}>- {text}- </Text>+ <Text type={'secondary'}>{text}</Text></Flexbox>),);@@ -218,7 +216,7 @@ const RejectFeedbackPreview = memo<{ acceptanceId: string }>(({ acceptanceId })}}><Icon icon={MessagesSquare} size={16} />- <Text strong fontSize={13} style={{ flex: 1, minWidth: 0 }}>+ <Text strong style={{ flex: 1, minWidth: 0 }}>{[t('acceptance.reject.included', { count: feedback.length }), ...breakdown].join(' · ')}</Text><Flexbox horizontal {...stylex.props(styles.avatarStack)}>diff --git a/src/features/Acceptance/Viewer/Review/decisionBarStyles.ts b/src/features/Acceptance/Viewer/Review/decisionBarStyles.tsnew file mode 100644index 00000000000..e7ca8006025--- /dev/null+++ b/src/features/Acceptance/Viewer/Review/decisionBarStyles.ts@@ -0,0 +1,113 @@+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';+import * as stylex from '@stylexjs/stylex';++const orbit = stylex.keyframes({+ to: { transform: 'rotate(360deg)' },+});++const completePop = stylex.keyframes({+ '0%': { opacity: 0, transform: 'scale(0.5)' },+ '55%': { transform: 'scale(1)' },+ '100%': { opacity: 1, transform: 'scale(1)' },+});++const reducedMotion = '@media (prefers-reduced-motion: reduce)';+const phone = '@media (width <= 767px)';+const narrow = '@media (width <= 480px)';++export const decisionBarStyles = stylex.create({+ repairingArc: {+ transformOrigin: 'center',+ animationName: { default: orbit, [reducedMotion]: 'none' },+ animationDuration: { default: '1.2s', [reducedMotion]: '0s' },+ animationTimingFunction: { default: 'linear', [reducedMotion]: 'ease' },+ animationIterationCount: { default: 'infinite', [reducedMotion]: 1 },+ },+ // Docked to the column's bottom edge rather than floating over it: the+ // negative block-end margin cancels the column's own bottom padding so the+ // bar does not lift when the list scrolls to its end.+ bar: {+ position: 'sticky',+ zIndex: 20,+ insetBlockEnd: 0,+ display: 'flex',+ flexWrap: 'wrap',+ columnGap: '16px',+ rowGap: '12px',+ alignItems: 'center',+ width: '100%',+ marginBlockEnd: '-20px',+ paddingBlockStart: '16px',+ paddingBlockEnd: { default: '16px', [phone]: 'max(16px, env(safe-area-inset-bottom))' },+ paddingInline: { default: '16px', [phone]: 0 },+ borderBlockStartWidth: '1px',+ borderBlockStartStyle: 'solid',+ borderBlockStartColor: cssVar.colorBorderSecondary,+ backgroundColor: cssVar.colorBgContainer,+ },+ strip: {+ position: 'absolute',+ insetInline: 0,+ insetBlockStart: '-2px',+ gap: 0,+ height: '2px',+ },+ stripSegment: {+ borderRadius: 0,+ },+ // On a phone the strip above already carries the split; three more lines+ // of counts would push the two buttons off the first screen.+ tallyRow: {+ display: { default: 'flex', [phone]: 'none' },+ flexWrap: 'wrap',+ columnGap: '12px',+ },+ tally: {+ display: 'inline-flex',+ gap: '6px',+ alignItems: 'center',+ fontSize: '12px',+ lineHeight: '20px',+ color: cssVar.colorTextSecondary,+ },+ dot: {+ width: '8px',+ height: '8px',+ borderRadius: '2px',+ backgroundColor: cssVar.colorFillSecondary,+ },+ dotAccepted: { backgroundColor: cssVar.colorSuccess },+ dotNeedsFix: { backgroundColor: cssVar.colorError },+ dotIgnored: { backgroundColor: cssVar.colorTextQuaternary },+ mark: {+ display: 'flex',+ flex: 'none',+ alignItems: 'center',+ height: '22px',+ },+ statusText: {+ fontSize: '14px',+ fontWeight: 500,+ lineHeight: '22px',+ color: cssVar.colorText,+ },+ summary: {+ flex: '1',+ minWidth: '160px',+ },+ actions: {+ flex: 'none',+ flexWrap: 'wrap',+ justifyContent: 'flex-end',+ width: { default: null, [narrow]: '100%' },+ },+ actionButton: {+ flex: { default: 'none', [narrow]: '1' },+ },+ completePop: {+ animationName: { default: completePop, [reducedMotion]: 'none' },+ animationDuration: { default: '0.2s', [reducedMotion]: '0s' },+ animationTimingFunction: { default: 'ease-out', [reducedMotion]: 'ease' },+ animationFillMode: { default: 'both', [reducedMotion]: 'none' },+ },+});diff --git a/src/features/Acceptance/Viewer/Review/decisionView.ts b/src/features/Acceptance/Viewer/Review/decisionView.tsindex a4999eb1d67..b3cbbc7a22a 100644--- a/src/features/Acceptance/Viewer/Review/decisionView.ts+++ b/src/features/Acceptance/Viewer/Review/decisionView.ts@@ -64,13 +64,13 @@ export const resolveDecisionView = (settled:decidedCount === 0? {- statusText: t('acceptance.bar.progressZero', { total: reviewTotal }),+ statusText: t('acceptance.bar.progressZero', { count: reviewTotal }),subText: undefined,}: pendingCount === 0? needsFixCount === 0? {- statusText: t('acceptance.bar.progressDone', { total: reviewTotal }),+ statusText: t('acceptance.bar.progressDone', { count: reviewTotal }),subText: undefined,}: {diff --git a/src/features/Acceptance/Viewer/Review/modals.tsx b/src/features/Acceptance/Viewer/Review/modals.tsxindex 85681d9dff1..7a8a6e197fc 100644--- a/src/features/Acceptance/Viewer/Review/modals.tsx+++ b/src/features/Acceptance/Viewer/Review/modals.tsx@@ -24,8 +24,8 @@ import RejectFeedbackPreview from './RejectFeedbackPreview';const styles = stylex.create({warning: {- paddingBlock: '10px',- paddingInline: '14px',+ paddingBlock: '12px',+ paddingInline: '16px',borderRadius: cssVar.borderRadiusLG,backgroundColor: cssVar.colorWarningBg,backgroundImage: 'none',@@ -68,7 +68,7 @@ const AcceptContent = memo<AcceptContentProps>(({ exceptions, onConfirm, subject<Text>{translate('acceptance.accept.summary', { title: subjectTitle })}</Text>{exceptions.length > 0 && (<Flexbox className={stylex.props(styles.warning).className} gap={4}>- <Text strong fontSize={13}>+ <Text strong>{translate('acceptance.accept.exceptionsTitle', { count: exceptions.length })}</Text>{exceptions.map((title) => (@@ -138,7 +138,7 @@ const RejectContent = memo<RejectContentProps>(({ acceptanceId, dispatchAvailabl{/* What the repair prompt carries besides the reason leads the dialog —otherwise nobody can tell whether teammates' notes go along. */}<RejectFeedbackPreview acceptanceId={acceptanceId} />- <Text fontSize={13} type={'secondary'}>+ <Text type={'secondary'}>{translate(dispatchAvailable ? 'acceptance.reject.description' : 'acceptance.reject.descriptionCopy',)}@@ -208,7 +208,7 @@ const GroupFeedbackContent = memo<GroupFeedbackContentProps>(return (<Flexbox gap={16}>- <Text fontSize={13} type={'secondary'}>+ <Text type={'secondary'}>{description ?? translate('acceptance.group.feedbackDescription', { label: groupLabel })}</Text><Flexbox gap={8}>diff --git a/src/features/Acceptance/Viewer/Review/rejectModalHeading.test.ts b/src/features/Acceptance/Viewer/Review/rejectModalHeading.test.tsnew file mode 100644index 00000000000..a2aca56ae7c--- /dev/null+++ b/src/features/Acceptance/Viewer/Review/rejectModalHeading.test.ts@@ -0,0 +1,26 @@+import { describe, expect, it } from 'vitest';++import { rejectModalHeading } from './rejectModalShell';++describe('rejectModalHeading', () => {+ it('splits the check code from its title', () => {+ expect(rejectModalHeading('C4 · Usage chart keeps the selected range')).toEqual({+ code: 'C4',+ title: 'Usage chart keeps the selected range',+ });+ });++ it('keeps a title without a check code whole', () => {+ expect(rejectModalHeading('Back on Usage')).toEqual({ title: 'Back on Usage' });+ });++ it('does not mistake a separator inside the title for a code', () => {+ expect(rejectModalHeading('Chart · legend overlaps')).toEqual({+ title: 'Chart · legend overlaps',+ });+ expect(rejectModalHeading('C12 · Chart · legend overlaps')).toEqual({+ code: 'C12',+ title: 'Chart · legend overlaps',+ });+ });+});diff --git a/src/features/Acceptance/Viewer/Review/rejectModalShell.ts b/src/features/Acceptance/Viewer/Review/rejectModalShell.tsindex defe0ebcd4f..0e78a5b81c6 100644--- a/src/features/Acceptance/Viewer/Review/rejectModalShell.ts+++ b/src/features/Acceptance/Viewer/Review/rejectModalShell.ts@@ -109,4 +109,12 @@ export const rejectModalTitle = (title: string, description?: string) => ({title,});+const CHECK_CODE = /^(C\d+)\s*·\s*(\S.*)$/s;++export const rejectModalHeading = (checkTitle: string): { code?: string; title: string } => {+ const match = CHECK_CODE.exec(checkTitle.trim());+ if (!match) return { title: checkTitle };+ return { code: match[1], title: match[2] };+};+export const canDismissRejectModal = (loading: boolean) => !loading;diff --git a/src/features/Acceptance/Viewer/index.tsx b/src/features/Acceptance/Viewer/index.tsxindex 12b3eef731e..d70cc434c26 100644--- a/src/features/Acceptance/Viewer/index.tsx+++ b/src/features/Acceptance/Viewer/index.tsx@@ -15,6 +15,7 @@ import CollaboratorConversationRail from './Conversation/CollaboratorConversatioimport { FlowPanelHostContext } from './Flow/FlowPanelHost';import AcceptanceFocusWorkspace from './Focus/AcceptanceFocusWorkspace';import AcceptanceLedgerRail from './History/AcceptanceLedgerRail';+import { RunsPanelContext } from './History/runsPanel';const phone = '@media (width <= 767px)';@@ -26,7 +27,7 @@ const styles = stylex.create({},flowPanel: {flex: 'none',- width: { default: 'min(440px, 42%)', [phone]: '100%' },+ width: { default: 'min(480px, 42%)', [phone]: '100%' },height: { default: '100%', [phone]: '50%' },minHeight: 0,display: { 'default': null, ':empty': 'none' },@@ -64,29 +65,31 @@ const AcceptancePage = ({return (<AcceptanceScope acceptanceId={acceptanceId} embedded={embedded}><AcceptanceBundleGate>- <FlowPanelHostContext value={flowPanelHost}>- <Flexbox horizontal {...stylex.props(styles.page)}>- <Flexbox- horizontal- flex={1}- style={{ minHeight: 0, minWidth: 0, position: 'relative' }}- >- <Flexbox flex={1} {...sx(styles.contentFrame, { minWidth: 0 })}>- <Flexbox- flex={focused ? 1 : undefined}- gap={16}- style={{ minHeight: focused ? 0 : undefined, width: '100%' }}- >- {focused ? <AcceptanceFocusWorkspace /> : null}+ <RunsPanelContext value>+ <FlowPanelHostContext value={flowPanelHost}>+ <Flexbox horizontal {...stylex.props(styles.page)}>+ <Flexbox+ horizontal+ flex={1}+ style={{ minHeight: 0, minWidth: 0, position: 'relative' }}+ >+ <Flexbox flex={1} {...sx(styles.contentFrame, { minWidth: 0 })}>+ <Flexbox+ flex={focused ? 1 : undefined}+ gap={16}+ style={{ minHeight: focused ? 0 : undefined, width: '100%' }}+ >+ {focused ? <AcceptanceFocusWorkspace /> : null}+ </Flexbox>+ {!focused && <AcceptanceOverview onDraftToComposer={onDraftToComposer} />}</Flexbox>- {!focused && <AcceptanceOverview onDraftToComposer={onDraftToComposer} />}+ <AcceptanceLedgerRail />+ {!embedded && <CollaboratorConversationRail />}</Flexbox>- <AcceptanceLedgerRail />- {!embedded && <CollaboratorConversationRail />}+ <div ref={setFlowPanelHostContext} {...stylex.props(styles.flowPanel)} /></Flexbox>- <div ref={setFlowPanelHostContext} {...stylex.props(styles.flowPanel)} />- </Flexbox>- </FlowPanelHostContext>+ </FlowPanelHostContext>+ </RunsPanelContext></AcceptanceBundleGate></AcceptanceScope>);diff --git a/src/features/Acceptance/Viewer/markers.stylex.ts b/src/features/Acceptance/Viewer/markers.stylex.tsindex 2291566d1d3..7fa6a8c5d16 100644--- a/src/features/Acceptance/Viewer/markers.stylex.ts+++ b/src/features/Acceptance/Viewer/markers.stylex.ts@@ -1,15 +1,9 @@import * as stylex from '@stylexjs/stylex';-/**- * Hover / focus markers for StyleX `when.ancestor()` rules. Each is unique, so a- * hovered outer element never triggers a descendant rule meant for another one.- */-export const groupHeaderMarker = stylex.defineMarker();export const rowHeaderMarker = stylex.defineMarker();export const timelineEntryMarker = stylex.defineMarker();export const roundHeaderMarker = stylex.defineMarker();export const floatingActionHostMarker = stylex.defineMarker();export const goalCardMarker = stylex.defineMarker();export const titleRowMarker = stylex.defineMarker();-export const roundCardMarker = stylex.defineMarker();export const videoPlayerMarker = stylex.defineMarker();diff --git a/src/features/Acceptance/Viewer/verdict.test.ts b/src/features/Acceptance/Viewer/verdict.test.tsindex 0202f90974f..fc6adee9828 100644--- a/src/features/Acceptance/Viewer/verdict.test.ts+++ b/src/features/Acceptance/Viewer/verdict.test.ts@@ -17,6 +17,18 @@ describe('resolveAcceptanceVerdictMeta', () => {});});+describe('statuses that used to fall through to the generic in-progress pill', () => {+ it('names a delivered acceptance as waiting on the reviewer, without a spinner', () => {+ const meta = resolveAcceptanceVerdictMeta('delivered', t);+ expect(meta.label).toBe('acceptance.status.delivered');+ expect(meta.spin).toBeUndefined();+ });++ it('names a failed verification instead of calling it in progress', () => {+ expect(resolveAcceptanceVerdictMeta('failed', t).label).toBe('acceptance.status.failed');+ });+});+describe('formatAcceptanceCountsText', () => {it('joins only the counts that are present', () => {expect(diff --git a/src/features/Acceptance/Viewer/verdict.ts b/src/features/Acceptance/Viewer/verdict.tsindex 2667561f73b..9d935266485 100644--- a/src/features/Acceptance/Viewer/verdict.ts+++ b/src/features/Acceptance/Viewer/verdict.ts@@ -3,6 +3,8 @@ import type { TFunction } from 'i18next';import {BadgeCheck,CircleDashed,+ CircleDot,+ CircleX,HelpCircle,Loader2,RefreshCw,@@ -66,6 +68,22 @@ export const resolveAcceptanceVerdictMeta = (label: t('acceptance.status.rejected'),};}+ if (status === 'delivered') {+ return {+ bg: cssVar.colorFillSecondary,+ color: cssVar.colorText,+ icon: CircleDot,+ label: t('acceptance.status.delivered'),+ };+ }+ if (status === 'failed') {+ return {+ bg: cssVar.colorErrorBg,+ color: cssVar.colorError,+ icon: CircleX,+ label: t('acceptance.status.failed'),+ };+ }if (status === 'errored') {return {bg: cssVar.colorWarningBg,