Skip to content

🤯 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.

🐛 fix(acceptance): make the phone review loop usable end to end (#19361)

Arvin Xu47b7ee2ea099
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index 725a847408f..dc8e787ade9 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -104,17 +104,17 @@
"acceptance.focus.enter": "Review checks",
"acceptance.focus.evidenceCount": "{{count}} evidence items",
"acceptance.focus.evidenceHint": "Review the acceptance criterion, evidence, and feedback for this check.",
+ "acceptance.focus.judgeLabel": "Agent judged",
"acceptance.focus.next": "Next check",
"acceptance.focus.previous": "Previous check",
"acceptance.focus.state.accepted": "Accepted",
"acceptance.focus.state.ignored": "Ignored",
"acceptance.focus.state.needsFix": "Needs fix",
"acceptance.focus.state.pending": "To review",
- "acceptance.focus.verifierDescription.failed": "The verifier found that this check did not meet its acceptance criterion. Review the result and evidence before deciding.",
- "acceptance.focus.verifierDescription.notExecuted": "This check was not executed, so there is no verifier result or evidence to accept.",
- "acceptance.focus.verifierDescription.passed": "The verifier found that this check met its acceptance criterion. Review the evidence before accepting it.",
- "acceptance.focus.verifierDescription.uncertain": "The verifier could not reach a confident result. Review the available evidence before deciding.",
- "acceptance.focus.verifierLabel": "Verifier",
+ "acceptance.focus.verifierDescription.failed": "The agent judged that this check did not meet its acceptance criterion. Review the result and evidence before deciding.",
+ "acceptance.focus.verifierDescription.notExecuted": "This check was not executed, so there is no agent judgement or evidence to accept.",
+ "acceptance.focus.verifierDescription.passed": "The agent judged that this check met its acceptance criterion. Review the evidence before accepting it.",
+ "acceptance.focus.verifierDescription.uncertain": "The agent could not reach a confident judgement. Review the available evidence before deciding.",
"acceptance.goalCollapse": "Collapse the acceptance goal",
"acceptance.goalEdit": "Edit the acceptance goal",
"acceptance.goalExpand": "Expand the acceptance goal",
@@ -195,6 +195,7 @@
"acceptance.review.imageNumber": "Image {{current}} / {{total}}",
"acceptance.review.mobileBrowseHint": "Swipe to switch · scroll to read",
"acceptance.review.mobileDrawHint": "Drag to mark an issue",
+ "acceptance.review.mobileDrawnHint": "{{count}} region(s) marked · drag to move, corner dot to resize",
"acceptance.review.nextImage": "Next image",
"acceptance.review.previousImage": "Previous image",
"acceptance.review.regionComments": "Region comments",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index 8361b915e75..353cbbd9fdf 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -104,17 +104,17 @@
"acceptance.focus.enter": "逐项验收",
"acceptance.focus.evidenceCount": "{{count}} 份证据",
"acceptance.focus.evidenceHint": "集中检查该项的验收标准、证据和反馈。",
+ "acceptance.focus.judgeLabel": "Agent 判断",
"acceptance.focus.next": "下一项",
"acceptance.focus.previous": "上一项",
"acceptance.focus.state.accepted": "已验收",
"acceptance.focus.state.ignored": "已忽略",
"acceptance.focus.state.needsFix": "待修复",
"acceptance.focus.state.pending": "未验收",
- "acceptance.focus.verifierDescription.failed": "验证器判定该检查项未达到验收标准。请查看结果和证据后再做决定。",
- "acceptance.focus.verifierDescription.notExecuted": "该检查项尚未执行,因此没有可供验收的验证结果或证据。",
- "acceptance.focus.verifierDescription.passed": "验证器判定该检查项已达到验收标准。请查看证据后再确认验收。",
- "acceptance.focus.verifierDescription.uncertain": "验证器暂时无法得出可信结论。请查看现有证据后再做决定。",
- "acceptance.focus.verifierLabel": "验证器",
+ "acceptance.focus.verifierDescription.failed": "Agent 判断该检查项未达到验收标准。请查看结果和证据后再做决定。",
+ "acceptance.focus.verifierDescription.notExecuted": "该检查项尚未执行,因此没有可供验收的 Agent 判断或证据。",
+ "acceptance.focus.verifierDescription.passed": "Agent 判断该检查项已达到验收标准。请查看证据后再确认验收。",
+ "acceptance.focus.verifierDescription.uncertain": "Agent 暂时无法得出可信判断。请查看现有证据后再做决定。",
"acceptance.goalCollapse": "收起验收目标",
"acceptance.goalEdit": "编辑验收目标",
"acceptance.goalExpand": "展开验收目标",
@@ -195,6 +195,7 @@
"acceptance.review.imageNumber": "图片 {{current}} / {{total}}",
"acceptance.review.mobileBrowseHint": "左右切图 · 上下阅读",
"acceptance.review.mobileDrawHint": "拖动圈选问题区域",
+ "acceptance.review.mobileDrawnHint": "已圈选 {{count}} 处 · 拖动可移动,右下角圆点可缩放",
"acceptance.review.nextImage": "下一张图片",
"acceptance.review.previousImage": "上一张图片",
"acceptance.review.regionComments": "圈选评论",
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index 65ae80f9715..0e301c9651d 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -16,6 +16,8 @@ export default {
'acceptance.review.writeFeedback': 'Write feedback',
'acceptance.review.mobileDrawHint': 'Drag to mark an issue',
'acceptance.review.mobileBrowseHint': 'Swipe to switch · scroll to read',
+ 'acceptance.review.mobileDrawnHint':
+ '{{count}} region(s) marked · drag to move, corner dot to resize',
'acceptance.review.draftSaved': 'Your draft is saved on this device.',
'acceptance.review.removeAttachment': 'Remove attachment',
'acceptance.review.regionImage': 'Image {{image}} · Region {{region}}',
@@ -232,14 +234,14 @@ export default {
'acceptance.focus.state.needsFix': 'Needs fix',
'acceptance.focus.state.pending': 'To review',
'acceptance.focus.verifierDescription.failed':
- 'The verifier found that this check did not meet its acceptance criterion. Review the result and evidence before deciding.',
+ 'The agent judged that this check did not meet its acceptance criterion. Review the result and evidence before deciding.',
'acceptance.focus.verifierDescription.notExecuted':
- 'This check was not executed, so there is no verifier result or evidence to accept.',
+ 'This check was not executed, so there is no agent judgement or evidence to accept.',
'acceptance.focus.verifierDescription.passed':
- 'The verifier found that this check met its acceptance criterion. Review the evidence before accepting it.',
+ 'The agent judged that this check met its acceptance criterion. Review the evidence before accepting it.',
'acceptance.focus.verifierDescription.uncertain':
- 'The verifier could not reach a confident result. Review the available evidence before deciding.',
- 'acceptance.focus.verifierLabel': 'Verifier',
+ 'The agent could not reach a confident judgement. Review the available evidence before deciding.',
+ 'acceptance.focus.judgeLabel': 'Agent judged',
'acceptance.goalCollapse': 'Collapse the acceptance goal',
'acceptance.goalEdit': 'Edit the acceptance goal',
'acceptance.goalExpand': 'Expand the acceptance goal',
diff --git a/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx
index b44949195ab..123b86c9e2f 100644
--- a/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx
+++ b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx
@@ -7,7 +7,7 @@ import { ChevronsDownUp, ChevronsUpDown } from 'lucide-react';
import type { ReactNode } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import { useSearchParams } from 'react-router';
+import { useNavigate, useSearchParams } from 'react-router';
import { useSingleton } from '@/hooks/useSingleton';
import { mutate as globalMutate } from '@/libs/swr';
@@ -17,6 +17,7 @@ import { verifyService } from '@/services/verify';
import { useAcceptanceScope } from '../AcceptanceScope';
import { hasVisualEvidence } from '../Evidence/evidence';
import AcceptanceInteractionCost from '../History/AcceptanceInteractionCost';
+import { acceptanceCheckPath } from '../routes';
import { checksForTurn } from '../turnChecks';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
import { useAcceptanceTurn } from '../useAcceptanceTurn';
@@ -70,6 +71,7 @@ const AcceptanceCheckInventory = ({
const { md = true } = useResponsive();
const { acceptanceId, embedded } = useAcceptanceScope();
const { data, mutate } = useAcceptanceBundle(acceptanceId);
+ const navigate = useNavigate();
const [searchParams, setSearchParams] = useSearchParams();
const [localFilter, setLocalFilter] = useState<CheckFilter>('all');
const urlFilterRaw = searchParams.get('filter');
@@ -197,6 +199,22 @@ const AcceptanceCheckInventory = ({
pending: checks.filter((check) => checkFilterState(check) === 'pending').length,
total: checks.length,
};
+ // On a phone a check opens its own page: the inline disclosure carries a
+ // whole evidence review, and unfolding it inside the list buries the rows
+ // around it. Pushed (not replaced) so the system back button returns to the
+ // list, and flagged so the page's own back arrow can honour that entry.
+ // An embedded drawer has no route of its own, so it keeps disclosing.
+ const openCheckPage =
+ !md && !embedded
+ ? (id: string) =>
+ navigate(
+ acceptanceCheckPath(acceptanceId, id) + (searchParams.size ? `?${searchParams}` : ''),
+ {
+ state: { fromCheckList: true },
+ },
+ )
+ : undefined;
+
const grouped = shouldGroupChecks(checks.length);
const groupKeys = grouped
? groupChecks(checks, t('acceptance.group.uncategorized')).map((group) => group.key)
@@ -288,6 +306,7 @@ const AcceptanceCheckInventory = ({
filter={filter}
groupFeedback={groupFeedback}
reviewPending={false}
+ onOpenCheck={openCheckPage}
onOpenTrace={onOpenTrace}
onRound={setRoundFilter}
onDismissProposal={
diff --git a/src/features/Acceptance/Viewer/Checks/CheckList.test.ts b/src/features/Acceptance/Viewer/Checks/CheckList.test.ts
index 55083a48694..9d27c66e4ef 100644
--- a/src/features/Acceptance/Viewer/Checks/CheckList.test.ts
+++ b/src/features/Acceptance/Viewer/Checks/CheckList.test.ts
@@ -15,7 +15,6 @@ import {
checkFilterState,
focusedCheckStates,
groupChecks,
- isCheckWorkActionable,
shouldCollapseAfterReview,
shouldGroupChecks,
userReviewState,
@@ -246,30 +245,6 @@ describe('userReviewState', () => {
});
});
-describe('isCheckWorkActionable', () => {
- const withReview = (action?: 'accept' | 'ignore' | 'reject') =>
- ({
- userReview: action
- ? {
- action,
- createdAt: '2026-07-16T00:00:00.000Z',
- roundIndex: 1,
- stale: false,
- }
- : undefined,
- }) as AcceptanceCheck;
-
- it('keeps work available for pending and rejected checks', () => {
- expect(isCheckWorkActionable(withReview())).toBe(true);
- expect(isCheckWorkActionable(withReview('reject'))).toBe(true);
- });
-
- it('hides work for accepted and ignored checks', () => {
- expect(isCheckWorkActionable(withReview('accept'))).toBe(false);
- expect(isCheckWorkActionable(withReview('ignore'))).toBe(false);
- });
-});
-
describe('shouldCollapseAfterReview', () => {
it('folds an expanded check after its reject is recorded', () => {
expect(shouldCollapseAfterReview(true, true)).toBe(true);
diff --git a/src/features/Acceptance/Viewer/Checks/CheckList.tsx b/src/features/Acceptance/Viewer/Checks/CheckList.tsx
index 9689ad9a89c..c511d11064c 100644
--- a/src/features/Acceptance/Viewer/Checks/CheckList.tsx
+++ b/src/features/Acceptance/Viewer/Checks/CheckList.tsx
@@ -51,6 +51,11 @@ interface CheckListProps {
onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;
/** Record group-scoped feedback; resolves true when the write landed. */
onGroupFeedback: (category: string, comment: string, fileIds: string[]) => Promise<boolean>;
+ /**
+ * Open a check on its own page instead of unfolding it in the list. Set on a
+ * phone, where the inline disclosure buries its neighbours.
+ */
+ onOpenCheck?: (id: string) => void;
/** Open an agent judge's verification run (its trace IS the argument). */
onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;
/** Record the user's verdict; resolves true when the write landed. */
@@ -74,6 +79,7 @@ const CheckList = memo<CheckListProps>(
groupFeedback,
onDismissProposal,
onGroupFeedback,
+ onOpenCheck,
onReview,
onOpenTrace,
onRound,
@@ -161,6 +167,7 @@ const CheckList = memo<CheckListProps>(
key={check.id}
reviewPending={reviewPending}
onDismissProposal={onDismissProposal}
+ onOpenDetail={onOpenCheck ? () => onOpenCheck(check.id) : undefined}
onOpenTrace={onOpenTrace}
onReview={onReview}
onRound={onRound}
@@ -315,8 +322,10 @@ const CheckList = memo<CheckListProps>(
/>
</span>
)}
- {collapsed ? (
- // Fixed-size placeholder keeps the header height stable across toggles.
+ {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
@@ -400,6 +409,7 @@ const CheckList = memo<CheckListProps>(
key={check.id}
reviewPending={reviewPending}
onDismissProposal={onDismissProposal}
+ onOpenDetail={onOpenCheck ? () => onOpenCheck(check.id) : undefined}
onOpenTrace={onOpenTrace}
onReview={onReview}
onRound={onRound}
diff --git a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx b/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
index dcddad8111f..e05376f1de5 100644
--- a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
+++ b/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
@@ -41,6 +41,7 @@ import {
} from './CheckHistory';
import { shouldCollapseAfterReview, userReviewState } from './checkState';
import { STATE_META } from './checkStatus';
+import { checkRowDisclosure } from './rowDisclosure';
import { styles } from './styles';
import type { AcceptanceCheck, CheckReviewInput, ProposalDismissInput } from './types';
@@ -60,6 +61,12 @@ export const AcceptanceCheckRow = memo<{
onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;
onReview: (input: CheckReviewInput) => Promise<boolean>;
onRound?: (round: number) => void;
+ /**
+ * Open this check on its own page instead of disclosing it in place. Set on
+ * a phone, where a row that unfolds a full evidence review inside a scrolling
+ * list buries both the check above it and the one below.
+ */
+ onOpenDetail?: () => void;
/** Open an agent judge's verification run (its trace IS the argument). */
onOpenTrace?: (verifierOperationId: string) => void | Promise<void>;
onToggle: () => void;
@@ -71,6 +78,7 @@ export const AcceptanceCheckRow = memo<{
detailMode,
expanded,
onDismissProposal,
+ onOpenDetail,
onOpenTrace,
onReview,
onRound,
@@ -90,6 +98,11 @@ export const AcceptanceCheckRow = memo<{
// unreviewed check would push the evidence the reviewer came for below the fold.
const [proposalOpen, setProposalOpen] = useState(false);
const meta = STATE_META[check.state];
+ const { activate, ariaExpanded, open } = checkRowDisclosure({
+ expanded,
+ onOpenDetail,
+ onToggle,
+ });
const title = checkDisplayTitle(check.title, t('acceptance.checks.holisticTitle'));
const counts = evidenceCounts(check.evidence);
const visualization = readVisualizationManifest(check.result?.metadata);
@@ -261,20 +274,20 @@ export const AcceptanceCheckRow = memo<{
<Flexbox
horizontal
align={'flex-start'}
- aria-expanded={expanded}
+ aria-expanded={ariaExpanded}
className={styles.rowHeader}
- data-expanded={expanded ? '' : undefined}
+ data-expanded={open ? '' : undefined}
gap={10}
role={'button'}
tabIndex={0}
- onClick={onToggle}
+ onClick={activate}
onKeyDown={(event) => {
if (
event.target === event.currentTarget &&
(event.key === 'Enter' || event.key === ' ')
) {
event.preventDefault();
- onToggle();
+ activate();
}
}}
>
@@ -305,10 +318,10 @@ export const AcceptanceCheckRow = memo<{
flex={1}
gap={8}
style={{ minWidth: 0 }}
- wrap={expanded ? 'wrap' : 'nowrap'}
+ wrap={open ? 'wrap' : 'nowrap'}
>
<Text
- className={expanded || !desktop ? undefined : styles.titleEllipsis}
+ className={open || !desktop ? undefined : styles.titleEllipsis}
style={{ fontSize: desktop ? 13 : 14, minWidth: 0 }}
>
{title}
@@ -445,7 +458,7 @@ export const AcceptanceCheckRow = memo<{
icon={ChevronRight}
size={14}
style={{
- transform: expanded ? 'rotate(90deg)' : 'none',
+ transform: open ? 'rotate(90deg)' : 'none',
transition: 'transform 0.2s',
}}
/>
@@ -453,7 +466,7 @@ export const AcceptanceCheckRow = memo<{
</Flexbox>
)}
- {expanded && (
+ {open && (
<Flexbox
gap={10}
paddingBlock={detailMode ? 0 : '0 14px'}
@@ -650,26 +663,55 @@ export const AcceptanceCheckRow = memo<{
</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 && hasAnnotatableEvidence(check) && (
+ <Button
+ outdent
+ icon={<Icon icon={Images} />}
+ style={{ alignSelf: 'flex-start' }}
+ type={'text'}
+ onClick={(event) => {
+ event.stopPropagation();
+ openReject();
+ }}
+ >
+ {t('acceptance.review.annotate')}
+ </Button>
+ )}
+ {hasHistory && (
+ <span
+ className={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
+ check={check}
+ evidenceById={evidenceById}
+ historyReviews={historyReviews}
+ onRound={onRound}
+ />
+ )}
{/* Confirm (plain filled) anchors the right edge; reject is the
quiet text escape next to it. */}
{reviewable &&
!activeReview &&
(detailMode ? (
<Flexbox gap={10} style={{ marginBlockStart: 6 }}>
- {hasAnnotatableEvidence(check) && (
- <Button
- outdent
- icon={<Icon icon={Images} />}
- style={{ alignSelf: 'flex-start' }}
- type={'text'}
- onClick={(event) => {
- event.stopPropagation();
- openReject();
- }}
- >
- {t('acceptance.review.annotate')}
- </Button>
- )}
<TextArea
autoSize={{ maxRows: 8, minRows: 3 }}
placeholder={t('acceptance.review.detailPlaceholder')}
@@ -735,31 +777,6 @@ export const AcceptanceCheckRow = memo<{
</Button>
</Flexbox>
))}
-
- {hasHistory && (
- <span
- className={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
- check={check}
- evidenceById={evidenceById}
- historyReviews={historyReviews}
- onRound={onRound}
- />
- )}
</Flexbox>
)}
</Flexbox>
diff --git a/src/features/Acceptance/Viewer/Checks/checkState.ts b/src/features/Acceptance/Viewer/Checks/checkState.ts
index 7f03bd88388..f335a65a7a2 100644
--- a/src/features/Acceptance/Viewer/Checks/checkState.ts
+++ b/src/features/Acceptance/Viewer/Checks/checkState.ts
@@ -16,10 +16,6 @@ export const userReviewState = (check: AcceptanceCheck): UserReviewState => {
return 'rejected';
};
-/** Accepted and ignored checks are terminal — there is no remaining work to send back. */
-export const isCheckWorkActionable = (check: AcceptanceCheck): boolean =>
- ['pending', 'rejected'].includes(userReviewState(check));
-
/** A successful review decision moves the reviewer forward by folding the finished row. */
export const shouldCollapseAfterReview = (succeeded: boolean, expanded: boolean): boolean =>
succeeded && expanded;
diff --git a/src/features/Acceptance/Viewer/Checks/checkWork.test.ts b/src/features/Acceptance/Viewer/Checks/checkWork.test.ts
deleted file mode 100644
index 3e0a082165d..00000000000
--- a/src/features/Acceptance/Viewer/Checks/checkWork.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { describe, expect, it, vi } from 'vitest';
-
-import { copyCheckRepairPrompt } from './checkWork';
-
-describe('copyCheckRepairPrompt', () => {
- it('copies a check-scoped repair prompt without dispatching work elsewhere', async () => {
- const copy = vi.fn().mockResolvedValue(undefined);
-
- await copyCheckRepairPrompt(
- 'acceptance-1',
- { id: 'check-2', seq: 2, title: 'Header verdict' },
- copy,
- );
-
- expect(copy).toHaveBeenCalledOnce();
- expect(copy).toHaveBeenCalledWith(expect.stringContaining('focus on check C2'));
- expect(copy).toHaveBeenCalledWith(expect.stringContaining('check id: check-2'));
- });
-});
diff --git a/src/features/Acceptance/Viewer/Checks/checkWork.ts b/src/features/Acceptance/Viewer/Checks/checkWork.ts
index 869c5507bb3..11106b76540 100644
--- a/src/features/Acceptance/Viewer/Checks/checkWork.ts
+++ b/src/features/Acceptance/Viewer/Checks/checkWork.ts
@@ -1,5 +1,3 @@
-type CheckRepairTarget = { id: string; seq: number; title: string };
-
/**
* The repair prompt points the agent at the CLI as the source of truth, so the
* reviewer does not have to hand-summarize evidence and feedback.
@@ -10,15 +8,3 @@ export const buildRepairPrompt = (acceptanceId: string) =>
lh acceptance feedback ${acceptanceId} --actionable
Every entry it prints (per-check comments, circled-region annotations on the evidence screenshots, and attachments) is the full set of feedback to handle this round. Fix the code item by item; then re-run verification and ingest the new result back into the SAME acceptance (reuse the existing check ids, and use supersedes for any check whose meaning changed). Keep the final report in the same language the previous rounds used.`;
-
-export const buildCheckRepairPrompt = (acceptanceId: string, check: CheckRepairTarget) =>
- `${buildRepairPrompt(acceptanceId)}
-
-For this pass, focus on check C${check.seq} "${check.title}" (check id: ${check.id}). Treat it as the bounded work item: read its evidence and feedback, make the necessary change, and re-verify it without disturbing unrelated accepted or ignored checks.`;
-
-/** A per-check work action is intentionally clipboard-only; it never posts to a conversation. */
-export const copyCheckRepairPrompt = async (
- acceptanceId: string,
- check: CheckRepairTarget,
- copy: (text: string) => Promise<void>,
-) => copy(buildCheckRepairPrompt(acceptanceId, check));
diff --git a/src/features/Acceptance/Viewer/Checks/rowDisclosure.test.ts b/src/features/Acceptance/Viewer/Checks/rowDisclosure.test.ts
new file mode 100644
index 00000000000..67c4d94b39d
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Checks/rowDisclosure.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { checkRowDisclosure } from './rowDisclosure';
+
+describe('checkRowDisclosure', () => {
+ it('unfolds in place when no detail page is offered', () => {
+ const onToggle = vi.fn();
+ const row = checkRowDisclosure({ expanded: true, onToggle });
+
+ expect(row.activate).toBe(onToggle);
+ expect(row.ariaExpanded).toBe(true);
+ expect(row.open).toBe(true);
+ });
+
+ it('opens the detail page instead of unfolding', () => {
+ const onOpenDetail = vi.fn();
+ const onToggle = vi.fn();
+ const row = checkRowDisclosure({ expanded: false, onOpenDetail, onToggle });
+
+ expect(row.activate).toBe(onOpenDetail);
+ expect(row.open).toBe(false);
+ });
+
+ it('keeps a navigating row folded even when it is marked expanded', () => {
+ // Expand entries are seeded on a wide window and survive a resize down to
+ // phone width, where the row navigates instead.
+ const row = checkRowDisclosure({ expanded: true, onOpenDetail: vi.fn(), onToggle: vi.fn() });
+
+ expect(row.open).toBe(false);
+ });
+
+ it('drops aria-expanded on a navigating row', () => {
+ const row = checkRowDisclosure({ expanded: false, onOpenDetail: vi.fn(), onToggle: vi.fn() });
+
+ expect(row.ariaExpanded).toBeUndefined();
+ });
+});
diff --git a/src/features/Acceptance/Viewer/Checks/rowDisclosure.ts b/src/features/Acceptance/Viewer/Checks/rowDisclosure.ts
new file mode 100644
index 00000000000..27fa9632d53
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Checks/rowDisclosure.ts
@@ -0,0 +1,22 @@
+interface RowDisclosureInput {
+ expanded: boolean;
+ /** Set when the row opens the check on its own page instead of in place. */
+ onOpenDetail?: () => void;
+ onToggle: () => void;
+}
+
+/**
+ * How a check row answers a tap.
+ *
+ * A row that navigates must never also unfold: an expand entry seeded on a
+ * wide window survives a resize down to phone width, which would leave the row
+ * disclosing a full evidence review under the finger that just opened the same
+ * check on its own page. It is also not a disclosure widget any more, so it
+ * stops claiming `aria-expanded` — announcing "collapsed" would promise an
+ * expansion that never comes.
+ */
+export const checkRowDisclosure = ({ expanded, onOpenDetail, onToggle }: RowDisclosureInput) => ({
+ activate: onOpenDetail ?? onToggle,
+ ariaExpanded: onOpenDetail ? undefined : expanded,
+ open: expanded && !onOpenDetail,
+});
diff --git a/src/features/Acceptance/Viewer/Evidence/Annotation.tsx b/src/features/Acceptance/Viewer/Evidence/Annotation.tsx
index 18c71c499ce..273dcb7409b 100644
--- a/src/features/Acceptance/Viewer/Evidence/Annotation.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Annotation.tsx
@@ -41,7 +41,9 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorError};
`,
/* Delete mirrors the index badge on the opposite corner — the same pink
- disc, so which region the action removes reads at a glance. */
+ disc, so which region the action removes reads at a glance. Touch keeps
+ it: a phone reviewer who mis-drags a box has no keyboard escape, and the
+ only other way out used to be leaving the image entirely. */
badgeDelete: css`
cursor: pointer;
@@ -66,8 +68,11 @@ const styles = createStaticStyles(({ css }) => ({
filter: brightness(1.15);
}
- @media (width <= 767px) {
- display: none;
+ @media (pointer: coarse) {
+ inset-block-start: -12px;
+ inset-inline-end: -12px;
+ width: 24px;
+ height: 24px;
}
`,
canvas: css`
diff --git a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
index 897390504ea..5d28e326cc6 100644
--- a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
@@ -1,29 +1,46 @@
'use client';
-import { Flexbox, Icon } from '@lobehub/ui';
-import { ActionIcon, Button, Text } from '@lobehub/ui/base-ui';
+import { Flexbox } from '@lobehub/ui';
+import { ActionIcon, Button, Segmented, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
-import { ArrowLeft, ChevronLeft, ChevronRight, ZoomIn, ZoomOut } from 'lucide-react';
+import { ChevronLeft, ChevronRight, ZoomIn, ZoomOut } from 'lucide-react';
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
+import type { MobileReviewEvent } from './mobileReviewFlow';
+
const styles = createStaticStyles(({ css }) => ({
body: css`
display: flex;
flex: 1;
flex-direction: column;
- gap: 8px;
min-width: 0;
min-height: 0;
`,
- editor: css`
+ /** The one scroll on the page — image on top, the notes it earns below it. */
+ scroll: css`
overflow-y: auto;
overscroll-behavior: contain;
+ display: flex;
flex: 1;
+ flex-direction: column;
+ gap: 8px;
min-height: 0;
- padding-block: 8px 16px;
+ padding-block-end: 12px;
+ `,
+ /** The image keeps a fixed slice of the screen so the notes under it are
+ reachable without a second screen — but stays tall enough to circle on. */
+ stage: css`
+ display: flex;
+ flex: none;
+ height: 42dvh;
+ min-height: 220px;
+ `,
+ editor: css`
+ flex: none;
+ padding-block-start: 4px;
textarea {
font-size: 16px;
@@ -32,21 +49,24 @@ const styles = createStaticStyles(({ css }) => ({
footer: css`
display: flex;
flex: none;
+ flex-direction: column;
gap: 8px;
padding-block-start: 8px;
border-block-start: 1px solid ${cssVar.colorBorderSecondary};
> button {
- flex: 1;
min-height: 44px;
}
`,
}));
interface MobileEvidenceReviewProps {
+ /** Regions already drawn on the image on screen. */
+ annotationCount: number;
canSubmit: boolean;
drawing: boolean;
+ /** Region notes, the supplementary note and attachments — all under the image. */
editor: ReactNode;
failed: boolean;
image: ReactNode;
@@ -54,16 +74,19 @@ interface MobileEvidenceReviewProps {
imageIndex: number;
loading: boolean;
onConfirm: () => void;
- onDrawingChange: (value: boolean) => void;
onImageChange: (index: number) => void;
- onShowFeedback: (value: boolean) => void;
+ /** Move the browse / mark flow along — see mobileReviewFlow. */
+ onStep: (event: MobileReviewEvent) => void;
onZoom: (direction: 1 | -1) => void;
- showFeedback: boolean;
zoom: number;
}
-/** Phone review has one task at a time: inspect/mark the image, then write feedback. */
+/**
+ * Phone review on one page: look at the image, circle what is wrong, and write
+ * the note right where the circle landed.
+ */
export const MobileEvidenceReview = ({
+ annotationCount,
canSubmit,
drawing,
failed,
@@ -73,94 +96,97 @@ export const MobileEvidenceReview = ({
imageIndex,
loading,
onConfirm,
- onDrawingChange,
onImageChange,
- onShowFeedback,
+ onStep,
onZoom,
- showFeedback,
zoom,
}: MobileEvidenceReviewProps) => {
const { t } = useTranslation('verify');
return (
<div className={styles.body}>
- {showFeedback ? (
- <>
- {imageCount > 0 && (
- <Button
- icon={<Icon icon={ArrowLeft} />}
- style={{ alignSelf: 'flex-start', minHeight: 44 }}
- type={'text'}
- onClick={() => onShowFeedback(false)}
- >
- {t('acceptance.review.backToImages')}
- </Button>
- )}
- <div className={styles.editor}>{editor}</div>
- {failed && (
- <Text role={'alert'} type={'danger'}>
- {t('acceptance.review.submitFailed')}
- </Text>
- )}
- <div className={styles.footer}>
- <Button disabled={!canSubmit} loading={loading} type={'primary'} onClick={onConfirm}>
- {t('acceptance.review.confirmReject')}
- </Button>
- </div>
- </>
- ) : (
- <>
- <Flexbox horizontal align={'center'} gap={8} style={{ flex: 'none' }}>
- <ActionIcon
- aria-label={t('acceptance.review.previousImage')}
- disabled={imageIndex <= 0}
- icon={ChevronLeft}
- size={{ blockSize: 44, size: 20 }}
- onClick={() => onImageChange(imageIndex - 1)}
- />
- <Text aria-live={'polite'} style={{ flex: 1, textAlign: 'center' }}>
- {t('acceptance.review.imageNumber', { current: imageIndex + 1, total: imageCount })}
- </Text>
- <ActionIcon
- aria-label={t('acceptance.review.nextImage')}
- disabled={imageIndex >= imageCount - 1}
- icon={ChevronRight}
- size={{ blockSize: 44, size: 20 }}
- onClick={() => onImageChange(imageIndex + 1)}
- />
- </Flexbox>
- {image}
- <Flexbox horizontal align={'center'} gap={8} style={{ flex: 'none' }}>
- <Text fontSize={12} style={{ flex: 1 }} type={'secondary'}>
- {t(
- drawing ? 'acceptance.review.mobileDrawHint' : 'acceptance.review.mobileBrowseHint',
- )}
+ <div className={styles.scroll}>
+ {imageCount > 0 && (
+ <>
+ <Flexbox horizontal align={'center'} gap={8} style={{ flex: 'none' }}>
+ <ActionIcon
+ aria-label={t('acceptance.review.previousImage')}
+ disabled={imageIndex <= 0}
+ icon={ChevronLeft}
+ size={{ blockSize: 44, size: 20 }}
+ onClick={() => onImageChange(imageIndex - 1)}
+ />
+ <Text aria-live={'polite'} style={{ flex: 1, textAlign: 'center' }}>
+ {t('acceptance.review.imageNumber', {
+ current: imageIndex + 1,
+ total: imageCount,
+ })}
+ </Text>
+ <ActionIcon
+ aria-label={t('acceptance.review.nextImage')}
+ disabled={imageIndex >= imageCount - 1}
+ icon={ChevronRight}
+ size={{ blockSize: 44, size: 20 }}
+ onClick={() => onImageChange(imageIndex + 1)}
+ />
+ </Flexbox>
+ <div className={styles.stage}>{image}</div>
+ <Flexbox horizontal align={'center'} gap={8} style={{ flex: 'none' }}>
+ {/* A mode switch, not an action button. The old single button was
+ labelled with the mode it would LEAVE, so it read as a stray
+ box whose 44px slab said nothing about which mode was on. */}
+ <Segmented
+ size={'small'}
+ value={drawing ? 'draw' : 'browse'}
+ options={[
+ { label: t('acceptance.review.browseImage'), value: 'browse' },
+ { label: t('acceptance.review.drawRegion'), value: 'draw' },
+ ]}
+ onChange={(value) => {
+ if ((value === 'draw') !== drawing) onStep('toggle-draw');
+ }}
+ />
+ <Flexbox flex={1} />
+ <ActionIcon
+ aria-label={t('acceptance.review.zoomOut')}
+ disabled={zoom <= 0.5}
+ icon={ZoomOut}
+ size={{ blockSize: 44, size: 20 }}
+ onClick={() => onZoom(-1)}
+ />
+ <Text fontSize={12}>{Math.round(zoom * 100)}%</Text>
+ <ActionIcon
+ aria-label={t('acceptance.review.zoomIn')}
+ disabled={zoom >= 4}
+ icon={ZoomIn}
+ size={{ blockSize: 44, size: 20 }}
+ onClick={() => onZoom(1)}
+ />
+ </Flexbox>
+ {/* The hint is the region's receipt: it says the box landed AND
+ that it is still editable, right above the note it belongs to. */}
+ <Text fontSize={12} style={{ flex: 'none' }} type={'secondary'}>
+ {drawing && annotationCount > 0
+ ? t('acceptance.review.mobileDrawnHint', { count: annotationCount })
+ : t(
+ drawing
+ ? 'acceptance.review.mobileDrawHint'
+ : 'acceptance.review.mobileBrowseHint',
+ )}
</Text>
- <ActionIcon
- aria-label={t('acceptance.review.zoomOut')}
- disabled={zoom <= 0.5}
- icon={ZoomOut}
- size={{ blockSize: 44, size: 20 }}
- onClick={() => onZoom(-1)}
- />
- <Text fontSize={12}>{Math.round(zoom * 100)}%</Text>
- <ActionIcon
- aria-label={t('acceptance.review.zoomIn')}
- disabled={zoom >= 4}
- icon={ZoomIn}
- size={{ blockSize: 44, size: 20 }}
- onClick={() => onZoom(1)}
- />
- </Flexbox>
- <div className={styles.footer}>
- <Button aria-pressed={drawing} onClick={() => onDrawingChange(!drawing)}>
- {t(drawing ? 'acceptance.review.browseImage' : 'acceptance.review.drawRegion')}
- </Button>
- <Button type={'primary'} onClick={() => onShowFeedback(true)}>
- {t('acceptance.review.writeFeedback')}
- </Button>
- </div>
- </>
- )}
+ </>
+ )}
+ <div className={styles.editor}>{editor}</div>
+ </div>
+ <div className={styles.footer}>
+ {failed && (
+ <Text role={'alert'} type={'danger'}>
+ {t('acceptance.review.submitFailed')}
+ </Text>
+ )}
+ <Button disabled={!canSubmit} loading={loading} type={'primary'} onClick={onConfirm}>
+ {t('acceptance.review.confirmReject')}
+ </Button>
+ </div>
</div>
);
};
diff --git a/src/features/Acceptance/Viewer/Evidence/mobileReviewFlow.test.ts b/src/features/Acceptance/Viewer/Evidence/mobileReviewFlow.test.ts
new file mode 100644
index 00000000000..15c7b7e5b53
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Evidence/mobileReviewFlow.test.ts
@@ -0,0 +1,21 @@
+import { describe, expect, it } from 'vitest';
+
+import { nextMobileReviewStep } from './mobileReviewFlow';
+
+describe('nextMobileReviewStep', () => {
+ it('stays on the image after a region is drawn', () => {
+ // The regression: finishing a drag left the image for a separate note
+ // screen, so the box could no longer be moved, resized or deleted.
+ expect(nextMobileReviewStep('draw', 'region-drawn')).toBe('draw');
+ });
+
+ it('toggles between marking and browsing', () => {
+ expect(nextMobileReviewStep('browse', 'toggle-draw')).toBe('draw');
+ expect(nextMobileReviewStep('draw', 'toggle-draw')).toBe('browse');
+ });
+
+ it('opens a listed region ready to adjust, not merely to look at', () => {
+ expect(nextMobileReviewStep('browse', 'edit-region')).toBe('draw');
+ expect(nextMobileReviewStep('draw', 'edit-region')).toBe('draw');
+ });
+});
diff --git a/src/features/Acceptance/Viewer/Evidence/mobileReviewFlow.ts b/src/features/Acceptance/Viewer/Evidence/mobileReviewFlow.ts
new file mode 100644
index 00000000000..ef2b4b23ff1
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Evidence/mobileReviewFlow.ts
@@ -0,0 +1,36 @@
+/**
+ * On a phone the evidence review is ONE page: the image on top, the notes it
+ * earns directly underneath. The only mode left is whether a drag on the image
+ * marks a region or pans it.
+ */
+export type MobileReviewStep = 'browse' | 'draw';
+
+export type MobileReviewEvent =
+ /** A region was just drawn on the image. */
+ | 'region-drawn'
+ /** Jump from a listed note back to its image, ready to adjust the region. */
+ | 'edit-region'
+ /** The draw / browse toggle under the image. */
+ | 'toggle-draw';
+
+/**
+ * `region-drawn` deliberately holds the step still. Finishing a drag used to
+ * leave the image for a separate note screen, which froze the box at whatever
+ * shape the first drag produced — no way back to move, resize or delete it.
+ */
+export const nextMobileReviewStep = (
+ step: MobileReviewStep,
+ event: MobileReviewEvent,
+): MobileReviewStep => {
+ switch (event) {
+ case 'region-drawn': {
+ return step;
+ }
+ case 'edit-region': {
+ return 'draw';
+ }
+ case 'toggle-draw': {
+ return step === 'draw' ? 'browse' : 'draw';
+ }
+ }
+};
diff --git a/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.test.ts b/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.test.ts
new file mode 100644
index 00000000000..32957a1a2d7
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.test.ts
@@ -0,0 +1,79 @@
+import { act, cleanup, renderHook } from '@testing-library/react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { useMeasuredWidth } from './useMeasuredWidth';
+
+const observed = new Set<Element>();
+let notify: (() => void) | undefined;
+
+class FakeResizeObserver {
+ constructor(callback: () => void) {
+ notify = callback;
+ }
+ disconnect() {
+ observed.clear();
+ }
+ observe(target: Element) {
+ observed.add(target);
+ }
+ unobserve(target: Element) {
+ observed.delete(target);
+ }
+}
+
+const nodeOfWidth = (width: number) => {
+ const node = document.createElement('div');
+ Object.defineProperty(node, 'clientWidth', { configurable: true, value: width });
+ return node;
+};
+
+beforeEach(() => {
+ observed.clear();
+ notify = undefined;
+ vi.stubGlobal('ResizeObserver', FakeResizeObserver);
+});
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+describe('useMeasuredWidth', () => {
+ it('re-measures when the observed node is replaced', () => {
+ // The reject modal swaps this node on the responsive flip and on every
+ // step between the image and the feedback screen. An observer bound to the
+ // first node keeps reporting the old layout — which froze the phone viewer
+ // at fit-width no matter what zoom said.
+ const { result } = renderHook(() => useMeasuredWidth());
+
+ act(() => result.current.ref(nodeOfWidth(360)));
+ expect(result.current.width).toBe(360);
+
+ act(() => result.current.ref(nodeOfWidth(750)));
+ expect(result.current.width).toBe(750);
+ });
+
+ it('treats a zero width as unmeasured, then recovers once laid out', () => {
+ // Measuring while the modal is still animating open yields 0. Reporting
+ // that as a real width would multiply zoom by nothing forever.
+ const node = nodeOfWidth(0);
+ const { result } = renderHook(() => useMeasuredWidth());
+
+ act(() => result.current.ref(node));
+ expect(result.current.width).toBeUndefined();
+
+ Object.defineProperty(node, 'clientWidth', { configurable: true, value: 640 });
+ act(() => notify?.());
+ expect(result.current.width).toBe(640);
+ });
+
+ it('stops observing the node it is detached from', () => {
+ const { result, unmount } = renderHook(() => useMeasuredWidth());
+
+ act(() => result.current.ref(nodeOfWidth(320)));
+ expect(observed.size).toBe(1);
+
+ unmount();
+ expect(observed.size).toBe(0);
+ });
+});
diff --git a/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.ts b/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.ts
new file mode 100644
index 00000000000..2948e89dbfd
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Evidence/useMeasuredWidth.ts
@@ -0,0 +1,32 @@
+import { useLayoutEffect, useState } from 'react';
+
+/**
+ * Track an element's content width across node swaps.
+ *
+ * A `useRef` + one-shot `ResizeObserver` keeps observing the node it first saw.
+ * The reject modal replaces that node whenever the layout flips between the
+ * desktop and phone branch — after which the observer is watching a detached
+ * element and the width freezes at whatever the previous layout measured
+ * (often 0, while the modal was still animating open). A zoom factor
+ * multiplied into a frozen or zero width is why the phone viewer showed 200%
+ * and rendered the image at fit-width.
+ *
+ * Keying the observer to the node itself re-measures on every swap. A zero
+ * width means "not laid out yet", never a real measurement, so callers fall
+ * back to intrinsic sizing until a real number arrives.
+ */
+export const useMeasuredWidth = <T extends HTMLElement = HTMLDivElement>() => {
+ const [node, setNode] = useState<T | null>(null);
+ const [width, setWidth] = useState<number>();
+
+ useLayoutEffect(() => {
+ if (!node) return;
+ const measure = () => setWidth(node.clientWidth || undefined);
+ measure();
+ const observer = new ResizeObserver(measure);
+ observer.observe(node);
+ return () => observer.disconnect();
+ }, [node]);
+
+ return { node, ref: setNode, width };
+};
diff --git a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx
index 475618322f1..2384de1fcdc 100644
--- a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx
+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx
@@ -24,7 +24,7 @@ import { useTranslation } from 'react-i18next';
import NavItem from '@/features/NavPanel/components/NavItem';
-import { checkFilterState, focusedCheckStates, isCheckWorkActionable } from '../Checks/checkState';
+import { checkFilterState, focusedCheckStates } from '../Checks/checkState';
import {
type AcceptanceCheck,
type CheckReviewInput,
@@ -116,12 +116,6 @@ const styles = createStaticStyles(({ css }) => ({
width: min(880px, 100%);
margin-inline: auto;
`,
- work: css`
- padding: 16px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- background: ${cssVar.colorFillQuaternary};
- `,
}));
interface AcceptanceFocusReviewProps {
@@ -130,7 +124,6 @@ interface AcceptanceFocusReviewProps {
focusedCheck: AcceptanceCheck;
onAddChecks?: () => void;
onBack: () => void;
- onCheckWork?: () => void;
onDismissProposal?: (input: ProposalDismissInput) => Promise<void>;
onEditStandingCheck?: (item: AcceptanceChecklistItem) => void;
onReview: (input: CheckReviewInput) => Promise<boolean>;
@@ -150,7 +143,6 @@ const AcceptanceFocusReview = ({
focusedCheck,
onAddChecks,
onBack,
- onCheckWork,
onDismissProposal,
onEditStandingCheck,
onReview,
@@ -172,23 +164,27 @@ const AcceptanceFocusReview = ({
return (
<div className={styles.layout}>
<Flexbox className={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. */}
<Flexbox
align={md ? undefined : 'center'}
flex={'none'}
gap={md ? 10 : 0}
horizontal={!md}
- paddingBlock={8}
+ paddingBlock={md ? 8 : 0}
paddingInline={4}
>
<Button
aria-label={t('acceptance.focus.back')}
- icon={<Icon icon={ArrowLeft} />}
+ icon={<Icon icon={ArrowLeft} size={md ? undefined : 16} />}
size={'small'}
type={'text'}
style={{
alignSelf: 'flex-start',
- minHeight: md ? undefined : 44,
- minWidth: md ? undefined : 44,
+ minHeight: md ? undefined : 30,
+ minWidth: md ? undefined : 30,
}}
onClick={onBack}
>
@@ -197,9 +193,15 @@ const AcceptanceFocusReview = ({
{!md && (
<Button
aria-expanded={outlineOpen}
- icon={<Icon icon={outlineOpen ? ChevronDown : ChevronRight} />}
- style={{ height: 'auto', minHeight: 44, textAlign: 'start', whiteSpace: 'normal' }}
+ icon={<Icon icon={outlineOpen ? ChevronDown : ChevronRight} size={14} />}
+ size={'small'}
type={'text'}
+ style={{
+ fontSize: 13,
+ minHeight: 30,
+ paddingInline: 6,
+ textAlign: 'start',
+ }}
onClick={() => setOutlineOpen((open) => !open)}
>
{t('acceptance.checks.title')} · {currentIndex + 1} / {orderedChecks.length}
@@ -404,7 +406,7 @@ const AcceptanceFocusReview = ({
: CircleDashed
}
/>
- {t('acceptance.focus.verifierLabel')} ·{' '}
+ {t('acceptance.focus.judgeLabel')} ·{' '}
{t(`report.verdict.${focusedStates.verifierLabel}`)}
</Flexbox>
</Flexbox>
@@ -427,19 +429,6 @@ const AcceptanceFocusReview = ({
{t(`acceptance.focus.verifierDescription.${focusedStates.verifierLabel}`)}
</Text>
</Flexbox>
- {md && onCheckWork && isCheckWorkActionable(focusedCheck) && (
- <Flexbox horizontal align={'center'} className={styles.work} gap={16}>
- <Flexbox flex={1} gap={3}>
- <Text strong>{t('acceptance.checkWork.title')}</Text>
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.checkWork.description')}
- </Text>
- </Flexbox>
- <Button type={'primary'} onClick={onCheckWork}>
- {t('acceptance.checkWork.copy')}
- </Button>
- </Flexbox>
- )}
<FocusedCheckDetails
canReview={canReview}
check={focusedCheck}
@@ -448,15 +437,6 @@ const AcceptanceFocusReview = ({
onReview={onReview}
onRound={onRound}
/>
- {!md && onCheckWork && isCheckWorkActionable(focusedCheck) && (
- <Button
- style={{ alignSelf: 'flex-start', minHeight: 44 }}
- type={'text'}
- onClick={onCheckWork}
- >
- {t('acceptance.checkWork.copy')}
- </Button>
- )}
</Flexbox>
</Flexbox>
</div>
diff --git a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsx
index 7814736e63b..4ea56802323 100644
--- a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsx
+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusWorkspace.tsx
@@ -1,9 +1,8 @@
'use client';
-import { copyToClipboard } from '@lobehub/ui';
import { toast } from '@lobehub/ui/base-ui';
import { useTranslation } from 'react-i18next';
-import { useNavigate, useParams, useSearchParams } from 'react-router';
+import { useLocation, useNavigate, useParams, useSearchParams } from 'react-router';
import { mutate as globalMutate } from '@/libs/swr';
import { isAcceptanceListKey } from '@/libs/swr/keys';
@@ -11,7 +10,6 @@ import { verifyService } from '@/services/verify';
import { useAcceptanceScope } from '../AcceptanceScope';
import { openAddCheckModal } from '../Checks/AddCheckModal';
-import { copyCheckRepairPrompt } from '../Checks/checkWork';
import { acceptanceCheckPath, acceptanceOverviewPath } from '../routes';
import { checksForTurn } from '../turnChecks';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
@@ -22,6 +20,7 @@ import AcceptanceFocusReview from './AcceptanceFocusReview';
const AcceptanceFocusWorkspace = () => {
const { t } = useTranslation('verify');
const navigate = useNavigate();
+ const location = useLocation();
const [searchParams] = useSearchParams();
const query = searchParams.toString() ? `?${searchParams}` : '';
const params = useParams<{ checkId?: string }>();
@@ -57,9 +56,21 @@ const AcceptanceFocusWorkspace = () => {
canReview={
canReviewAcceptance(data) && (turn === null || turn === data.rounds.at(-1)?.run.roundIndex)
}
- onBack={() => navigate(acceptanceOverviewPath(acceptanceId) + query, { replace: true })}
+ // A phone opens this page by pushing onto the list, so the back arrow
+ // pops that entry — replacing it would leave a duplicate overview behind
+ // and make the system back button look broken.
+ onBack={() =>
+ (location.state as { fromCheckList?: boolean } | null)?.fromCheckList
+ ? navigate(-1)
+ : navigate(acceptanceOverviewPath(acceptanceId) + query, { replace: true })
+ }
+ // Stepping between checks replaces the entry in place, carrying the
+ // "came from the list" flag so the back arrow still knows where to land.
onSelectCheck={(id) =>
- navigate(acceptanceCheckPath(acceptanceId, id) + query, { replace: true })
+ navigate(acceptanceCheckPath(acceptanceId, id) + query, {
+ replace: true,
+ state: location.state,
+ })
}
// Checklist authoring writes through the subject — creator-only until that
// path is reviewer-aware. Reviewing the checks themselves is not.
@@ -73,14 +84,6 @@ const AcceptanceFocusWorkspace = () => {
})
: undefined
}
- onCheckWork={
- canReviewAcceptance(data) && data.acceptance.status !== 'closed'
- ? async () => {
- await copyCheckRepairPrompt(data.acceptance.id, focusedCheck, copyToClipboard);
- toast.success({ title: t('acceptance.checkWork.copied') });
- }
- : undefined
- }
onEditStandingCheck={
data.isOwner
? async (item) => {
diff --git a/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsx b/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsx
index 868bb6e5325..6bb7e2be633 100644
--- a/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsx
+++ b/src/features/Acceptance/Viewer/Review/CheckRejectModal.tsx
@@ -1,11 +1,11 @@
'use client';
import type { AcceptanceReviewAnnotation } from '@lobechat/types';
-import { Flexbox, TextArea } from '@lobehub/ui';
+import { Flexbox, Icon, TextArea } from '@lobehub/ui';
import { ActionIcon, Button, createModal, Text, useModalContext } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar, cx, useResponsive } from 'antd-style';
-import { Trash2, ZoomIn, ZoomOut } from 'lucide-react';
-import { memo, useEffect, useLayoutEffect, useRef, useState } from 'react';
+import { Crosshair, Trash2, ZoomIn, ZoomOut } from 'lucide-react';
+import { memo, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { AnnotationCanvas } from '../Evidence/Annotation';
@@ -16,6 +16,9 @@ import {
useFeedbackAttachments,
} from '../Evidence/attachments';
import { MobileEvidenceReview } from '../Evidence/MobileEvidenceReview';
+import type { MobileReviewEvent, MobileReviewStep } from '../Evidence/mobileReviewFlow';
+import { nextMobileReviewStep } from '../Evidence/mobileReviewFlow';
+import { useMeasuredWidth } from '../Evidence/useMeasuredWidth';
import { frostedModalStyles } from './modals';
import { useReviewSubmit } from './useReviewSubmit';
@@ -104,6 +107,30 @@ const styles = createStaticStyles(({ css }) => ({
padding-block-start: 12px;
border-block-start: 1px solid ${cssVar.colorBorderSecondary};
`,
+ /** The region caption on a phone: a link, not a button-shaped box. The tap
+ target comes from padding around a compact line, so a list of regions
+ does not turn into a column of 44px slabs. */
+ regionJump: css`
+ cursor: pointer;
+
+ display: inline-flex;
+ gap: 5px;
+ align-items: center;
+ align-self: flex-start;
+
+ padding-block: 7px;
+ padding-inline: 2px;
+ border: none;
+
+ font-size: 13px;
+ color: ${cssVar.colorLink};
+
+ background: none;
+
+ &:active {
+ opacity: 0.6;
+ }
+ `,
regionIndex: css`
flex: none;
@@ -324,7 +351,7 @@ export const mergeRejectComments = (initialComment = '', storedComment = '') =>
return `${initial}\n\n${stored}`;
};
-const CheckRejectModalContent = memo<CheckRejectModalProps>(
+export const CheckRejectModalContent = memo<CheckRejectModalProps>(
({
checkTitle,
draftKey,
@@ -339,8 +366,12 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
}) => {
const { t: translate } = useTranslation('verify');
const { md = true } = useResponsive();
- const [drawing, setDrawing] = useState(false);
- const [showFeedback, setShowFeedback] = useState(evidence.length === 0);
+ // Marking or panning — the phone review has no second screen to be on,
+ // so this is the only mode left. See mobileReviewFlow.
+ const [step, setStep] = useState<MobileReviewStep>('browse');
+ const advance = (event: MobileReviewEvent) =>
+ setStep((current) => nextMobileReviewStep(current, event));
+ const drawing = step === 'draw';
const swipeStart = useRef<{ x: number; y: number } | null>(null);
const { close, setCanDismissByClickOutside } = useModalContext();
const [draft] = useState(() => readDraft(draftKey));
@@ -382,33 +413,13 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
useFeedbackAttachments(6, draft?.attachments ?? previousAttachments);
const [zoom, setZoom] = useState(1);
- const viewportRef = useRef<HTMLDivElement>(null);
- const [viewportWidth, setViewportWidth] = useState<number>();
- useLayoutEffect(() => {
- if (evidence.length === 0) return;
- let observer: ResizeObserver | undefined;
- let raf = 0;
- // The Modal body mounts async (portal + open animation), so the ref may
- // be null on the first pass — retry on the next frame until it attaches,
- // then track its width. Without this the image stays fit-width and zoom
- // does nothing (viewportWidth never resolves).
- const attach = () => {
- const node = viewportRef.current;
- if (!node) {
- raf = requestAnimationFrame(attach);
- return;
- }
- const measure = () => setViewportWidth(node.clientWidth);
- measure();
- observer = new ResizeObserver(measure);
- observer.observe(node);
- };
- attach();
- return () => {
- cancelAnimationFrame(raf);
- observer?.disconnect();
- };
- }, [activeEvidenceId, evidence.length, showFeedback]);
+ // The stage node is remounted by the responsive flip, so the measurement
+ // follows the node rather than a ref captured once — see useMeasuredWidth.
+ const {
+ node: viewportNode,
+ ref: viewportRef,
+ width: viewportWidth,
+ } = useMeasuredWidth<HTMLDivElement>();
// Persist the draft as it is typed; an empty draft cleans the slot up.
useEffect(() => {
@@ -432,7 +443,7 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
if (!evidence[index]) return;
setActiveEvidenceId(evidence[index].id);
setZoom(1);
- viewportRef.current?.scrollTo(0, 0);
+ viewportNode?.scrollTo(0, 0);
};
const activeEvidence = evidence.find((item) => item.id === activeEvidenceId);
const activeAnnotations = annotations.filter((item) => item.evidenceId === activeEvidenceId);
@@ -473,10 +484,7 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
...previous,
{ comment: '', evidenceId: activeEvidence!.id, key: nextAnnotationKey(), rect },
]);
- if (!md) {
- setDrawing(false);
- setShowFeedback(true);
- }
+ advance('region-drawn');
},
onRemove: (index: number) => {
const target = activeAnnotations[index];
@@ -493,17 +501,21 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
};
const annotationInputs = (md ? activeAnnotations : annotations).map((annotation, index) => (
- <Flexbox gap={8} key={annotation.key}>
+ <Flexbox gap={4} key={annotation.key}>
{!md && (
- <Button
- style={{ alignSelf: 'flex-start', minHeight: 44 }}
- type={'text'}
+ // A caption that jumps back to its box on the image. It reads as a
+ // link — crosshair, link colour, hugging the note it labels — because
+ // a full-height text Button looked like an inert boxed heading and
+ // ate a 44px band per region.
+ <button
+ className={styles.regionJump}
+ type={'button'}
onClick={() => {
selectEvidence(evidence.findIndex((item) => item.id === annotation.evidenceId));
- setDrawing(true);
- setShowFeedback(false);
+ advance('edit-region');
}}
>
+ <Icon icon={Crosshair} size={13} />
{translate('acceptance.review.regionImage', {
image: evidence.findIndex((item) => item.id === annotation.evidenceId) + 1,
region:
@@ -511,7 +523,7 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
.filter((item) => item.evidenceId === annotation.evidenceId)
.findIndex((item) => item.key === annotation.key) + 1,
})}
- </Button>
+ </button>
)}
<Flexbox horizontal align={'flex-start'} gap={8}>
<span
@@ -652,6 +664,7 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
if (!md)
return (
<MobileEvidenceReview
+ annotationCount={activeAnnotations.length}
canSubmit={canSubmit && !uploading}
drawing={drawing}
failed={failed}
@@ -659,7 +672,6 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
imageCount={evidence.length}
imageIndex={activeIndex}
loading={loading}
- showFeedback={showFeedback}
zoom={zoom}
editor={
<Flexbox gap={16}>
@@ -692,9 +704,8 @@ const CheckRejectModalContent = memo<CheckRejectModalProps>(
</Flexbox>
}
onConfirm={handleConfirm}
- onDrawingChange={setDrawing}
onImageChange={selectEvidence}
- onShowFeedback={setShowFeedback}
+ onStep={advance}
onZoom={stepZoom}
/>
);