Showing the changes to apps/web/src/diffPanelStore.ts (1 of 3 files). Show all
Unified · Split
| @@ -10,12 +10,16 @@ export type DiffPanelSelection = · 9 unmodified lines | |||
| 10 | | { kind: "unstaged" } | 10 | | { kind: "unstaged" } |
| 11 | | { kind: "turn"; turnId: TurnId; filePath: string | null; revealRequestId: number }; | 11 | | { kind: "turn"; turnId: TurnId; filePath: string | null; revealRequestId: number }; |
| 12 | 12 | ||
| 13 | export type DiffRenderMode = "stacked" | "split"; | ||
| 14 | |||
| 13 | const DEFAULT_SELECTION: DiffPanelSelection = { kind: "branch", baseRef: null }; | 15 | const DEFAULT_SELECTION: DiffPanelSelection = { kind: "branch", baseRef: null }; |
| 14 | const DEFAULT_WORKING_TREE_SELECTION: DiffPanelSelection = { kind: "unstaged" }; | 16 | const DEFAULT_WORKING_TREE_SELECTION: DiffPanelSelection = { kind: "unstaged" }; |
| 15 | 17 | ||
| 16 | interface DiffPanelStoreState { | 18 | interface DiffPanelStoreState { |
| 17 | byThreadKey: Record<string, DiffPanelSelection>; | 19 | byThreadKey: Record<string, DiffPanelSelection>; |
| 18 | branchBaseRefByThreadKey: Record<string, string | null>; | 20 | branchBaseRefByThreadKey: Record<string, string | null>; |
| 21 | diffRenderMode: DiffRenderMode; | ||
| 22 | setDiffRenderMode: (mode: DiffRenderMode) => void; | ||
| 19 | selectGitScope: (ref: ScopedThreadRef, scope: "branch" | "unstaged") => void; | 23 | selectGitScope: (ref: ScopedThreadRef, scope: "branch" | "unstaged") => void; |
| 20 | selectBranchBaseRef: (ref: ScopedThreadRef, baseRef: string | null) => void; | 24 | selectBranchBaseRef: (ref: ScopedThreadRef, baseRef: string | null) => void; |
| 21 | selectTurn: (ref: ScopedThreadRef, turnId: TurnId, filePath?: string) => void; | 25 | selectTurn: (ref: ScopedThreadRef, turnId: TurnId, filePath?: string) => void; |
| @@ -33,6 +37,8 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()( · 11 unmodified lines | |||
| 33 | (set) => ({ | 37 | (set) => ({ |
| 34 | byThreadKey: {}, | 38 | byThreadKey: {}, |
| 35 | branchBaseRefByThreadKey: {}, | 39 | branchBaseRefByThreadKey: {}, |
| 40 | diffRenderMode: "stacked", | ||
| 41 | setDiffRenderMode: (diffRenderMode) => set({ diffRenderMode }), | ||
| 36 | selectGitScope: (ref, scope) => | 42 | selectGitScope: (ref, scope) => |
| 37 | set((state) => { | 43 | set((state) => { |
| 38 | const threadKey = scopedThreadKey(ref); | 44 | const threadKey = scopedThreadKey(ref); |
| @@ -126,6 +132,7 @@ export const useDiffPanelStore = create<DiffPanelStoreState>()( · 87 unmodified lines | |||
| 126 | partialize: (state) => ({ | 132 | partialize: (state) => ({ |
| 127 | byThreadKey: state.byThreadKey, | 133 | byThreadKey: state.byThreadKey, |
| 128 | branchBaseRefByThreadKey: state.branchBaseRefByThreadKey, | 134 | branchBaseRefByThreadKey: state.branchBaseRefByThreadKey, |
| 135 | diffRenderMode: state.diffRenderMode, | ||
| 129 | }), | 136 | }), |
| 130 | }, | 137 | }, |
| 131 | ), | 138 | ), |