From f9b3646f177f16cbb45e3c3e2a149ae2a3cd5699 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Mon, 15 Dec 2025 13:43:32 +0200 Subject: [PATCH] fix: Improve mobile responsiveness for diff view --- packages/ui/src/components/layout/Header.tsx | 13 ++++-- packages/ui/src/components/views/DiffView.tsx | 45 +++++++++++++------ 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/packages/ui/src/components/layout/Header.tsx b/packages/ui/src/components/layout/Header.tsx index 0b89d26c..32e184ea 100644 --- a/packages/ui/src/components/layout/Header.tsx +++ b/packages/ui/src/components/layout/Header.tsx @@ -5,7 +5,7 @@ import { TooltipTrigger, } from '@/components/ui/tooltip'; import { Button } from '@/components/ui/button'; -import { RiArrowDownSLine, RiArrowUpSLine, RiChat4Line, RiCodeLine, RiGitBranchLine, RiLayoutLeftLine, RiTerminalBoxLine, type RemixiconComponentType } from '@remixicon/react'; +import { RiArrowDownSLine, RiArrowUpSLine, RiChat4Line, RiCodeLine, RiGitBranchLine, RiLayoutLeftLine, RiPlayListAddLine, RiTerminalBoxLine, type RemixiconComponentType } from '@remixicon/react'; import { useUIStore, type MainTab } from '@/stores/useUIStore'; import { useConfigStore } from '@/stores/useConfigStore'; import { useSessionStore } from '@/stores/useSessionStore'; @@ -234,10 +234,15 @@ export const Header: React.FC = () => { const tabs: TabConfig[] = React.useMemo(() => [ { id: 'chat', label: 'Chat', icon: RiChat4Line }, - { id: 'diff', label: 'Diff', icon: RiCodeLine, badge: diffFileCount > 0 ? diffFileCount : undefined }, + { + id: 'diff', + label: 'Diff', + icon: RiCodeLine, + badge: !isMobile && diffFileCount > 0 ? diffFileCount : undefined, + }, { id: 'terminal', label: 'Terminal', icon: RiTerminalBoxLine }, { id: 'git', label: 'Git', icon: RiGitBranchLine }, - ], [diffFileCount]); + ], [diffFileCount, isMobile]); useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { @@ -371,7 +376,7 @@ export const Header: React.FC = () => { className="app-region-no-drag h-9 w-9 p-2 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary" aria-label="Open sessions" > - + {contextUsage && contextUsage.totalTokens > 0 && activeMainTab === 'chat' && ( void; + isMobile: boolean; } const FileSelector = React.memo(({ @@ -61,16 +62,25 @@ const FileSelector = React.memo(({ selectedFile, selectedFileEntry, onSelectFile, + isMobile, }) => { if (changedFiles.length === 0) return null; + const getLabel = React.useCallback((path: string) => { + if (!isMobile) return path; + const lastSlash = path.lastIndexOf('/'); + return lastSlash >= 0 ? path.slice(lastSlash + 1) : path; + }, [isMobile]); + return (