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.

✨ feat(acceptance): phone review gets a marking mode, side-by-side buttons, a taller preview and pinch zoom (#19735)

Arvin Xu7dd8d3545d8b
diff --git a/locales/en-US/verify.json b/locales/en-US/verify.json
index afad393817e..e97976f8dd1 100644
--- a/locales/en-US/verify.json
+++ b/locales/en-US/verify.json
@@ -242,7 +242,7 @@
"acceptance.review.attachLimit": "Up to {{count}} screenshots.",
"acceptance.review.attachTooLarge": "The image is too large (10MB max).",
"acceptance.review.backToImages": "Back to images",
- "acceptance.review.browseImage": "Browse",
+ "acceptance.review.confirmRegions": "Done",
"acceptance.review.confirmReject": "Submit feedback",
"acceptance.review.detailPlaceholder": "Leave a comment for this check. It will be submitted with your decision…",
"acceptance.review.draftSaved": "Your draft is saved on this device.",
@@ -254,9 +254,7 @@
"acceptance.review.ignore": "Ignore",
"acceptance.review.ignoredNote": "Ignored · {{time}}",
"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.mobileRegionCommentsEmpty": "Drag on the image above to mark a region; its comment lands here.",
"acceptance.review.nextImage": "Next image",
"acceptance.review.previousImage": "Previous image",
"acceptance.review.regionComments": "Region comments",
@@ -272,6 +270,8 @@
"acceptance.review.revertToReject": "Change to reject with comment",
"acceptance.review.submitFailed": "Could not submit. Your draft is saved; please try again.",
"acceptance.review.supplement": "Additional notes (optional)",
+ "acceptance.review.supplementButton": "Notes",
+ "acceptance.review.supplementButtonDraft": "Notes · draft saved",
"acceptance.review.writeFeedback": "Write feedback",
"acceptance.review.zoomIn": "Zoom in",
"acceptance.review.zoomOut": "Zoom out",
diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.json
index be4171153f9..e8b270bedd9 100644
--- a/locales/zh-CN/verify.json
+++ b/locales/zh-CN/verify.json
@@ -242,7 +242,7 @@
"acceptance.review.attachLimit": "最多添加 {{count}} 张截图。",
"acceptance.review.attachTooLarge": "图片过大(最大 10MB)。",
"acceptance.review.backToImages": "返回图片",
- "acceptance.review.browseImage": "浏览图片",
+ "acceptance.review.confirmRegions": "确认",
"acceptance.review.confirmReject": "提交反馈",
"acceptance.review.detailPlaceholder": "留下对该检查项的评论,提交审核决定时会一并发送…",
"acceptance.review.draftSaved": "草稿会保存在此设备,关闭后可继续填写。",
@@ -254,9 +254,7 @@
"acceptance.review.ignore": "忽略",
"acceptance.review.ignoredNote": "已于 {{time}} 忽略,不再参与验收",
"acceptance.review.imageNumber": "图片 {{current}} / {{total}}",
- "acceptance.review.mobileBrowseHint": "左右切图 · 上下阅读",
- "acceptance.review.mobileDrawHint": "拖动圈选问题区域",
- "acceptance.review.mobileDrawnHint": "已圈选 {{count}} 处 · 拖动可移动,右下角圆点可缩放",
+ "acceptance.review.mobileRegionCommentsEmpty": "在上方图片上拖动圈出区域,评论会出现在这里。",
"acceptance.review.nextImage": "下一张图片",
"acceptance.review.previousImage": "上一张图片",
"acceptance.review.regionComments": "圈选评论",
@@ -272,6 +270,8 @@
"acceptance.review.revertToReject": "改为拒绝并评论",
"acceptance.review.submitFailed": "提交失败,草稿已保留,请重试。",
"acceptance.review.supplement": "补充说明(可选)",
+ "acceptance.review.supplementButton": "补充说明",
+ "acceptance.review.supplementButtonDraft": "补充说明 · 有草稿",
"acceptance.review.writeFeedback": "填写反馈",
"acceptance.review.zoomIn": "放大",
"acceptance.review.zoomOut": "缩小",
diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.ts
index d579eb3f43c..98d91d6296c 100644
--- a/packages/locales/src/default/verify.ts
+++ b/packages/locales/src/default/verify.ts
@@ -14,10 +14,8 @@ export default {
'This is a past round. Return to all rounds to review the current delivery.',
'acceptance.review.backToImages': 'Back to images',
'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.mobileRegionCommentsEmpty':
+ 'Drag on the image above to mark a region; its comment lands here.',
'acceptance.review.draftSaved': 'Your draft is saved on this device.',
'acceptance.review.removeAttachment': 'Remove attachment',
'acceptance.review.regionImage': 'Image {{image}} · Region {{region}}',
@@ -28,7 +26,6 @@ export default {
'acceptance.review.nextImage': 'Next image',
'acceptance.review.imageNumber': 'Image {{current}} / {{total}}',
'acceptance.review.drawRegion': 'Draw region',
- 'acceptance.review.browseImage': 'Browse',
'flow.expandGroup': 'Expand {{title}}',
'flow.collapseGroup': 'Collapse {{title}}',
'flow.enterGroup': 'Open {{title}}',
@@ -375,6 +372,7 @@ export default {
'acceptance.review.attachFailed': 'Screenshot upload failed — please try again.',
'acceptance.review.attachLimit': 'Up to {{count}} screenshots.',
'acceptance.review.attachTooLarge': 'The image is too large (10MB max).',
+ 'acceptance.review.confirmRegions': 'Done',
'acceptance.review.confirmReject': 'Submit feedback',
'acceptance.review.detailPlaceholder':
'Leave a comment for this check. It will be submitted with your decision…',
@@ -395,6 +393,8 @@ export default {
'acceptance.review.revertToAccept': 'Undo send-back · mark accepted',
'acceptance.review.revertToReject': 'Change to reject with comment',
'acceptance.review.supplement': 'Additional notes (optional)',
+ 'acceptance.review.supplementButton': 'Notes',
+ 'acceptance.review.supplementButtonDraft': 'Notes · draft saved',
'acceptance.requirementEmpty': 'No acceptance goal recorded for this subject yet.',
'acceptance.requirementEmptyEditable': 'No acceptance goal yet — click to add one.',
'acceptance.requirementLabel': 'Acceptance goal',
diff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx
index 80d55f4fec6..7180c46fa6b 100644
--- a/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx
@@ -7,6 +7,7 @@ import { memo, useEffect, useRef } from 'react';
import type { DraftAnnotation } from './Annotation';
import { AnnotationCanvas } from './Annotation';
import { useMeasuredWidth } from './useMeasuredWidth';
+import { usePinchZoom } from './usePinchZoom';
type Rect = AcceptanceReviewAnnotation['rect'];
@@ -47,6 +48,8 @@ interface EvidenceStageProps {
/** Step to the previous (-1) or next (1) image. Touch only. */
onSwipe?: (direction: 1 | -1) => void;
onUpdate: (index: number, rect: Rect) => void;
+ /** Two-finger zoom. Touch only; absent on the desktop stage. */
+ onZoom?: (zoom: number) => void;
src: string;
/** Coarse pointer: allow page panning and swipe-to-switch at 1x. */
touch?: boolean;
@@ -62,8 +65,9 @@ interface EvidenceStageProps {
* the moment the layout swaps (see useMeasuredWidth).
*/
export const EvidenceStage = memo<EvidenceStageProps>(
- ({ annotations, drawing, onDraw, onRemove, onSwipe, onUpdate, src, touch, zoom }) => {
+ ({ annotations, drawing, onDraw, onRemove, onSwipe, onUpdate, onZoom, src, touch, zoom }) => {
const { node, ref, width } = useMeasuredWidth<HTMLDivElement>();
+ const pinch = usePinchZoom({ node, onZoom: touch ? onZoom : undefined, zoom });
const swipeStart = useRef<{ x: number; y: number } | null>(null);
const canSwipe = Boolean(touch && onSwipe) && !drawing && zoom === 1;
@@ -77,8 +81,21 @@ export const EvidenceStage = memo<EvidenceStageProps>(
<div
className={styles.viewport}
ref={ref}
- style={{ touchAction: canSwipe ? 'pan-y pinch-zoom' : undefined }}
+ // With our own pinch the browser must not zoom the page on two
+ // fingers; without it, leave the native gesture alone.
+ style={{
+ touchAction: onZoom
+ ? canSwipe
+ ? 'pan-y'
+ : 'pan-x pan-y'
+ : canSwipe
+ ? 'pan-y pinch-zoom'
+ : undefined,
+ }}
+ onTouchCancel={pinch.handlers.onTouchCancel}
+ onTouchMove={pinch.handlers.onTouchMove}
onTouchEnd={(event) => {
+ pinch.handlers.onTouchEnd?.(event);
const start = swipeStart.current;
swipeStart.current = null;
const point = event.changedTouches[0];
@@ -89,6 +106,7 @@ export const EvidenceStage = memo<EvidenceStageProps>(
onSwipe?.(dx < 0 ? 1 : -1);
}}
onTouchStart={(event) => {
+ pinch.handlers.onTouchStart?.(event);
const point = event.touches[0];
swipeStart.current =
canSwipe && event.touches.length === 1 ? { x: point.clientX, y: point.clientY } : null;
diff --git a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.test.tsx b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.test.tsx
new file mode 100644
index 00000000000..f846d84d612
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.test.tsx
@@ -0,0 +1,234 @@
+import { cleanup, fireEvent, render, screen } from '@testing-library/react';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+import type { RejectReviewModel } from '../Review/useRejectReview';
+import { MobileEvidenceReview } from './MobileEvidenceReview';
+
+vi.mock('./attachments', () => ({
+ AttachmentUploadButton: (props: { disabled?: boolean }) => (
+ <button disabled={props.disabled} type={'button'}>
+ upload-stub
+ </button>
+ ),
+ AttachmentStrip: ({ attachments }: { attachments: { id: string; name: string }[] }) =>
+ attachments.length > 0 ? (
+ <div>
+ {attachments.map((item) => (
+ <div key={item.id}>{item.name}</div>
+ ))}
+ </div>
+ ) : null,
+}));
+
+// The image stage measures itself and draws on a canvas — neither exists in
+// jsdom, and neither is what these tests are about.
+vi.mock('./EvidenceStage', () => ({
+ EvidenceStage: () => <div>stage-stub</div>,
+}));
+
+afterEach(cleanup);
+
+const evidenceItem = { fileUrl: 'https://example.com/shot.png', id: 'e1' };
+const region = { comment: '', evidenceId: 'e1', key: 1, rect: { x: 1, y: 2, width: 3, height: 4 } };
+
+const buildModel = (overrides: Partial<RejectReviewModel> = {}): RejectReviewModel =>
+ ({
+ activeAnnotations: [],
+ activeEvidence: undefined,
+ activeIndex: -1,
+ annotations: [],
+ attachments: [],
+ canSubmit: false,
+ canvas: { onDraw: vi.fn(), onRemove: vi.fn(), onUpdate: vi.fn() },
+ comment: '',
+ drawing: false,
+ evidence: [],
+ failed: false,
+ handlePaste: vi.fn(),
+ hasEvidence: false,
+ loading: false,
+ uploading: false,
+ zoom: 1,
+ advance: vi.fn(),
+ close: vi.fn(),
+ editAnnotation: vi.fn(),
+ jumpToRegion: vi.fn(),
+ removeAnnotation: vi.fn(),
+ removeAttachment: vi.fn(),
+ selectEvidence: vi.fn(),
+ setComment: vi.fn(),
+ setZoom: vi.fn(),
+ stepZoom: vi.fn(),
+ submitReject: vi.fn(),
+ uploadFiles: vi.fn(),
+ ...overrides,
+ }) as RejectReviewModel;
+
+const withImage = (overrides: Partial<RejectReviewModel> = {}) =>
+ buildModel({
+ activeEvidence: evidenceItem,
+ activeIndex: 0,
+ evidence: [evidenceItem],
+ hasEvidence: true,
+ ...overrides,
+ });
+
+const supplementButton = () =>
+ screen.queryByRole('button', { name: /acceptance\.review\.supplementButton/ });
+const supplementField = () =>
+ screen.queryByRole('textbox', { name: 'acceptance.review.supplement' });
+const drawButton = () => screen.queryByRole('button', { name: 'acceptance.review.drawRegion' });
+const doneButton = () => screen.queryByRole('button', { name: 'acceptance.review.confirmRegions' });
+const submitButton = () =>
+ screen.queryByRole('button', { name: 'acceptance.review.confirmReject' });
+
+describe('MobileEvidenceReview notes button', () => {
+ it('keeps the notes closed by default and opens them on tap', () => {
+ render(<MobileEvidenceReview model={buildModel()} />);
+
+ // Closed: the field is not on the page; the button says so itself.
+ expect(supplementButton()).toHaveAttribute('aria-expanded', 'false');
+ expect(supplementButton()).toHaveTextContent('acceptance.review.supplementButton');
+ expect(supplementField()).not.toBeInTheDocument();
+
+ // Tapping the button opens the field in place.
+ fireEvent.click(supplementButton()!);
+ expect(supplementButton()).toHaveAttribute('aria-expanded', 'true');
+ expect(supplementField()).toBeInTheDocument();
+ expect(screen.getByText('upload-stub')).toBeInTheDocument();
+ });
+
+ it('continues the reviewer action after opening: typing lands in the model', () => {
+ const setComment = vi.fn();
+ render(<MobileEvidenceReview model={buildModel({ setComment })} />);
+
+ fireEvent.click(supplementButton()!);
+ fireEvent.change(supplementField()!, { target: { value: 'wrong color here' } });
+
+ expect(setComment).toHaveBeenCalledWith('wrong color here');
+ });
+
+ it('closes on a second tap, keeping the button honest about saved content', () => {
+ render(<MobileEvidenceReview model={buildModel({ comment: 'already typed' })} />);
+
+ // A restored draft opens itself — never hide words the user wrote.
+ expect(supplementField()).toBeInTheDocument();
+
+ fireEvent.click(supplementButton()!);
+ expect(supplementField()).not.toBeInTheDocument();
+ // The closed button names the draft instead of the plain label.
+ expect(supplementButton()).toHaveTextContent('acceptance.review.supplementButtonDraft');
+ });
+
+ it('auto-opens when screenshots are already attached', () => {
+ render(
+ <MobileEvidenceReview
+ model={buildModel({
+ attachments: [{ id: 'att-1', name: 'shot.png', url: 'https://example.com/a.png' }],
+ })}
+ />,
+ );
+
+ expect(supplementField()).toBeInTheDocument();
+ });
+
+ it('keeps marked regions visible without auto-opening the notes', () => {
+ render(<MobileEvidenceReview model={buildModel({ annotations: [region] })} />);
+
+ // Regions have their own always-visible section; the notes stay closed.
+ expect(screen.getByText('acceptance.review.regionComments')).toBeInTheDocument();
+ expect(supplementField()).not.toBeInTheDocument();
+ expect(supplementButton()).toHaveAttribute('aria-expanded', 'false');
+ });
+});
+
+describe('MobileEvidenceReview image switcher', () => {
+ it('keeps one full-width control under the image: arrows at the edges, zoom in the middle', () => {
+ const stepZoom = vi.fn();
+ render(<MobileEvidenceReview model={withImage({ stepZoom, zoom: 1.5 })} />);
+
+ // The control follows the stage instead of sitting above it.
+ const stage = screen.getByText('stage-stub');
+ const next = screen.getByRole('button', { name: 'acceptance.review.nextImage' });
+ expect(stage.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ expect(
+ screen.getByRole('button', { name: 'acceptance.review.previousImage' }),
+ ).toBeInTheDocument();
+
+ // The zoom sits between the arrows and reads the model's zoom, whether a
+ // pinch or a button set it; the buttons step from there.
+ expect(screen.getByText('150%')).toBeInTheDocument();
+ fireEvent.click(screen.getByRole('button', { name: 'acceptance.review.zoomIn' }));
+ expect(stepZoom).toHaveBeenCalledWith(1);
+ fireEvent.click(screen.getByRole('button', { name: 'acceptance.review.zoomOut' }));
+ expect(stepZoom).toHaveBeenCalledWith(-1);
+
+ // No explanatory copy and no image counter — the arrows say where you are.
+ expect(screen.queryByText('acceptance.review.mobileBrowseHint')).toBeNull();
+ expect(screen.queryByText('acceptance.review.imageNumber')).toBeNull();
+ });
+
+ it('disables the zoom buttons at the ends of the range', () => {
+ const { unmount } = render(<MobileEvidenceReview model={withImage({ zoom: 0.5 })} />);
+ expect(screen.getByRole('button', { name: 'acceptance.review.zoomOut' })).toBeDisabled();
+ expect(screen.getByRole('button', { name: 'acceptance.review.zoomIn' })).toBeEnabled();
+ unmount();
+
+ render(<MobileEvidenceReview model={withImage({ zoom: 4 })} />);
+ expect(screen.getByRole('button', { name: 'acceptance.review.zoomIn' })).toBeDisabled();
+ expect(screen.getByRole('button', { name: 'acceptance.review.zoomOut' })).toBeEnabled();
+ });
+});
+
+describe('MobileEvidenceReview marking mode', () => {
+ it('enters marking mode from the button beside the notes button', () => {
+ const advance = vi.fn();
+ render(<MobileEvidenceReview model={withImage({ advance })} />);
+
+ expect(drawButton()).toBeInTheDocument();
+ expect(supplementButton()).toBeInTheDocument();
+
+ fireEvent.click(drawButton()!);
+ expect(advance).toHaveBeenCalledWith('toggle-draw');
+ });
+
+ it('swaps everything under the image for the region comments and a Done button', () => {
+ const advance = vi.fn();
+ render(<MobileEvidenceReview model={withImage({ advance, drawing: true })} />);
+
+ // The two-button row, the note and the submit all step aside.
+ expect(drawButton()).not.toBeInTheDocument();
+ expect(supplementButton()).not.toBeInTheDocument();
+ expect(submitButton()).not.toBeInTheDocument();
+
+ // What is left is about the regions: the list (empty so far) and the hint.
+ expect(screen.getByText('acceptance.review.regionComments')).toBeInTheDocument();
+ expect(screen.getByText('acceptance.review.mobileRegionCommentsEmpty')).toBeInTheDocument();
+ expect(screen.queryByText('acceptance.review.mobileDrawHint')).toBeNull();
+
+ // Done leaves the mode; the regions themselves are the model's to keep.
+ fireEvent.click(doneButton()!);
+ expect(advance).toHaveBeenCalledWith('toggle-draw');
+ });
+
+ it('lists the circled regions for their notes while marking', () => {
+ render(
+ <MobileEvidenceReview
+ model={withImage({ activeAnnotations: [region], annotations: [region], drawing: true })}
+ />,
+ );
+
+ expect(screen.queryByText('acceptance.review.mobileRegionCommentsEmpty')).toBeNull();
+ expect(
+ screen.getByRole('textbox', { name: 'acceptance.review.annotationPlaceholder' }),
+ ).toBeInTheDocument();
+ });
+
+ it('has no marking entry when there is no image to draw on', () => {
+ render(<MobileEvidenceReview model={buildModel()} />);
+
+ expect(drawButton()).not.toBeInTheDocument();
+ expect(supplementButton()).toBeInTheDocument();
+ expect(submitButton()).toBeInTheDocument();
+ });
+});
diff --git a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
index da981166495..05dc8928170 100644
--- a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
@@ -1,10 +1,10 @@
'use client';
-import { Flexbox, TextArea } from '@lobehub/ui';
-import { ActionIcon, Button, Segmented, Text } from '@lobehub/ui/base-ui';
+import { TextArea } from '@lobehub/ui';
+import { ActionIcon, Button, Text } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
-import { ChevronLeft, ChevronRight, ZoomIn, ZoomOut } from 'lucide-react';
-import { memo } from 'react';
+import { ChevronLeft, ChevronRight, NotebookPen, PencilLine, ZoomIn, ZoomOut } from 'lucide-react';
+import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ZOOM_STEPS } from '../Review/rejectDraft';
@@ -34,13 +34,45 @@ const styles = createStaticStyles(({ css }) => ({
min-height: 0;
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. */
+ /** The image is what the reviewer came to look at, so it takes every pixel
+ the rows below it do not need. When the notes open underneath, it yields
+ down to a floor that still leaves room to circle on, then the page scrolls. */
stage: css`
+ display: flex;
+ flex: 1 1 auto;
+ min-height: 40dvh;
+ `,
+ /** One full-width control under the image: the image arrows at the two
+ edges where a thumb lands, the zoom (minus, percentage, plus) between
+ them. Two fingers set the zoom too; the buttons show where it landed. */
+ switcher: css`
display: flex;
flex: none;
- height: 42dvh;
- min-height: 220px;
+ align-items: center;
+
+ width: 100%;
+ min-height: 44px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+ `,
+ zoom: css`
+ display: flex;
+ flex: 1;
+ gap: 4px;
+ align-items: center;
+ justify-content: center;
+ `,
+ /** Two equal thumb-sized buttons: what to do next with the image, and where
+ the written note goes. */
+ actions: css`
+ display: flex;
+ flex: none;
+ gap: 8px;
+
+ > button {
+ flex: 1;
+ min-height: 44px;
+ }
`,
editor: css`
display: flex;
@@ -72,6 +104,11 @@ const styles = createStaticStyles(({ css }) => ({
/**
* Phone review on one page: look at the image, circle what is wrong, and write
* the note right where the circle landed.
+ *
+ * Marking is a mode of its own. While it is on, everything under the image is
+ * about the regions — the list of circled comments and a Done button — so the
+ * reviewer is never asked to type a general note or submit halfway through a
+ * drag. Leaving the mode brings back the two-button row and the submit.
*/
export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model }) => {
const { t } = useTranslation('verify');
@@ -93,33 +130,42 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
zoom,
} = model;
+ // The supplement stays closed until asked for — the reject's substance is the
+ // marked regions, and the phone should not scroll past an empty textarea to
+ // reach the submit button. It opens itself when there is already text or
+ // screenshots to show (a restored draft, a paste, prior feedback) — hidden
+ // content the user cannot see is feedback waiting to be lost. Marked regions
+ // stay out of this: they have their own region-comments section.
+ const [supplementExpanded, setSupplementExpanded] = useState(() =>
+ Boolean(comment.trim() || attachments.length > 0),
+ );
+ const hasSupplementContent = comment.trim().length > 0 || attachments.length > 0;
+ const hasRegionContent = annotations.length > 0;
+
+ const regionNotes = (
+ <>
+ <Text strong>{t('acceptance.review.regionComments')}</Text>
+ {hasRegionContent ? (
+ <MobileRegionNotes
+ annotations={annotations}
+ evidence={evidence}
+ onChange={model.editAnnotation}
+ onJump={model.jumpToRegion}
+ onRemove={model.removeAnnotation}
+ />
+ ) : (
+ <Text fontSize={13} type={'secondary'}>
+ {t('acceptance.review.mobileRegionCommentsEmpty')}
+ </Text>
+ )}
+ </>
+ );
+
return (
<div className={styles.body}>
<div className={styles.scroll}>
{activeEvidence && (
<>
- <Flexbox horizontal align={'center'} gap={8} style={{ flex: 'none' }}>
- <ActionIcon
- aria-label={t('acceptance.review.previousImage')}
- disabled={activeIndex <= 0}
- icon={ChevronLeft}
- size={{ blockSize: 44, size: 20 }}
- onClick={() => model.selectEvidence(activeIndex - 1)}
- />
- <Text aria-live={'polite'} style={{ flex: 1, textAlign: 'center' }}>
- {t('acceptance.review.imageNumber', {
- current: activeIndex + 1,
- total: evidence.length,
- })}
- </Text>
- <ActionIcon
- aria-label={t('acceptance.review.nextImage')}
- disabled={activeIndex >= evidence.length - 1}
- icon={ChevronRight}
- size={{ blockSize: 44, size: 20 }}
- onClick={() => model.selectEvidence(activeIndex + 1)}
- />
- </Flexbox>
<div className={styles.stage}>
<EvidenceStage
touch
@@ -131,102 +177,137 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
onRemove={canvas.onRemove}
onSwipe={(direction) => model.selectEvidence(activeIndex + direction)}
onUpdate={canvas.onUpdate}
+ onZoom={model.setZoom}
/>
</div>
- <Flexbox horizontal align={'center'} gap={8} style={{ flex: 'none' }}>
- {/* A mode switch, not an action button. A single button labelled
- with the mode it would LEAVE says nothing about which mode is
- on, and its 44px slab sat oddly beside the small zoom icons. */}
- <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) model.advance('toggle-draw');
- }}
- />
- <Flexbox flex={1} />
+ {/* One full-width block under the stage: previous / next at the
+ edges, the zoom in the middle. No hint text — the phone shows,
+ it does not explain. The percentage is what a pinch landed on;
+ the buttons step from there to the next notch. */}
+ <div className={styles.switcher}>
<ActionIcon
- aria-label={t('acceptance.review.zoomOut')}
- disabled={zoom <= ZOOM_STEPS[0]}
- icon={ZoomOut}
+ aria-label={t('acceptance.review.previousImage')}
+ disabled={activeIndex <= 0}
+ icon={ChevronLeft}
size={{ blockSize: 44, size: 20 }}
- onClick={() => model.stepZoom(-1)}
+ onClick={() => model.selectEvidence(activeIndex - 1)}
/>
- <Text fontSize={12}>{Math.round(zoom * 100)}%</Text>
+ <div className={styles.zoom}>
+ <ActionIcon
+ aria-label={t('acceptance.review.zoomOut')}
+ disabled={zoom <= ZOOM_STEPS[0]}
+ icon={ZoomOut}
+ size={{ blockSize: 44, size: 20 }}
+ onClick={() => model.stepZoom(-1)}
+ />
+ <Text
+ aria-live={'polite'}
+ fontSize={13}
+ style={{ minWidth: 44, textAlign: 'center' }}
+ >
+ {Math.round(zoom * 100)}%
+ </Text>
+ <ActionIcon
+ aria-label={t('acceptance.review.zoomIn')}
+ disabled={zoom >= ZOOM_STEPS.at(-1)!}
+ icon={ZoomIn}
+ size={{ blockSize: 44, size: 20 }}
+ onClick={() => model.stepZoom(1)}
+ />
+ </div>
<ActionIcon
- aria-label={t('acceptance.review.zoomIn')}
- disabled={zoom >= ZOOM_STEPS.at(-1)!}
- icon={ZoomIn}
+ aria-label={t('acceptance.review.nextImage')}
+ disabled={activeIndex >= evidence.length - 1}
+ icon={ChevronRight}
size={{ blockSize: 44, size: 20 }}
- onClick={() => model.stepZoom(1)}
+ onClick={() => model.selectEvidence(activeIndex + 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 && activeAnnotations.length > 0
- ? t('acceptance.review.mobileDrawnHint', { count: activeAnnotations.length })
- : t(
- drawing
- ? 'acceptance.review.mobileDrawHint'
- : 'acceptance.review.mobileBrowseHint',
- )}
- </Text>
+ </div>
+ </>
+ )}
+ {drawing ? (
+ // Marking mode: the circled comments are the whole story below the
+ // image — each new box lands here, ready for its note.
+ <div className={styles.editor}>{regionNotes}</div>
+ ) : (
+ <>
+ {/* Two buttons side by side: one enters marking mode, the other
+ discloses the written note below. The open state is a light
+ fill, not the primary slab — it marks which panel is open, it
+ is not the page's action. */}
+ <div className={styles.actions}>
+ {activeEvidence && (
+ <Button icon={PencilLine} onClick={() => model.advance('toggle-draw')}>
+ {t('acceptance.review.drawRegion')}
+ </Button>
+ )}
+ <Button
+ aria-expanded={supplementExpanded}
+ icon={NotebookPen}
+ type={supplementExpanded ? 'fill' : 'default'}
+ onClick={() => setSupplementExpanded((open) => !open)}
+ >
+ {hasSupplementContent && !supplementExpanded
+ ? t('acceptance.review.supplementButtonDraft')
+ : t('acceptance.review.supplementButton')}
+ </Button>
+ </div>
+ {(hasRegionContent || supplementExpanded) && (
+ <div className={styles.editor}>
+ {hasRegionContent && regionNotes}
+ {supplementExpanded && (
+ <>
+ <Text strong>{t('acceptance.review.supplement')}</Text>
+ <TextArea
+ aria-label={t('acceptance.review.supplement')}
+ autoSize={{ maxRows: 10, minRows: 4 }}
+ placeholder={t('acceptance.review.rejectPlaceholder')}
+ style={{ fontSize: 16 }}
+ value={comment}
+ onChange={(event) => model.setComment(event.target.value)}
+ onPaste={handlePaste}
+ />
+ <AttachmentUploadButton disabled={loading} onFiles={model.uploadFiles} />
+ <AttachmentStrip
+ attachments={attachments}
+ disabled={loading}
+ uploading={uploading}
+ onRemove={model.removeAttachment}
+ />
+ <Text fontSize={12} type={'secondary'}>
+ {t('acceptance.review.draftSaved')}
+ </Text>
+ </>
+ )}
+ </div>
+ )}
</>
)}
- <div className={styles.editor}>
- {annotations.length > 0 && (
- <>
- <Text strong>{t('acceptance.review.regionComments')}</Text>
- <MobileRegionNotes
- annotations={annotations}
- evidence={evidence}
- onChange={model.editAnnotation}
- onJump={model.jumpToRegion}
- onRemove={model.removeAnnotation}
- />
- </>
- )}
- <Text strong>{t('acceptance.review.supplement')}</Text>
- <TextArea
- aria-label={t('acceptance.review.supplement')}
- autoSize={{ maxRows: 10, minRows: 4 }}
- placeholder={t('acceptance.review.rejectPlaceholder')}
- style={{ fontSize: 16 }}
- value={comment}
- onChange={(event) => model.setComment(event.target.value)}
- onPaste={handlePaste}
- />
- <AttachmentUploadButton disabled={loading} onFiles={model.uploadFiles} />
- <AttachmentStrip
- attachments={attachments}
- disabled={loading}
- uploading={uploading}
- onRemove={model.removeAttachment}
- />
- <Text fontSize={12} type={'secondary'}>
- {t('acceptance.review.draftSaved')}
- </Text>
- </div>
</div>
<div className={styles.footer}>
- {failed && (
- <Text role={'alert'} type={'danger'}>
- {t('acceptance.review.submitFailed')}
- </Text>
+ {drawing ? (
+ // Done closes marking mode; the boxes and their notes stay. The
+ // submit only comes back once the reviewer is out of the mode.
+ <Button type={'primary'} onClick={() => model.advance('toggle-draw')}>
+ {t('acceptance.review.confirmRegions')}
+ </Button>
+ ) : (
+ <>
+ {failed && (
+ <Text role={'alert'} type={'danger'}>
+ {t('acceptance.review.submitFailed')}
+ </Text>
+ )}
+ <Button
+ disabled={!canSubmit}
+ loading={loading}
+ type={'primary'}
+ onClick={model.submitReject}
+ >
+ {t('acceptance.review.confirmReject')}
+ </Button>
+ </>
)}
- <Button
- disabled={!canSubmit}
- loading={loading}
- type={'primary'}
- onClick={model.submitReject}
- >
- {t('acceptance.review.confirmReject')}
- </Button>
</div>
</div>
);
diff --git a/src/features/Acceptance/Viewer/Evidence/pinchZoom.test.ts b/src/features/Acceptance/Viewer/Evidence/pinchZoom.test.ts
new file mode 100644
index 00000000000..529274a8bf7
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Evidence/pinchZoom.test.ts
@@ -0,0 +1,44 @@
+import { describe, expect, it } from 'vitest';
+
+import { anchoredScroll, pinchedZoom, touchDistance, touchMidpoint } from './pinchZoom';
+
+describe('pinchedZoom', () => {
+ it('scales the zoom at pinch start by how far the fingers spread', () => {
+ expect(pinchedZoom(1, 100, 150, 0.5, 4)).toBeCloseTo(1.5);
+ expect(pinchedZoom(2, 100, 50, 0.5, 4)).toBeCloseTo(1);
+ });
+
+ it('starts from the zoom the buttons had already set', () => {
+ expect(pinchedZoom(1.5, 80, 160, 0.5, 4)).toBeCloseTo(3);
+ });
+
+ it('never leaves the range the zoom buttons can reach', () => {
+ expect(pinchedZoom(1, 100, 1000, 0.5, 4)).toBe(4);
+ expect(pinchedZoom(1, 100, 10, 0.5, 4)).toBe(0.5);
+ });
+
+ it('holds still when the start distance is degenerate', () => {
+ expect(pinchedZoom(1.5, 0, 120, 0.5, 4)).toBe(1.5);
+ });
+});
+
+describe('anchoredScroll', () => {
+ it('keeps the point under the fingers in place while the content grows', () => {
+ // Anchor 100px into the viewport, content already scrolled 50px: the
+ // content point under the anchor sits at 150px. At 2x it sits at 300px, so
+ // the scroll must move to 300 - 100 = 200 for it to stay under the finger.
+ expect(anchoredScroll(50, 100, 2)).toBe(200);
+ });
+
+ it('shrinking anchors the same way and never scrolls past the origin', () => {
+ expect(anchoredScroll(200, 100, 0.5)).toBe(50);
+ expect(anchoredScroll(0, 100, 0.5)).toBe(0);
+ });
+});
+
+describe('touch geometry', () => {
+ it('measures the distance and midpoint between two fingers', () => {
+ expect(touchDistance({ x: 0, y: 0 }, { x: 3, y: 4 })).toBe(5);
+ expect(touchMidpoint({ x: 0, y: 0 }, { x: 10, y: 20 })).toEqual({ x: 5, y: 10 });
+ });
+});
diff --git a/src/features/Acceptance/Viewer/Evidence/pinchZoom.ts b/src/features/Acceptance/Viewer/Evidence/pinchZoom.ts
new file mode 100644
index 00000000000..2b8c7144641
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Evidence/pinchZoom.ts
@@ -0,0 +1,40 @@
+/**
+ * The arithmetic of a two-finger zoom, kept apart from the touch plumbing so
+ * it can be checked without a browser.
+ */
+
+export interface Point {
+ x: number;
+ y: number;
+}
+
+export const touchDistance = (a: Point, b: Point) => Math.hypot(a.x - b.x, a.y - b.y);
+
+export const touchMidpoint = (a: Point, b: Point): Point => ({
+ x: (a.x + b.x) / 2,
+ y: (a.y + b.y) / 2,
+});
+
+/**
+ * The zoom a pinch has reached: the zoom at the moment the second finger
+ * landed, scaled by how far the fingers have spread since, clamped to the
+ * range the zoom buttons can reach.
+ */
+export const pinchedZoom = (
+ startZoom: number,
+ startDistance: number,
+ distance: number,
+ min: number,
+ max: number,
+) => {
+ if (startDistance <= 0) return startZoom;
+ return Math.min(Math.max(startZoom * (distance / startDistance), min), max);
+};
+
+/**
+ * Keep the point under the fingers where it was after the content grew by
+ * `ratio`: the anchor's distance from the content origin scales, the anchor's
+ * place on screen must not.
+ */
+export const anchoredScroll = (scroll: number, anchor: number, ratio: number) =>
+ Math.max((scroll + anchor) * ratio - anchor, 0);
diff --git a/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.test.ts b/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.test.ts
index f5653d2dccf..37a32d63be8 100644
--- a/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.test.ts
+++ b/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.test.ts
@@ -5,11 +5,12 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
import { useAnnotationGesture } from './useAnnotationGesture';
-const pointer = (x: number, y: number) =>
+const pointer = (x: number, y: number, isPrimary = true) =>
({
clientX: x,
clientY: y,
- pointerId: 7,
+ isPrimary,
+ pointerId: isPrimary ? 7 : 8,
pointerType: 'touch',
currentTarget: { setPointerCapture: vi.fn() },
preventDefault: vi.fn(),
@@ -112,4 +113,17 @@ describe('touch annotation gestures', () => {
expect(start.currentTarget.setPointerCapture).not.toHaveBeenCalled();
expect(onDraw).not.toHaveBeenCalled();
});
+
+ it('drops the box in progress when a second finger lands (that is a pinch)', () => {
+ const { result, onDraw } = setup(true, 200, 400);
+ act(() => result.current.handlers.onPointerDown(pointer(30, 40)));
+ act(() => result.current.handlers.onPointerMove(pointer(90, 140)));
+ expect(result.current.draft).not.toBeNull();
+
+ act(() => result.current.handlers.onPointerDown(pointer(150, 200, false)));
+ expect(result.current.draft).toBeNull();
+
+ act(() => result.current.handlers.onPointerUp(pointer(120, 180)));
+ expect(onDraw).not.toHaveBeenCalled();
+ });
});
diff --git a/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.ts b/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.ts
index 9b429e2d8d7..825563a3e0d 100644
--- a/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.ts
+++ b/src/features/Acceptance/Viewer/Evidence/useAnnotationGesture.ts
@@ -79,6 +79,13 @@ export const useAnnotationGesture = ({
},
onPointerUp: endGesture,
onPointerDown: (event: PointerEvent<HTMLDivElement>) => {
+ // A second finger means a pinch, not a box: drop whatever the first
+ // finger had started so the zoom does not leave a sliver of a region.
+ if (!event.isPrimary) {
+ gestureRef.current = null;
+ setDraft(null);
+ return;
+ }
if (!drawing) return;
event.currentTarget.setPointerCapture(event.pointerId);
event.preventDefault();
diff --git a/src/features/Acceptance/Viewer/Evidence/usePinchZoom.ts b/src/features/Acceptance/Viewer/Evidence/usePinchZoom.ts
new file mode 100644
index 00000000000..29b712d4ed1
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Evidence/usePinchZoom.ts
@@ -0,0 +1,84 @@
+import type { TouchEvent } from 'react';
+import { useLayoutEffect, useRef } from 'react';
+
+import { ZOOM_STEPS } from '../Review/rejectDraft';
+import { anchoredScroll, pinchedZoom, touchDistance, touchMidpoint } from './pinchZoom';
+
+interface UsePinchZoomInput {
+ /** The scroll container the image lives in — the pan surface the zoom anchors against. */
+ node: HTMLElement | null;
+ /** Absent means the host does not offer pinch (the desktop stage). */
+ onZoom?: (zoom: number) => void;
+ zoom: number;
+}
+
+/**
+ * Two fingers on the stage change the zoom; the point between them stays put.
+ *
+ * The zoom itself lives in the review model (the buttons share it), so this
+ * only reports the zoom a pinch has reached and, once the host has re-rendered
+ * the image at that size, moves the scroll so the pinched spot does not jump.
+ * The browser's own page zoom is switched off by the host's `touch-action`.
+ */
+export const usePinchZoom = ({ node, onZoom, zoom }: UsePinchZoomInput) => {
+ const pinch = useRef<{ distance: number; zoom: number } | null>(null);
+ const anchor = useRef<{ x: number; y: number } | null>(null);
+ const applied = useRef(zoom);
+
+ // The width the zoom multiplies is set by React on the next render, so the
+ // scroll correction has to wait for that layout — hence an effect on `zoom`,
+ // not a write inside the touch handler.
+ useLayoutEffect(() => {
+ const ratio = zoom / applied.current;
+ applied.current = zoom;
+ const at = anchor.current;
+ anchor.current = null;
+ if (!node || !at || ratio === 1) return;
+ node.scrollLeft = anchoredScroll(node.scrollLeft, at.x, ratio);
+ node.scrollTop = anchoredScroll(node.scrollTop, at.y, ratio);
+ }, [node, zoom]);
+
+ if (!onZoom) return { handlers: {} };
+
+ const fingers = (event: TouchEvent) => {
+ if (event.touches.length < 2) return null;
+ const [a, b] = [event.touches[0], event.touches[1]];
+ return {
+ distance: touchDistance({ x: a.clientX, y: a.clientY }, { x: b.clientX, y: b.clientY }),
+ midpoint: touchMidpoint({ x: a.clientX, y: a.clientY }, { x: b.clientX, y: b.clientY }),
+ };
+ };
+
+ return {
+ handlers: {
+ onTouchCancel: () => {
+ pinch.current = null;
+ },
+ onTouchEnd: (event: TouchEvent) => {
+ if (event.touches.length < 2) pinch.current = null;
+ },
+ onTouchMove: (event: TouchEvent) => {
+ const start = pinch.current;
+ const now = fingers(event);
+ if (!start || !now) return;
+ const next = pinchedZoom(
+ start.zoom,
+ start.distance,
+ now.distance,
+ ZOOM_STEPS[0],
+ ZOOM_STEPS.at(-1)!,
+ );
+ if (next === zoom) return;
+ const box = node?.getBoundingClientRect();
+ anchor.current = box ? { x: now.midpoint.x - box.left, y: now.midpoint.y - box.top } : null;
+ onZoom(next);
+ },
+ onTouchStart: (event: TouchEvent) => {
+ const now = fingers(event);
+ // The second finger starts a pinch from wherever the zoom is now —
+ // the buttons may have moved it since the last pinch.
+ if (now) pinch.current = { distance: now.distance, zoom };
+ },
+ },
+ };
+};
diff --git a/src/features/Acceptance/Viewer/Review/rejectDraft.test.ts b/src/features/Acceptance/Viewer/Review/rejectDraft.test.ts
new file mode 100644
index 00000000000..b8c870231e1
--- /dev/null
+++ b/src/features/Acceptance/Viewer/Review/rejectDraft.test.ts
@@ -0,0 +1,27 @@
+import { describe, expect, it } from 'vitest';
+
+import { clampZoom, nextZoom, ZOOM_STEPS } from './rejectDraft';
+
+describe('nextZoom', () => {
+ it('steps one notch from a notch and stops at both ends', () => {
+ expect(nextZoom(1, 1)).toBe(1.5);
+ expect(nextZoom(1, -1)).toBe(0.75);
+ expect(nextZoom(ZOOM_STEPS.at(-1)!, 1)).toBe(ZOOM_STEPS.at(-1));
+ expect(nextZoom(ZOOM_STEPS[0], -1)).toBe(ZOOM_STEPS[0]);
+ });
+
+ it('lands on the next notch in that direction from between two notches (after a pinch)', () => {
+ expect(nextZoom(1.23, 1)).toBe(1.5);
+ expect(nextZoom(1.23, -1)).toBe(1);
+ expect(nextZoom(2.7, 1)).toBe(3);
+ expect(nextZoom(2.7, -1)).toBe(2);
+ });
+});
+
+describe('clampZoom', () => {
+ it('keeps a pinched value inside the range the buttons can reach', () => {
+ expect(clampZoom(0.1)).toBe(ZOOM_STEPS[0]);
+ expect(clampZoom(9)).toBe(ZOOM_STEPS.at(-1));
+ expect(clampZoom(1.7)).toBe(1.7);
+ });
+});
diff --git a/src/features/Acceptance/Viewer/Review/rejectDraft.ts b/src/features/Acceptance/Viewer/Review/rejectDraft.ts
index 25cec7949e2..2e3cda4b296 100644
--- a/src/features/Acceptance/Viewer/Review/rejectDraft.ts
+++ b/src/features/Acceptance/Viewer/Review/rejectDraft.ts
@@ -104,9 +104,21 @@ export const mergeRejectComments = (initialComment = '', storedComment = '') =>
export const ZOOM_STEPS = [0.5, 0.75, 1, 1.5, 2, 3, 4];
-/** Step one notch along ZOOM_STEPS, clamped at both ends. */
+export const clampZoom = (value: number) =>
+ Math.min(Math.max(value, ZOOM_STEPS[0]), ZOOM_STEPS.at(-1)!);
+
+/**
+ * Step one notch along ZOOM_STEPS, clamped at both ends. A pinch can leave the
+ * zoom between two notches; from there a step lands on the next notch in that
+ * direction rather than snapping back to 100%.
+ */
export const nextZoom = (current: number, direction: 1 | -1) => {
const index = ZOOM_STEPS.findIndex((step) => Math.abs(step - current) < 0.001);
- const at = index === -1 ? 2 : index;
- return ZOOM_STEPS[Math.min(Math.max(at + direction, 0), ZOOM_STEPS.length - 1)];
+ if (index !== -1)
+ return ZOOM_STEPS[Math.min(Math.max(index + direction, 0), ZOOM_STEPS.length - 1)];
+ const candidate =
+ direction === 1
+ ? ZOOM_STEPS.find((step) => step > current)
+ : [...ZOOM_STEPS].reverse().find((step) => step < current);
+ return candidate ?? clampZoom(current);
};
diff --git a/src/features/Acceptance/Viewer/Review/useRejectReview.ts b/src/features/Acceptance/Viewer/Review/useRejectReview.ts
index e10552cca4e..96fedea03c8 100644
--- a/src/features/Acceptance/Viewer/Review/useRejectReview.ts
+++ b/src/features/Acceptance/Viewer/Review/useRejectReview.ts
@@ -10,6 +10,7 @@ import type { MobileReviewEvent, MobileReviewStep } from '../Evidence/mobileRevi
import { nextMobileReviewStep } from '../Evidence/mobileReviewFlow';
import type { DraftAnnotationEntry, RejectableEvidence } from './rejectDraft';
import {
+ clampZoom,
clearDraft,
mergeRejectComments,
nextAnnotationKey,
@@ -180,6 +181,8 @@ export const useRejectReview = ({
removeAttachment: remove,
selectEvidence,
setComment,
+ /** A pinch lands anywhere in range; the buttons still step by notches from there. */
+ setZoom: (value: number) => setZoom(clampZoom(value)),
stepZoom: (direction: 1 | -1) => setZoom((current) => nextZoom(current, direction)),
submitReject: async () => {
const confirmed = await submit(() =>