feat: add Cmd+B sidebar toggle and horizontal scroll for diff
- Add global Cmd+B (Ctrl+B on non-Mac) keyboard shortcut to toggle sidebar on web - Re-enable horizontal scrolling for git diff pane with nestedScrollEnabled for gesture compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
ed25db4e22
commit
351735a71b
@@ -11,7 +11,8 @@ import { DaemonRegistryProvider, useDaemonRegistry } from "@/contexts/daemon-reg
|
|||||||
import { DaemonConnectionsProvider } from "@/contexts/daemon-connections-context";
|
import { DaemonConnectionsProvider } from "@/contexts/daemon-connections-context";
|
||||||
import { MultiDaemonSessionHost } from "@/components/multi-daemon-session-host";
|
import { MultiDaemonSessionHost } from "@/components/multi-daemon-session-host";
|
||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import { useState, type ReactNode, useMemo } from "react";
|
import { useState, useEffect, type ReactNode, useMemo } from "react";
|
||||||
|
import { Platform } from "react-native";
|
||||||
import { SlidingSidebar } from "@/components/sliding-sidebar";
|
import { SlidingSidebar } from "@/components/sliding-sidebar";
|
||||||
import { useSidebarStore } from "@/stores/sidebar-store";
|
import { useSidebarStore } from "@/stores/sidebar-store";
|
||||||
import { runOnJS, interpolate, Extrapolation } from "react-native-reanimated";
|
import { runOnJS, interpolate, Extrapolation } from "react-native-reanimated";
|
||||||
@@ -46,7 +47,20 @@ interface AppContainerProps {
|
|||||||
|
|
||||||
function AppContainer({ children, selectedAgentId }: AppContainerProps) {
|
function AppContainer({ children, selectedAgentId }: AppContainerProps) {
|
||||||
const { theme } = useUnistyles();
|
const { theme } = useUnistyles();
|
||||||
const { isOpen, open } = useSidebarStore();
|
const { isOpen, open, toggle } = useSidebarStore();
|
||||||
|
|
||||||
|
// Cmd+B to toggle sidebar (web only)
|
||||||
|
useEffect(() => {
|
||||||
|
if (Platform.OS !== "web") return;
|
||||||
|
function handleKeyDown(event: KeyboardEvent) {
|
||||||
|
if ((event.metaKey || event.ctrlKey) && event.key === "b") {
|
||||||
|
event.preventDefault();
|
||||||
|
toggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.addEventListener("keydown", handleKeyDown);
|
||||||
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
||||||
|
}, [toggle]);
|
||||||
const {
|
const {
|
||||||
translateX,
|
translateX,
|
||||||
backdropOpacity,
|
backdropOpacity,
|
||||||
|
|||||||
@@ -150,13 +150,21 @@ function DiffFileSection({ file, defaultExpanded = true }: DiffFileSectionProps)
|
|||||||
</View>
|
</View>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
{isExpanded && (
|
{isExpanded && (
|
||||||
<View style={styles.diffContent}>
|
<ScrollView
|
||||||
{file.hunks.map((hunk, hunkIndex) =>
|
horizontal
|
||||||
hunk.lines.map((line, lineIndex) => (
|
nestedScrollEnabled
|
||||||
<DiffLineView key={`${hunkIndex}-${lineIndex}`} line={line} />
|
showsHorizontalScrollIndicator
|
||||||
))
|
style={styles.diffContent}
|
||||||
)}
|
contentContainerStyle={styles.diffContentInner}
|
||||||
</View>
|
>
|
||||||
|
<View style={styles.linesContainer}>
|
||||||
|
{file.hunks.map((hunk, hunkIndex) =>
|
||||||
|
hunk.lines.map((line, lineIndex) => (
|
||||||
|
<DiffLineView key={`${hunkIndex}-${lineIndex}`} line={line} />
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</ScrollView>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -340,6 +348,13 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
borderTopColor: theme.colors.border,
|
borderTopColor: theme.colors.border,
|
||||||
backgroundColor: "#0d1117", // GitHub dark background
|
backgroundColor: "#0d1117", // GitHub dark background
|
||||||
},
|
},
|
||||||
|
diffContentInner: {
|
||||||
|
flexDirection: "column",
|
||||||
|
},
|
||||||
|
linesContainer: {
|
||||||
|
alignSelf: "flex-start",
|
||||||
|
minWidth: "100%",
|
||||||
|
},
|
||||||
diffLineContainer: {
|
diffLineContainer: {
|
||||||
paddingHorizontal: theme.spacing[3],
|
paddingHorizontal: theme.spacing[3],
|
||||||
paddingVertical: theme.spacing[1],
|
paddingVertical: theme.spacing[1],
|
||||||
|
|||||||
Reference in New Issue
Block a user