From 0804f51b03d0a4a8ebd5826b8f6952c228291329 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Tue, 3 Feb 2026 10:03:50 +0700 Subject: [PATCH] refactor: make diff mode toggle interactive and improve status display --- packages/app/src/components/git-diff-pane.tsx | 79 ++++++++++++------- 1 file changed, 49 insertions(+), 30 deletions(-) diff --git a/packages/app/src/components/git-diff-pane.tsx b/packages/app/src/components/git-diff-pane.tsx index ed863eb26..f3bddf37f 100644 --- a/packages/app/src/components/git-diff-pane.tsx +++ b/packages/app/src/components/git-diff-pane.tsx @@ -16,7 +16,7 @@ import { ScrollView, type ScrollView as ScrollViewType } from "react-native-gest import { StyleSheet, useUnistyles } from "react-native-unistyles"; import AsyncStorage from "@react-native-async-storage/async-storage"; import * as Linking from "expo-linking"; -import { ChevronDown, ChevronRight, GitBranch, MoreVertical } from "lucide-react-native"; +import { ChevronDown, ChevronRight, GitBranch, MoreVertical, ArrowLeftRight } from "lucide-react-native"; import { useMutation, useQueryClient } from "@tanstack/react-query"; import { useSessionStore } from "@/stores/session-store"; import { @@ -1107,28 +1107,19 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) { - setDiffModeOverride(diffMode === "uncommitted" ? "base" : "uncommitted")} - > - {diffMode === "uncommitted" ? `Show changes vs ${baseRefLabel}` : "Show uncommitted changes"} - {gitStatus?.isPaseoOwnedWorktree ? ( - <> - - - Archive worktree - - + + Archive worktree + ) : null} @@ -1137,10 +1128,26 @@ export function GitDiffPane({ serverId, agentId, cwd }: GitDiffPaneProps) { {isGit && hasChanges ? ( - - - {diffMode === "uncommitted" ? "Uncommitted changes" : `Changes vs ${baseRefLabel}`} - + + [ + styles.diffStatusRow, + hovered && styles.diffStatusRowHovered, + ]} + testID="changes-diff-status" + onPress={() => setDiffModeOverride(diffMode === "uncommitted" ? "base" : "uncommitted")} + > + {({ hovered }) => ( + <> + + {diffMode === "uncommitted" ? "Uncommitted" : "Committed"} + + {hovered ? ( + + ) : null} + + )} + ) : null} @@ -1188,12 +1195,24 @@ const styles = StyleSheet.create((theme) => ({ fontWeight: theme.fontWeight.medium, flexShrink: 1, }, - diffStatusRow: { - paddingHorizontal: theme.spacing[3], - paddingVertical: theme.spacing[2], + diffStatusContainer: { borderBottomWidth: 1, borderBottomColor: theme.colors.border, }, + diffStatusRow: { + flexDirection: "row", + alignItems: "center", + alignSelf: "flex-start", + gap: theme.spacing[1], + marginHorizontal: theme.spacing[3], + marginVertical: theme.spacing[2], + paddingHorizontal: theme.spacing[2], + paddingVertical: theme.spacing[1], + borderRadius: theme.borderRadius.base, + }, + diffStatusRowHovered: { + backgroundColor: theme.colors.surface2, + }, diffStatusText: { fontSize: theme.fontSize.xs, color: theme.colors.foregroundMuted, @@ -1387,7 +1406,7 @@ const styles = StyleSheet.create((theme) => ({ flex: 1, }, fileName: { - fontWeight: theme.fontWeight.semibold, + color: theme.colors.foreground, }, fileDir: { color: theme.colors.foregroundMuted,