Skip to content

Commit af4cecd

Browse files
committed
feat(review-editor): mobile annotation, settings, theme (tier 2)
Builds on the read-only mobile shell. New on mobile: - Tap any added/removed line to start a selection; tap another to extend the range. Diff lines now render with line numbers and a ring highlight when selected. - Sticky bottom bar shows the current selection with Cancel / Annotate, or — when no selection — Send Feedback (N) / Approve. - Bottom sheet composes the annotation: type picker (comment/suggestion/concern), textarea, save/cancel. Saves through a new `handleAddMobileAnnotation` that runs the same withPRContext + setAnnotations pipe as desktop, so drafts/sidebar/exports treat mobile-created annotations identically. - Header surfaces a Theme cycle (system/light/dark via useTheme) and a Settings button that opens the existing Settings dialog via its externalOpen hook. - Annotation cards on mobile gain a delete affordance; existing desktop deletion path is reused via handleDeleteAnnotation. - CompletionOverlay on mobile now handles all three submit states (approved/feedback/exited), not just exited.
1 parent ed31d8b commit af4cecd

2 files changed

Lines changed: 533 additions & 65 deletions

File tree

packages/review-editor/App.tsx

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,34 @@ const ReviewApp: React.FC = () => {
911911
setAnnotations(prev => [...prev, withPRContext(newAnnotation)]);
912912
}, [identity, withPRContext]);
913913

914+
// Mobile path: build a line-scoped annotation directly from explicit
915+
// (filePath, side, lineStart, lineEnd, type, text) rather than via the
916+
// desktop `pendingSelection` state. Same factory + setAnnotations pipe,
917+
// so drafts/sidebar/exports see it identically.
918+
const handleAddMobileAnnotation = useCallback((
919+
filePath: string,
920+
side: 'old' | 'new',
921+
lineStart: number,
922+
lineEnd: number,
923+
type: CodeAnnotationType,
924+
text: string,
925+
) => {
926+
const trimmed = text.trim();
927+
const newAnnotation: CodeAnnotation = {
928+
id: generateId(),
929+
type,
930+
scope: 'line',
931+
filePath,
932+
lineStart: Math.min(lineStart, lineEnd),
933+
lineEnd: Math.max(lineStart, lineEnd),
934+
side,
935+
text: trimmed || undefined,
936+
createdAt: Date.now(),
937+
author: identity,
938+
};
939+
setAnnotations(prev => [...prev, withPRContext(newAnnotation)]);
940+
}, [identity, withPRContext]);
941+
914942
// Edit annotation
915943
const handleEditAnnotation = useCallback((
916944
id: string,
@@ -1712,13 +1740,34 @@ const ReviewApp: React.FC = () => {
17121740
annotations={allAnnotations}
17131741
prMetadata={prMetadata}
17141742
repoInfo={repoInfo}
1715-
onExit={handleExit}
1743+
origin={origin}
1744+
gitUser={gitUser}
1745+
aiProviders={aiProviders}
1746+
totalAnnotationCount={totalAnnotationCount}
17161747
isExiting={isExiting}
1748+
isSendingFeedback={isSendingFeedback}
1749+
isApproving={isApproving}
1750+
onExit={handleExit}
1751+
onSendFeedback={handleSendFeedback}
1752+
onApprove={handleApprove}
1753+
onAddAnnotation={handleAddMobileAnnotation}
1754+
onDeleteAnnotation={handleDeleteAnnotation}
1755+
onIdentityChange={handleIdentityChange}
17171756
/>
17181757
<CompletionOverlay
1719-
submitted={submitted === 'exited' ? 'exited' : false}
1720-
title="Session Closed"
1721-
subtitle="Review session closed."
1758+
submitted={submitted}
1759+
title={
1760+
submitted === 'approved' ? 'Changes Approved'
1761+
: submitted === 'exited' ? 'Session Closed'
1762+
: 'Feedback Sent'
1763+
}
1764+
subtitle={
1765+
submitted === 'exited'
1766+
? 'Review session closed without feedback.'
1767+
: submitted === 'approved'
1768+
? `${getAgentName(origin)} will proceed with the changes.`
1769+
: `${getAgentName(origin)} will address your review feedback.`
1770+
}
17221771
agentLabel={getAgentName(origin)}
17231772
/>
17241773
</ThemeProvider>

0 commit comments

Comments
 (0)