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
11}11}
12 12
13export interface NativeReviewDiffRow {13export interface NativeReviewDiffRow {
14 readonly kind: "file" | "hunk" | "line" | "notice";14 readonly kind: "file" | "hunk" | "line" | "notice" | "comment";
15 readonly id: string;15 readonly id: string;
16 readonly fileId?: string;16 readonly fileId?: string;
17 readonly filePath?: string;17 readonly filePath?: string;
@@ -31,6 +31,9 @@ export interface NativeReviewDiffRow { · 13 unmodified lines
31 readonly oldLineNumber?: number | null;31 readonly oldLineNumber?: number | null;
32 readonly newLineNumber?: number | null;32 readonly newLineNumber?: number | null;
33 readonly wordDiffRanges?: ReadonlyArray<NativeReviewDiffWordDiffRange>;33 readonly wordDiffRanges?: ReadonlyArray<NativeReviewDiffWordDiffRange>;
34 readonly commentText?: string;
35 readonly commentRangeLabel?: string;
36 readonly commentSectionTitle?: string;
34}37}
35 38
36export interface NativeReviewDiffWordDiffRange {39export interface NativeReviewDiffWordDiffRange {
@@ -100,6 +103,8 @@ export interface NativeReviewDiffViewProps extends ViewProps { · 63 unmodified lines
100 readonly tokensResetKey?: string;103 readonly tokensResetKey?: string;
101 readonly collapsedFileIdsJson?: string;104 readonly collapsedFileIdsJson?: string;
102 readonly viewedFileIdsJson?: string;105 readonly viewedFileIdsJson?: string;
106 readonly selectedRowIdsJson?: string;
107 readonly collapsedCommentIdsJson?: string;
103 readonly appearanceScheme: "light" | "dark";108 readonly appearanceScheme: "light" | "dark";
104 readonly themeJson: string;109 readonly themeJson: string;
105 readonly styleJson?: string;110 readonly styleJson?: string;
@@ -108,6 +113,17 @@ export interface NativeReviewDiffViewProps extends ViewProps { · 2 unmodified lines
108 readonly onDebug?: (event: NativeSyntheticEvent<Record<string, unknown>>) => void;113 readonly onDebug?: (event: NativeSyntheticEvent<Record<string, unknown>>) => void;
109 readonly onToggleFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void;114 readonly onToggleFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void;
110 readonly onToggleViewedFile?: (event: NativeSyntheticEvent<{ readonly fileId?: string }>) => void;115 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;
111}127}
112 128
113let cachedNativeReviewDiffView: ComponentType<NativeReviewDiffViewProps> | undefined;129let cachedNativeReviewDiffView: ComponentType<NativeReviewDiffViewProps> | undefined;