History

Add inline review comment selection to mobile diffs

- render comment rows and line selection state in the native diff view - wire long-press/tap gestures to start and complete review comments - tighten shared diff utilities and add coverage

Julius Marminge committed 6 months ago

Commit eba28031 parent a49c2d115 files · +640 −37Browse files

Showing the changes to apps/mobile/src/features/debug/native-review-diff/nativeReviewDiffModule.ts (1 of 15 files). Show all

Unified · Split

apps/mobile/src/features/debug/native-review-diff/nativeReviewDiffModule.ts+17−1
@@ -11,7 +11,7 @@ interface ExpoGlobalWithViewConfig { · 10 unmodified lines
1111 }
1212
1313 export interface NativeReviewDiffRow {
14− readonly kind: "file" | "hunk" | "line" | "notice";
14+ readonly kind: "file" | "hunk" | "line" | "notice" | "comment";
1515 readonly id: string;
1616 readonly fileId?: string;
1717 readonly filePath?: string;
@@ -31,6 +31,9 @@ export interface NativeReviewDiffRow { · 13 unmodified lines
3131 readonly oldLineNumber?: number | null;
3232 readonly newLineNumber?: number | null;
3333 readonly wordDiffRanges?: ReadonlyArray<NativeReviewDiffWordDiffRange>;
34+ readonly commentText?: string;
35+ readonly commentRangeLabel?: string;
36+ readonly commentSectionTitle?: string;
3437 }
3538
3639 export interface NativeReviewDiffWordDiffRange {
@@ -100,6 +103,8 @@ export interface NativeReviewDiffViewProps extends ViewProps { · 63 unmodified lines
100103 readonly tokensResetKey?: string;
101104 readonly collapsedFileIdsJson?: string;
102105 readonly viewedFileIdsJson?: string;
106+ readonly selectedRowIdsJson?: string;
107+ readonly collapsedCommentIdsJson?: string;
103108 readonly appearanceScheme: "light" | "dark";
104109 readonly themeJson: string;
105110 readonly styleJson?: string;
@@ -108,6 +113,17 @@ export interface NativeReviewDiffViewProps extends ViewProps { · 2 unmodified lines
108113 readonly onDebug?: (event: NativeSyntheticEvent<Record<string, unknown>>) => void;
109114 readonly onToggleFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void;
110115 readonly onToggleViewedFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void;
116+ readonly onPressLine?: (
117+ event: NativeSyntheticEvent<{
118+ readonly rowId?: string;
119+ readonly fileId?: string;
120+ readonly gesture?: "tap" | "longPress";
121+ readonly oldLineNumber?: number;
122+ readonly newLineNumber?: number;
123+ readonly change?: "context" | "add" | "delete";
124+ }>,
125+ ) => void;
126+ readonly onToggleComment?: (event: NativeSyntheticEvent<{ readonly commentId?: string }>) => void;
111127 }
112128
113129 let cachedNativeReviewDiffView: ComponentType<NativeReviewDiffViewProps> | undefined;