🤯 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
💄 style(acceptance): review UX polish — status alignment, hover bulk-accept, accept undo & loading (#17289)
Arvin Xuaad5e88b7364
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.jsonindex 25b97dc8856..9168b93f7b8 100644--- a/locales/en-US/verify.json+++ b/locales/en-US/verify.json@@ -33,6 +33,7 @@"acceptance.detail.suggestion": "Suggestion","acceptance.error.description": "Check your connection and try loading this acceptance again.","acceptance.error.title": "Unable to load acceptance",+ "acceptance.evidence.empty": "No evidence artifacts were submitted for this check in this round — only the verifier’s recorded observation.","acceptance.evidence.file": "{{count}} text evidence item(s)","acceptance.evidence.image": "{{count}} image evidence item(s)","acceptance.evidence.video": "{{count}} video evidence item(s)",@@ -40,6 +41,7 @@"acceptance.filter.all": "All {{count}}","acceptance.filter.needsFix": "Needs fix {{count}}","acceptance.filter.pending": "To review {{count}}",+ "acceptance.filter.roundAll": "All rounds","acceptance.group.allVerified": "{{passed}}/{{total}} all verified & accepted","acceptance.group.collapse": "Collapse {{label}}","acceptance.group.collapseAll": "Collapse groups",@@ -78,6 +80,7 @@"acceptance.review.rejectDescription": "Reject \"{{title}}\" — your feedback is what the next verification round acts on.","acceptance.review.rejectPlaceholder": "What is wrong, and what do you expect instead…","acceptance.review.rejectedHint": "You rejected this check — the next round reads your feedback.",+ "acceptance.review.revertToReject": "Change to reject with comment","acceptance.review.supplement": "Additional notes (optional)","acceptance.round": "Round {{round}}","acceptance.roundCount": "{{count}} verification round(s)",diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.jsonindex 0386a00ec34..1bff16869fb 100644--- a/locales/zh-CN/verify.json+++ b/locales/zh-CN/verify.json@@ -33,6 +33,7 @@"acceptance.detail.suggestion": "建议","acceptance.error.description": "请检查网络连接后重试。","acceptance.error.title": "无法加载验收信息",+ "acceptance.evidence.empty": "该检查项本轮未提交证据材料,仅有验证方记录的结论。","acceptance.evidence.file": "{{count}} 份文本证据","acceptance.evidence.image": "{{count}} 份图片证据","acceptance.evidence.video": "{{count}} 份视频证据",@@ -40,6 +41,7 @@"acceptance.filter.all": "全部 {{count}}","acceptance.filter.needsFix": "待修复 {{count}}","acceptance.filter.pending": "未验收 {{count}}",+ "acceptance.filter.roundAll": "全部轮次","acceptance.group.allVerified": "{{passed}}/{{total}} 已全部验证通过","acceptance.group.collapse": "收起{{label}}","acceptance.group.collapseAll": "收起分组",@@ -78,6 +80,7 @@"acceptance.review.rejectDescription": "拒绝「{{title}}」——你的反馈将成为下一轮验证的处理输入。","acceptance.review.rejectPlaceholder": "哪里不对、你期望的是什么…","acceptance.review.rejectedHint": "你已拒绝该项——下一轮将读取你的反馈。",+ "acceptance.review.revertToReject": "改为拒绝并评论","acceptance.review.supplement": "补充说明(可选)","acceptance.round": "第 {{round}} 轮","acceptance.roundCount": "{{count}} 轮验证",diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.tsindex 8364f77884c..7f1ab6588ae 100644--- a/packages/locales/src/default/verify.ts+++ b/packages/locales/src/default/verify.ts@@ -43,6 +43,8 @@ export default {'acceptance.detail.suggestion': 'Suggestion','acceptance.error.description': 'Check your connection and try loading this acceptance again.','acceptance.error.title': 'Unable to load acceptance',+ 'acceptance.evidence.empty':+ 'No evidence artifacts were submitted for this check in this round — only the verifier’s recorded observation.','acceptance.evidence.file': '{{count}} text evidence item(s)','acceptance.evidence.image': '{{count}} image evidence item(s)','acceptance.evidence.video': '{{count}} video evidence item(s)',@@ -50,6 +52,7 @@ export default {'acceptance.filter.all': 'All {{count}}','acceptance.filter.needsFix': 'Needs fix {{count}}','acceptance.filter.pending': 'To review {{count}}',+ 'acceptance.filter.roundAll': 'All rounds','acceptance.group.allVerified': '{{passed}}/{{total}} all verified & accepted','acceptance.group.collapse': 'Collapse {{label}}','acceptance.group.collapseAll': 'Collapse groups',@@ -91,6 +94,7 @@ export default {'Reject "{{title}}" — your feedback is what the next verification round acts on.','acceptance.review.rejectPlaceholder': 'What is wrong, and what do you expect instead…','acceptance.review.rejectedHint': 'You rejected this check — the next round reads your feedback.',+ 'acceptance.review.revertToReject': 'Change to reject with comment','acceptance.review.supplement': 'Additional notes (optional)','acceptance.requirementEmpty': 'No acceptance goal recorded for this subject yet.','acceptance.requirementLabel': 'Acceptance goal',diff --git a/src/features/Verify/Acceptance/Annotation.tsx b/src/features/Verify/Acceptance/Annotation.tsxindex d9622dcbbcf..ca953dd8558 100644--- a/src/features/Verify/Acceptance/Annotation.tsx+++ b/src/features/Verify/Acceptance/Annotation.tsx@@ -8,10 +8,14 @@ import { memo, useRef, useState } from 'react';/*** Region-comment primitives for acceptance evidence images. Rects are stored- * normalized (0–1) against the image box, so the same annotation renders- * correctly at any display size — editor, row detail, iteration history.+ * normalized (0–1) against the IMAGE box — never the surrounding frame. A+ * frame can silently grow wider than the image it holds (flex stretch, long+ * sibling text driving fit-content), and any rect normalized or rendered+ * against that bigger box lands visibly off the pixels the user circled.*/+type Rect = AcceptanceReviewAnnotation['rect'];+const styles = createStaticStyles(({ css }) => ({badge: css`position: absolute;@@ -63,12 +67,21 @@ const styles = createStaticStyles(({ css }) => ({cursor: crosshair;user-select: none;`,+ /* Drawn regions are draggable as a whole; the corner handle resizes. */+ editableRect: css`+ pointer-events: auto;+ cursor: move;+ `,frame: css`position: relative;overflow: hidden;display: inline-block;+ /* Shrink-wrap the image exactly — a stretched frame skews every rect. */+ align-self: flex-start;++ width: fit-content;max-width: 100%;border: 1px solid ${cssVar.colorBorderSecondary};border-radius: ${cssVar.borderRadiusLG};@@ -83,9 +96,23 @@ const styles = createStaticStyles(({ css }) => ({border-radius: 4px;box-shadow: 0 0 0 1px rgb(0 0 0 / 25%);`,+ resizeHandle: css`+ cursor: nwse-resize;++ position: absolute;+ inset-block-end: -6px;+ inset-inline-end: -6px;++ width: 12px;+ height: 12px;+ border: 2px solid ${cssVar.colorError};+ border-radius: 50%;++ background: ${cssVar.colorBgContainer};+ `,}));-const rectStyle = (rect: AcceptanceReviewAnnotation['rect']) => ({+const rectStyle = (rect: Rect) => ({height: `${rect.height * 100}%`,left: `${rect.x * 100}%`,top: `${rect.y * 100}%`,@@ -93,7 +120,7 @@ const rectStyle = (rect: AcceptanceReviewAnnotation['rect']) => ({});interface AnnotatedImageProps {- annotations: { comment?: string; rect: AcceptanceReviewAnnotation['rect'] }[];+ annotations: { comment?: string; rect: Rect }[];imageStyle?: React.CSSProperties;src: string;}@@ -127,71 +154,120 @@ AnnotatedImage.displayName = 'AcceptanceAnnotatedImage';export interface DraftAnnotation {comment: string;- rect: AcceptanceReviewAnnotation['rect'];+ rect: Rect;}interface AnnotationCanvasProps {annotations: DraftAnnotation[];- onDraw: (rect: AcceptanceReviewAnnotation['rect']) => void;+ onDraw: (rect: Rect) => void;onRemove: (index: number) => void;+ /** Reposition / resize an existing region. */+ onUpdate: (index: number, rect: Rect) => void;src: string;}-/** Drag on the image to circle a region; each region carries its own note. */+/** An in-flight pointer gesture: drawing a new region, or moving/resizing one. */+type Gesture =+ | { kind: 'draw'; start: { x: number; y: number } }+ | { index: number; kind: 'move'; origin: Rect; start: { x: number; y: number } }+ | { index: number; kind: 'resize'; origin: Rect };++const clamp01 = (value: number) => Math.min(Math.max(value, 0), 1);++/**+ * Drag on the image to circle a region; drag a region to move it, drag its+ * corner handle to resize; each region carries its own note.+ */export const AnnotationCanvas = memo<AnnotationCanvasProps>(- ({ annotations, onDraw, onRemove, src }) => {- const frameRef = useRef<HTMLDivElement>(null);- const [draft, setDraft] = useState<AcceptanceReviewAnnotation['rect'] | null>(null);- const startRef = useRef<{ x: number; y: number } | null>(null);+ ({ annotations, onDraw, onRemove, onUpdate, src }) => {+ const imageRef = useRef<HTMLImageElement>(null);+ const [draft, setDraft] = useState<Rect | null>(null);+ const gestureRef = useRef<Gesture | null>(null);+ // Normalize against the image's own box — the frame may not equal it.const normalize = (event: React.MouseEvent) => {- const box = frameRef.current?.getBoundingClientRect();- if (!box) return null;+ const box = imageRef.current?.getBoundingClientRect();+ if (!box || box.width === 0 || box.height === 0) return null;return {- x: Math.min(Math.max((event.clientX - box.left) / box.width, 0), 1),- y: Math.min(Math.max((event.clientY - box.top) / box.height, 0), 1),+ x: clamp01((event.clientX - box.left) / box.width),+ y: clamp01((event.clientY - box.top) / box.height),};};- const toRect = (a: { x: number; y: number }, b: { x: number; y: number }) => ({+ const toRect = (a: { x: number; y: number }, b: { x: number; y: number }): Rect => ({height: Math.abs(a.y - b.y),width: Math.abs(a.x - b.x),x: Math.min(a.x, b.x),y: Math.min(a.y, b.y),});+ const endGesture = (event: React.MouseEvent) => {+ const gesture = gestureRef.current;+ gestureRef.current = null;+ setDraft(null);+ if (gesture?.kind !== 'draw') return;+ const point = normalize(event);+ if (!point) return;+ const rect = toRect(gesture.start, point);+ // Ignore accidental clicks — a region needs real area to comment on.+ if (rect.width < 0.01 || rect.height < 0.01) return;+ onDraw(rect);+ };+return (<divclassName={`${styles.frame} ${styles.canvas}`}- ref={frameRef}+ onMouseUp={endGesture}onMouseDown={(event) => {event.preventDefault();- startRef.current = normalize(event);+ const start = normalize(event);+ if (start) gestureRef.current = { kind: 'draw', start };}}onMouseLeave={() => {- startRef.current = null;+ gestureRef.current = null;setDraft(null);}}onMouseMove={(event) => {- if (!startRef.current) return;+ const gesture = gestureRef.current;+ if (!gesture) return;const point = normalize(event);- if (point) setDraft(toRect(startRef.current, point));- }}- onMouseUp={(event) => {- const start = startRef.current;- startRef.current = null;- setDraft(null);- const point = normalize(event);- if (!start || !point) return;- const rect = toRect(start, point);- // Ignore accidental clicks — a region needs real area to comment on.- if (rect.width < 0.01 || rect.height < 0.01) return;- onDraw(rect);+ if (!point) return;+ if (gesture.kind === 'draw') {+ setDraft(toRect(gesture.start, point));+ return;+ }+ const { index, origin } = gesture;+ if (gesture.kind === 'move') {+ onUpdate(index, {+ ...origin,+ x: Math.min(Math.max(origin.x + (point.x - gesture.start.x), 0), 1 - origin.width),+ y: Math.min(Math.max(origin.y + (point.y - gesture.start.y), 0), 1 - origin.height),+ });+ return;+ }+ // resize — the origin's top-left corner stays anchored.+ onUpdate(index, {+ height: Math.max(point.y - origin.y, 0.01),+ width: Math.max(point.x - origin.x, 0.01),+ x: origin.x,+ y: origin.y,+ });}}>- <img alt={''} className={styles.image} draggable={false} src={src} />+ <img alt={''} className={styles.image} draggable={false} ref={imageRef} src={src} />{annotations.map((annotation, index) => (- <div className={styles.rect} key={index} style={rectStyle(annotation.rect)}>+ <div+ className={`${styles.rect} ${styles.editableRect}`}+ key={index}+ style={rectStyle(annotation.rect)}+ onMouseDown={(event) => {+ event.preventDefault();+ event.stopPropagation();+ const start = normalize(event);+ if (start)+ gestureRef.current = { index, kind: 'move', origin: annotation.rect, start };+ }}+ ><span className={styles.badge}>{index + 1}</span><buttonclassName={styles.badgeDelete}@@ -204,6 +280,14 @@ export const AnnotationCanvas = memo<AnnotationCanvasProps>(><Icon icon={Trash2} size={11} /></button>+ <span+ className={styles.resizeHandle}+ onMouseDown={(event) => {+ event.preventDefault();+ event.stopPropagation();+ gestureRef.current = { index, kind: 'resize', origin: annotation.rect };+ }}+ /></div>))}{draft && <div className={styles.rect} style={rectStyle(draft)} />}diff --git a/src/features/Verify/Acceptance/CheckList.tsx b/src/features/Verify/Acceptance/CheckList.tsxindex 69da98977a4..5d87933ab5e 100644--- a/src/features/Verify/Acceptance/CheckList.tsx+++ b/src/features/Verify/Acceptance/CheckList.tsx@@ -158,6 +158,17 @@ const styles = createStaticStyles(({ css }) => ({padding-block: 10px;padding-inline: 16px;background: ${cssVar.colorFillQuaternary};++ .acceptance-group-actions {+ opacity: 0;+ transition: opacity 0.2s;+ }++ &:hover {+ .acceptance-group-actions {+ opacity: 1;+ }+ }`,historyToggle: css`cursor: pointer;@@ -204,12 +215,17 @@ const styles = createStaticStyles(({ css }) => ({padding-inline: 16px;&:hover {- background: ${cssVar.colorFillQuaternary};-.acceptance-row-actions {opacity: 1;}}++ /* The hover wash marks the collapsed row as a click target. An OPEN row is+ in reading mode — a gray band flashing between the white body and the+ white page just severs the title from its content, so no wash there. */+ &:not([data-expanded]):hover {+ background: ${cssVar.colorFillQuaternary};+ }`,stepDot: css`flex: none;@@ -601,6 +617,7 @@ const CheckRow = memo<{// 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 meta = STATE_META[check.state];const counts = evidenceCounts(check.evidence);@@ -619,6 +636,7 @@ const CheckRow = memo<{const openReject = () =>openCheckRejectModal({checkTitle: `C${check.seq} · ${check.title}`,+ draftKey: check.id,evidence: check.evidence.filter((item) => isVisual(item)).map((item) => ({ fileUrl: item.fileUrl!, id: item.id })),@@ -631,13 +649,46 @@ const CheckRow = memo<{}),});- // Passed + user-accepted merges into the double-check receipt.- const headIcon = check.state === 'passed' && reviewState === 'accepted' ? CheckCheck : meta.icon;+ // 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 ok = await onReview({ action: 'accept', checkItemIds: [check.id] });+ setAccepting(false);+ if (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+ : check.state === 'passed' && reviewState === 'accepted'+ ? CheckCheck+ : meta.icon;+ const headColor = reviewState === 'rejected' ? cssVar.colorError : meta.color;++ const headIconNode = (+ <Icon color={headColor} icon={headIcon} size={16} style={{ flex: 'none' }} />+ );return (<Flexbox className={styles.row}>- <Flexbox horizontal align={'center'} className={styles.rowHeader} gap={10} onClick={onToggle}>- <Icon color={meta.color} icon={headIcon} size={16} style={{ flex: 'none' }} />+ <Flexbox+ horizontal+ align={'center'}+ className={styles.rowHeader}+ data-expanded={expanded ? '' : undefined}+ gap={10}+ onClick={onToggle}+ >+ {reviewState === 'rejected' ? (+ <Tooltip title={t('acceptance.review.rejectedHint')}>{headIconNode}</Tooltip>+ ) : (+ headIconNode+ )}<Tooltip title={seqCopied ? t('acceptance.checks.copied') : t('acceptance.checks.copySeq')}><spanclassName={cx(styles.seqChip, styles.seqChipClickable)}@@ -683,27 +734,22 @@ const CheckRow = memo<{<Icon color={cssVar.colorTextQuaternary} icon={BadgeCheck} size={14} /></Tooltip>)}- {reviewState === 'rejected' && (- <Tooltip title={t('acceptance.review.rejectedHint')}>- <Icon color={cssVar.colorError} icon={MessageSquareX} size={14} />- </Tooltip>- )}{reviewable && reviewState === 'pending' && (<Flexboxhorizontalalign={'center'}className={cx(styles.rowActions, 'acceptance-row-actions')}gap={2}+ // The accept spinner must stay visible after the pointer leaves.+ style={accepting ? { opacity: 1 } : undefined}><ActionIcon- disabled={reviewPending}+ disabled={reviewPending && !accepting}icon={Check}+ loading={accepting}size={'small'}title={t('acceptance.review.accept')}- onClick={(event) => {- event.stopPropagation();- void onReview({ action: 'accept', checkItemIds: [check.id] });- }}+ onClick={handleAccept}/><ActionIcondisabled={reviewPending}@@ -794,8 +840,49 @@ const CheckRow = memo<{)}<EvidenceList evidence={check.evidence} />- {/* The user's standing feedback hangs right under the evidence it judges. */}- {activeReview && <FeedbackCard evidenceById={evidenceById} review={activeReview} />}+ {/* An executed check with zero artifacts must SAY so — a silent blank+ under the verdict reads as a rendering bug, not as a fact. Filled+ so it reads as a status, never as more description text. */}+ {check.result && check.evidence.length === 0 && (+ <Flexbox+ paddingBlock={6}+ paddingInline={10}+ style={{+ background: cssVar.colorFillQuaternary,+ borderRadius: cssVar.borderRadius,+ width: 'fit-content',+ }}+ >+ <Text fontSize={12} type={'secondary'}>+ {t('acceptance.evidence.empty')}+ </Text>+ </Flexbox>+ )}++ {/* The user's standing feedback hangs right under the evidence it+ judges. An accept keeps an undo path — the signature line gains a+ quiet "change to reject" escape, feedback then flows as usual. */}+ {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>+ ) : (+ <FeedbackCard evidenceById={evidenceById} review={activeReview} />+ ))}{/* Confirm (plain filled) anchors the right edge; reject is thequiet text escape next to it. */}@@ -813,14 +900,12 @@ const CheckRow = memo<{{t('acceptance.review.reject')}</Button><Button- disabled={reviewPending}+ disabled={reviewPending && !accepting}icon={<Icon icon={Check} />}+ loading={accepting}size={'small'}type={'fill'}- onClick={(event) => {- event.stopPropagation();- void onReview({ action: 'accept', checkItemIds: [check.id] });- }}+ onClick={handleAccept}>{t('acceptance.review.accept')}</Button>@@ -908,6 +993,8 @@ interface CheckListProps {onToggleGroupItems: (ids: string[], open: boolean) => void;onToggleItem: (id: string) => void;reviewPending: boolean;+ /** Show only checks that round executed (any step of their timeline). */+ round?: number | null;}/** The union check list: one joined card, collapsible business groups. */@@ -924,11 +1011,16 @@ const CheckList = memo<CheckListProps>(onToggleGroupItems,onToggleItem,reviewPending,+ round,}) => {const { t } = useTranslation('verify');+ const [acceptingGroup, setAcceptingGroup] = useState<string | null>(null);const visible = (check: AcceptanceCheck) =>- filter === 'all' || checkFilterState(check) === filter;+ (filter === 'all' || checkFilterState(check) === filter) &&+ (round === null ||+ round === undefined ||+ check.timeline.some((step) => step.roundIndex === round));const groups = groupChecks(checks, t('acceptance.group.uncategorized')).map((group) => ({@@ -990,21 +1082,30 @@ const CheckList = memo<CheckListProps>({t('acceptance.group.passRatio', { passed, total: groupChecks_.length })}</Text>)}- <Flexbox flex={1} />+ {/* 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}+ className={'acceptance-group-actions'}+ disabled={reviewPending && acceptingGroup !== key}icon={<Icon icon={BadgeCheck} />}+ loading={acceptingGroup === key}size={'small'}+ // The spinner must stay visible after the pointer leaves.+ style={acceptingGroup === key ? { opacity: 1 } : undefined}type={'text'}- onClick={(event) => {+ onClick={async (event) => {event.stopPropagation();- void onReview({+ 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')}@@ -1022,6 +1123,7 @@ const CheckList = memo<CheckListProps>({t('acceptance.review.acceptAllDone')}</Flexbox>))}+ <Flexbox flex={1} />{collapsed ? (// Fixed-size placeholder keeps the header height stable across toggles.<div style={{ height: 24, width: 24 }} />@@ -1067,19 +1169,22 @@ const CheckList = memo<CheckListProps>(/>))}{/* Bottom escape hatch — after scrolling through the group's rows,- collapse it without travelling back to the header. */}+ collapse it without travelling back to the header. Labeled:+ a bare icon at this distance from the header reads as noise. */}{!collapsed && (<Flexboxalign={'center'}paddingBlock={4}style={{ borderBlockStart: `1px solid ${cssVar.colorBorderSecondary}` }}>- <ActionIcon- icon={ChevronsDownUp}+ <Button+ icon={<Icon icon={ChevronsDownUp} />}size={'small'}- title={t('acceptance.group.collapse', { label })}+ type={'text'}onClick={() => onToggleGroup(key)}- />+ >+ {t('acceptance.group.collapse', { label })}+ </Button></Flexbox>)}</Fragment>diff --git a/src/features/Verify/Acceptance/CheckRejectModal.tsx b/src/features/Verify/Acceptance/CheckRejectModal.tsxindex bc279f9b15e..3590695d793 100644--- a/src/features/Verify/Acceptance/CheckRejectModal.tsx+++ b/src/features/Verify/Acceptance/CheckRejectModal.tsx@@ -1,11 +1,11 @@'use client';import type { AcceptanceReviewAnnotation } from '@lobechat/types';-import { Flexbox, Input, Text, TextArea } from '@lobehub/ui';+import { Flexbox, Text, TextArea } from '@lobehub/ui';import { Button, createModal, type ModalInstance, useModalContext } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import { t } from 'i18next';-import { memo, useState } from 'react';+import { memo, useEffect, useState } from 'react';import { useTranslation } from 'react-i18next';import { AnnotationCanvas } from './Annotation';@@ -39,8 +39,40 @@ export interface RejectableEvidence {id: string;}+interface DraftAnnotationEntry {+ comment: string;+ evidenceId: string;+ /** Stable identity — rapid move/resize updates must never key off object+ identity, which a stale render closure invalidates mid-gesture. */+ key: number;+ rect: AcceptanceReviewAnnotation['rect'];+}++let draftAnnotationSeq = 0;+const nextAnnotationKey = () => ++draftAnnotationSeq;++/** What survives a refresh — typed feedback is too costly to lose to one F5. */+interface RejectDraft {+ annotations: DraftAnnotationEntry[];+ comment: string;+}++const draftStorageKey = (key: string) => `acceptance-reject-draft:${key}`;++const readDraft = (key: string | undefined): RejectDraft | null => {+ if (!key) return null;+ try {+ const raw = localStorage.getItem(draftStorageKey(key));+ return raw ? (JSON.parse(raw) as RejectDraft) : null;+ } catch {+ return null;+ }+};+interface CheckRejectModalProps {checkTitle: string;+ /** Stable key (the check id) for the refresh-surviving draft cache. */+ draftKey?: string;evidence: RejectableEvidence[];/** Perform the reject; resolve true to close, false to stay open. */onConfirm: (value: {@@ -49,162 +81,215 @@ interface CheckRejectModalProps {}) => Promise<boolean>;}-const CheckRejectContent = memo<CheckRejectModalProps>(({ checkTitle, evidence, onConfirm }) => {- const { t: translate } = useTranslation('verify');- const { close } = useModalContext();- const [comment, setComment] = useState('');- const [loading, setLoading] = useState(false);- const [activeEvidenceId, setActiveEvidenceId] = useState(evidence[0]?.id);- const [annotations, setAnnotations] = useState<- { comment: string; evidenceId: string; rect: AcceptanceReviewAnnotation['rect'] }[]- >([]);-- const activeEvidence = evidence.find((item) => item.id === activeEvidenceId);- const activeAnnotations = annotations.filter((item) => item.evidenceId === activeEvidenceId);-- // The reject IS its feedback — at least one note (global or per-region).- const canSubmit =- Boolean(comment.trim()) || annotations.some((annotation) => annotation.comment.trim());-- const handleConfirm = async () => {- setLoading(true);- try {- const confirmed = await onConfirm({- annotations: annotations- .filter((annotation) => annotation.comment.trim())- .map((annotation) => ({- comment: annotation.comment.trim(),- evidenceId: annotation.evidenceId,- rect: annotation.rect,- })),- comment: comment.trim(),- });- if (confirmed) close();- } finally {- setLoading(false);- }- };+const CheckRejectContent = memo<CheckRejectModalProps>(+ ({ checkTitle, draftKey, evidence, onConfirm }) => {+ const { t: translate } = useTranslation('verify');+ const { close } = useModalContext();+ const [draft] = useState(() => readDraft(draftKey));+ const [comment, setComment] = useState(draft?.comment ?? '');+ const [loading, setLoading] = useState(false);+ const [activeEvidenceId, setActiveEvidenceId] = useState(evidence[0]?.id);+ const [annotations, setAnnotations] = useState<DraftAnnotationEntry[]>(+ // Only restore regions whose evidence still exists — a new round may+ // have replaced the artifacts since the draft was written.+ () =>+ (draft?.annotations ?? [])+ .filter((entry) => evidence.some((item) => item.id === entry.evidenceId))+ .map((entry) => ({ ...entry, key: nextAnnotationKey() })),+ );++ // Persist the draft as it is typed; an empty draft cleans the slot up.+ useEffect(() => {+ if (!draftKey) return;+ try {+ if (!comment && annotations.length === 0) {+ localStorage.removeItem(draftStorageKey(draftKey));+ } else {+ localStorage.setItem(+ draftStorageKey(draftKey),+ JSON.stringify({ annotations, comment } satisfies RejectDraft),+ );+ }+ } catch {+ /* quota/private mode — the draft is a convenience, never a blocker */+ }+ }, [annotations, comment, draftKey]);- const hasEvidence = evidence.length > 0;+ const activeEvidence = evidence.find((item) => item.id === activeEvidenceId);+ const activeAnnotations = annotations.filter((item) => item.evidenceId === activeEvidenceId);- return (- <>- {/* Only the body scrolls — the action bar below stays pinned to the+ // The reject IS its feedback — at least one note (global or per-region).+ const canSubmit =+ Boolean(comment.trim()) || annotations.some((annotation) => annotation.comment.trim());++ const handleConfirm = async () => {+ setLoading(true);+ try {+ const confirmed = await onConfirm({+ annotations: annotations+ .filter((annotation) => annotation.comment.trim())+ .map((annotation) => ({+ comment: annotation.comment.trim(),+ evidenceId: annotation.evidenceId,+ rect: annotation.rect,+ })),+ comment: comment.trim(),+ });+ if (confirmed) {+ if (draftKey) localStorage.removeItem(draftStorageKey(draftKey));+ close();+ }+ } finally {+ setLoading(false);+ }+ };++ const hasEvidence = evidence.length > 0;++ return (+ <>+ {/* Only the body scrolls — the action bar below stays pinned to themodal's bottom edge however tall the evidence grows. */}- <Flexbox- flex={1}- gap={16}- paddingBlock={12}- paddingInline={16}- style={{ minHeight: 0, overflowY: 'auto' }}- >- <Text fontSize={13} type={'secondary'}>- {translate('acceptance.review.rejectDescription', { title: checkTitle })}- </Text>-- {/* Circling the evidence is the primary feedback act; the free-form note+ <Flexbox+ flex={1}+ gap={16}+ paddingBlock={12}+ paddingInline={16}+ style={{ minHeight: 0, overflowY: 'auto' }}+ >+ <Text fontSize={13} type={'secondary'}>+ {translate('acceptance.review.rejectDescription', { title: checkTitle })}+ </Text>++ {/* Circling the evidence is the primary feedback act; the free-form notebelow is supplementary context. Without evidence, the note IS thefeedback and stands alone. */}- {hasEvidence && (- <Flexbox gap={8}>- <Flexbox gap={2}>- <Text strong fontSize={13}>- {translate('acceptance.review.annotate')}- </Text>- <Text fontSize={12} type={'secondary'}>- {translate('acceptance.review.annotateHint')}- </Text>- </Flexbox>- {evidence.length > 1 && (- <Flexbox horizontal gap={8} wrap={'wrap'}>- {evidence.map((item) => (- <div- className={cx(styles.thumb, item.id === activeEvidenceId && styles.thumbActive)}- key={item.id}- onClick={() => setActiveEvidenceId(item.id)}- >- <img alt={''} src={item.fileUrl} />- </div>- ))}+ {hasEvidence && (+ <Flexbox gap={8}>+ <Flexbox gap={2}>+ <Text strong fontSize={13}>+ {translate('acceptance.review.annotate')}+ </Text>+ <Text fontSize={12} type={'secondary'}>+ {translate('acceptance.review.annotateHint')}+ </Text></Flexbox>- )}- {activeEvidence && (- <AnnotationCanvas- annotations={activeAnnotations}- src={activeEvidence.fileUrl}- onDraw={(rect) =>- setAnnotations((previous) => [- ...previous,- { comment: '', evidenceId: activeEvidence.id, rect },- ])- }- onRemove={(index) =>- setAnnotations((previous) =>- previous.filter((item) => item !== activeAnnotations[index]),- )- }- />- )}- {activeAnnotations.map((annotation, index) => {- const globalIndex = annotations.indexOf(annotation);- return (- <Input- key={globalIndex}- value={annotation.comment}- placeholder={translate('acceptance.review.annotationPlaceholder', {- index: index + 1,- })}- prefix={- <Text fontSize={12} type={'secondary'}>- {index + 1}.- </Text>- }- onChange={(event) =>- setAnnotations((previous) =>- previous.map((item) =>- item === annotation ? { ...item, comment: event.target.value } : item,- ),- )+ {evidence.length > 1 && (+ <Flexbox horizontal gap={8} wrap={'wrap'}>+ {evidence.map((item) => (+ <div+ key={item.id}+ className={cx(+ styles.thumb,+ item.id === activeEvidenceId && styles.thumbActive,+ )}+ onClick={() => setActiveEvidenceId(item.id)}+ >+ <img alt={''} src={item.fileUrl} />+ </div>+ ))}+ </Flexbox>+ )}+ {activeEvidence && (+ <AnnotationCanvas+ annotations={activeAnnotations}+ src={activeEvidence.fileUrl}+ onDraw={(rect) =>+ setAnnotations((previous) => [+ ...previous,+ {+ comment: '',+ evidenceId: activeEvidence.id,+ key: nextAnnotationKey(),+ rect,+ },+ ])}+ onRemove={(index) => {+ const target = activeAnnotations[index];+ if (target)+ setAnnotations((previous) =>+ previous.filter((item) => item.key !== target.key),+ );+ }}+ onUpdate={(index, rect) => {+ const target = activeAnnotations[index];+ if (target)+ setAnnotations((previous) =>+ previous.map((item) =>+ item.key === target.key ? { ...item, rect } : item,+ ),+ );+ }}/>- );- })}+ )}+ {activeAnnotations.map((annotation, index) => {+ return (+ <Flexbox horizontal align={'flex-start'} gap={8} key={annotation.key}>+ <Text+ fontSize={12}+ style={{ flex: 'none', lineHeight: '30px' }}+ type={'secondary'}+ >+ {index + 1}.+ </Text>+ <TextArea+ autoSize={{ maxRows: 4, minRows: 1 }}+ style={{ flex: 1 }}+ value={annotation.comment}+ placeholder={translate('acceptance.review.annotationPlaceholder', {+ index: index + 1,+ })}+ onChange={(event) =>+ setAnnotations((previous) =>+ previous.map((item) =>+ item.key === annotation.key+ ? { ...item, comment: event.target.value }+ : item,+ ),+ )+ }+ />+ </Flexbox>+ );+ })}+ </Flexbox>+ )}++ <Flexbox gap={6}>+ {hasEvidence && (+ <Text fontSize={12} type={'secondary'}>+ {translate('acceptance.review.supplement')}+ </Text>+ )}+ <TextArea+ autoSize={{ maxRows: 6, minRows: hasEvidence ? 2 : 3 }}+ placeholder={translate('acceptance.review.rejectPlaceholder')}+ value={comment}+ onChange={(event) => setComment(event.target.value)}+ /></Flexbox>- )}+ </Flexbox>- <Flexbox gap={6}>- {hasEvidence && (- <Text fontSize={12} type={'secondary'}>- {translate('acceptance.review.supplement')}- </Text>- )}- <TextArea- autoSize={{ maxRows: 6, minRows: hasEvidence ? 2 : 3 }}- placeholder={translate('acceptance.review.rejectPlaceholder')}- value={comment}- onChange={(event) => setComment(event.target.value)}- />+ <Flexbox+ horizontal+ gap={8}+ justify={'flex-end'}+ paddingBlock={12}+ paddingInline={16}+ style={{ borderBlockStart: `1px solid ${cssVar.colorBorderSecondary}`, flex: 'none' }}+ >+ <Button disabled={loading} onClick={close}>+ {translate('acceptance.actions.cancel')}+ </Button>+ <Button disabled={!canSubmit} loading={loading} type={'primary'} onClick={handleConfirm}>+ {translate('acceptance.review.confirmReject')}+ </Button></Flexbox>- </Flexbox>-- <Flexbox- horizontal- gap={8}- justify={'flex-end'}- paddingBlock={12}- paddingInline={16}- style={{ borderBlockStart: `1px solid ${cssVar.colorBorderSecondary}`, flex: 'none' }}- >- <Button disabled={loading} onClick={close}>- {translate('acceptance.actions.cancel')}- </Button>- <Button disabled={!canSubmit} loading={loading} type={'primary'} onClick={handleConfirm}>- {translate('acceptance.review.confirmReject')}- </Button>- </Flexbox>- </>- );-});+ </>+ );+ },+);CheckRejectContent.displayName = 'AcceptanceCheckRejectContent';diff --git a/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx b/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsxindex f3cd878fcce..57b6e989625 100644--- a/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx+++ b/src/features/Verify/Acceptance/Workspace/AcceptanceListPanel.tsx@@ -16,7 +16,7 @@ import dayjs from 'dayjs';import isEqual from 'fast-deep-equal';import {BadgeCheck,- CircleCheck,+ CircleDashed,CircleHelp,CircleX,LoaderCircle,@@ -184,7 +184,7 @@ const styles = createStaticStyles(({ css }) => ({`,}));-type Glyph = 'ok' | 'bad' | 'unsure' | 'running' | 'accepted';+type Glyph = 'awaiting' | 'bad' | 'unsure' | 'running' | 'accepted';const RUNNING_STATUSES = new Set<AcceptanceStatus>(['pending',@@ -198,13 +198,16 @@ const glyphOf = (status: AcceptanceStatus): Glyph => {if (status === 'accepted') return 'accepted';if (status === 'rejected') return 'bad';if (status === 'errored') return 'unsure';- return 'ok';+ return 'awaiting';};-const glyphMeta: Record<Glyph, { color: string; icon: typeof CircleCheck }> = {+// Mirrors the detail header's verdict pill: a delivered-but-undecided+// aggregate reads as "acceptance in progress", never as a green all-clear+// the user hasn't given.+const glyphMeta: Record<Glyph, { color: string; icon: typeof BadgeCheck }> = {accepted: { color: cssVar.colorSuccess, icon: BadgeCheck },+ awaiting: { color: cssVar.colorInfo, icon: CircleDashed },bad: { color: cssVar.colorError, icon: CircleX },- ok: { color: cssVar.colorSuccess, icon: CircleCheck },running: { color: cssVar.colorInfo, icon: LoaderCircle },unsure: { color: cssVar.colorWarning, icon: CircleHelp },};diff --git a/src/features/Verify/Acceptance/index.tsx b/src/features/Verify/Acceptance/index.tsxindex c298dac3a2a..9383ef036a2 100644--- a/src/features/Verify/Acceptance/index.tsx+++ b/src/features/Verify/Acceptance/index.tsx@@ -13,7 +13,7 @@ import {Tag,Text,} from '@lobehub/ui';-import { Button, Segmented } from '@lobehub/ui/base-ui';+import { Button, Segmented, Select } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import dayjs from 'dayjs';import {@@ -36,6 +36,7 @@ import { useTranslation } from 'react-i18next';import { useParams } from 'react-router';import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';+import AgentProfilePopup from '@/features/AgentProfileCard/AgentProfilePopup';import { verifyService } from '@/services/verify';import { useAcceptanceBundle } from '../hooks';@@ -50,7 +51,7 @@ import CheckList, {isGroupFullyAccepted,} from './CheckList';import LedgerPanel, { type AcceptanceRound } from './LedgerPanel';-import { openAcceptModal, openRejectModal } from './modals';+import { openAcceptModal } from './modals';const styles = createStaticStyles(({ css }) => ({banner: css`@@ -100,7 +101,7 @@ const styles = createStaticStyles(({ css }) => ({width: 100%;height: 100%;- background: ${cssVar.colorBgLayout};+ background: ${cssVar.colorBgContainer};`,requirementLabel: css`font-size: 12px;@@ -154,12 +155,6 @@ const styles = createStaticStyles(({ css }) => ({/** Aggregate states in which the round chain is still executing. */const LIVE_STATUSES = new Set(['pending', 'planned', 'verifying', 'repairing']);-/**- * The user-closure decision bar (accept / reject) is NOT shipping in this- * release — kept behind this switch (with its modals) until the loop launches.- */-const ENABLE_DECISION_BAR = false;-interface AcceptancePageProps {/*** Render for a specific aggregate instead of the route param — the portal@@ -177,6 +172,7 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAcceptconst { data, error, isLoading, mutate } = useAcceptanceBundle(acceptanceId ?? null);const [filter, setFilter] = useState<CheckFilter>('all');+ const [roundFilter, setRoundFilter] = useState<number | null>(null);const [expanded, setExpanded] = useState<Set<string>>(() => new Set());const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(() => new Set());const [seeded, setSeeded] = useState(false);@@ -440,17 +436,9 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept{countsText} · {t('acceptance.banner.decisionHint')}</Text></Flexbox>- <Button- disabled={pending}- onClick={() =>- openRejectModal({- onConfirm: (comment) =>- runAction(() => verifyService.rejectDelivery(acceptance.id, comment)),- })- }- >- {t('acceptance.actions.reject')}- </Button>+ {/* Whole-delivery reject is deliberately NOT exposed yet — per-check+ reject-with-feedback is the send-back path; only the closing+ accept ships for now. */}<Buttondisabled={pending}type={'primary'}@@ -525,34 +513,52 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept{(origin?.agent || origin?.topic) && (<Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>{origin.agent && (- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={6}>- <Avatar- avatar={origin.agent.avatar ?? undefined}- background={origin.agent.backgroundColor ?? undefined}- size={18}- />- {origin.agent.title ?? t('acceptance.origin.agentFallback')}- </Flexbox>+ <AgentProfilePopup+ agentId={origin.agent.id}+ trigger={'hover'}+ agent={{+ avatar: origin.agent.avatar ?? undefined,+ backgroundColor: origin.agent.backgroundColor ?? undefined,+ title: origin.agent.title ?? undefined,+ }}+ >+ <Flexbox+ horizontal+ align={'center'}+ className={styles.scopeChip}+ gap={6}+ style={{ cursor: 'default' }}+ >+ <Avatar+ avatar={origin.agent.avatar ?? undefined}+ background={origin.agent.backgroundColor ?? undefined}+ size={18}+ />+ {origin.agent.title ?? t('acceptance.origin.agentFallback')}+ </Flexbox>+ </AgentProfilePopup>)}{origin.topic && (- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>+ <Flexbox+ horizontal+ align={'center'}+ className={cx(styles.scopeChip, styles.scopeLink)}+ gap={4}+ title={t('acceptance.origin.openTopic')}+ onClick={() => window.open(`/chat?topic=${origin.topic!.id}`, '_blank')}+ ><Icon icon={MessagesSquare} size={13} />{origin.topic.title ?? subject.title ?? origin.topic.id}- <ActionIcon- icon={SquareArrowOutUpRight}- size={'small'}- title={t('acceptance.origin.openTopic')}- onClick={() => window.open(`/chat?topic=${origin.topic!.id}`, '_blank')}- />+ <Icon icon={SquareArrowOutUpRight} size={12} /></Flexbox>)}</Flexbox>)}</Flexbox>- {/* Decision bar — the user closes the lifecycle (P-12). Hidden- until the accept/reject loop ships. */}- {ENABLE_DECISION_BAR && decisionBanner()}+ {/* Decision bar — the user closes the lifecycle (P-12). Owner-only:+ the closing accept is the author's call, never a visitor's. */}+ {isOwner && decisionBanner()}{actionError && <Text type={'danger'}>{actionError}</Text>}{/* The acceptance goal — THE thing this delivery is judged against,@@ -663,17 +669,35 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAccept]}onChange={(value) => setFilter(value as CheckFilter)}/>- <Button- icon={<Icon icon={allGroupsCollapsed ? ChevronsUpDown : ChevronsDownUp} />}+ {/* Which round touched a check — audit slicing, orthogonal to the+ review-state segments. */}+ {rounds.length > 1 && (+ <Select+ size={'small'}+ style={{ width: 110 }}+ value={roundFilter === null ? 'all' : String(roundFilter)}+ options={[+ { label: t('acceptance.filter.roundAll'), value: 'all' },+ ...[...rounds].reverse().map((round) => ({+ label: t('acceptance.round', { round: round.run.roundIndex }),+ value: String(round.run.roundIndex),+ })),+ ]}+ onChange={(value) => setRoundFilter(value === 'all' ? null : Number(value))}+ />+ )}+ <ActionIcon+ icon={allGroupsCollapsed ? ChevronsUpDown : ChevronsDownUp}size={'small'}+ title={+ allGroupsCollapsed+ ? t('acceptance.group.expandAll')+ : t('acceptance.group.collapseAll')+ }onClick={() =>setCollapsedGroups(allGroupsCollapsed ? new Set() : new Set(groupKeys))}- >- {allGroupsCollapsed- ? t('acceptance.group.expandAll')- : t('acceptance.group.collapseAll')}- </Button>+ /></Flexbox><CheckList@@ -683,6 +707,7 @@ const AcceptancePage = memo<AcceptancePageProps>(({ acceptanceId: explicitAcceptexpanded={expanded}filter={filter}reviewPending={pending}+ round={roundFilter}onReview={handleReview}onRound={gotoRound}onToggleGroup={(key) =>