From 3aee66b333b9030a96e46f179e3fe5d01ffc72d0 Mon Sep 17 00:00:00 2001 From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> Date: Fri, 1 May 2026 18:26:53 -0400 Subject: [PATCH] Add swipe-to-close and repo display to MoreDrawer --- .../src/components/navigation/MoreDrawer.tsx | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/navigation/MoreDrawer.tsx b/frontend/src/components/navigation/MoreDrawer.tsx index a272b261..cff19146 100644 --- a/frontend/src/components/navigation/MoreDrawer.tsx +++ b/frontend/src/components/navigation/MoreDrawer.tsx @@ -1,5 +1,5 @@ import { useNavigate, useLocation, useParams } from 'react-router-dom' -import { useState } from 'react' +import { useState, useRef, useEffect } from 'react' import { ChevronDown, ChevronRight, Command as CommandIcon, FileText, X, GitBranch } from 'lucide-react' import { useAuth } from '@/hooks/useAuth' import { useServerHealth } from '@/hooks/useServerHealth' @@ -12,6 +12,8 @@ import { OPENCODE_API_ENDPOINT } from '@/config' import { SideDrawer, SideDrawerContent } from '@/components/ui/side-drawer' import { FileBrowserSheet } from '@/components/file-browser/FileBrowserSheet' import { buildMoreItems } from './moreDrawerItems' +import { useSwipeBack } from '@/hooks/useMobile' +import { getRepoDisplayName } from '@/lib/utils' import type { components } from '@/api/opencode-types' type CommandType = components['schemas']['Command'] @@ -28,6 +30,8 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) { const repoId = id ? Number(id) : null const [commandsOpen, setCommandsOpen] = useState(false) const [mentionFileBrowserOpen, setMentionFileBrowserOpen] = useState(false) + const swipeRef = useRef(null) + const { bind } = useSwipeBack(onClose, { enabled: true, suspendsRouteSwipe: false }) const { logout } = useAuth() const { data: health } = useServerHealth() const { memoryPluginEnabled } = useMemoryPluginStatus() @@ -37,6 +41,13 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) { const selectPromptCommand = useUIState((state) => state.selectPromptCommand) const selectPromptFile = useUIState((state) => state.selectPromptFile) + useEffect(() => { + if (isOpen && swipeRef.current) { + const cleanup = bind(swipeRef.current) + return cleanup + } + }, [isOpen, bind]) + const { data: repo } = useQuery({ queryKey: ['repo', repoId], queryFn: () => repoId ? getRepo(repoId) : null, @@ -107,7 +118,7 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) { return ( -
+
{versionLabel && ( {versionLabel} @@ -121,10 +132,20 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
- {currentBranch && ( + {(repo || currentBranch) && (
- - {currentBranch} + {repo && ( + {getRepoDisplayName(repo.repoUrl, repo.localPath, repo.sourcePath)} + )} + {repo && currentBranch && ( + ยท + )} + {currentBranch && ( + <> + + {currentBranch} + + )}
)}