11import { useNavigate , useLocation , useParams } from 'react-router-dom'
2- import { useState } from 'react'
2+ import { useState , useRef , useEffect } from 'react'
33import { ChevronDown , ChevronRight , Command as CommandIcon , FileText , X , GitBranch } from 'lucide-react'
44import { useAuth } from '@/hooks/useAuth'
55import { useServerHealth } from '@/hooks/useServerHealth'
@@ -12,6 +12,8 @@ import { OPENCODE_API_ENDPOINT } from '@/config'
1212import { SideDrawer , SideDrawerContent } from '@/components/ui/side-drawer'
1313import { FileBrowserSheet } from '@/components/file-browser/FileBrowserSheet'
1414import { buildMoreItems } from './moreDrawerItems'
15+ import { useSwipeBack } from '@/hooks/useMobile'
16+ import { getRepoDisplayName } from '@/lib/utils'
1517import type { components } from '@/api/opencode-types'
1618
1719type CommandType = components [ 'schemas' ] [ 'Command' ]
@@ -28,6 +30,8 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
2830 const repoId = id ? Number ( id ) : null
2931 const [ commandsOpen , setCommandsOpen ] = useState ( false )
3032 const [ mentionFileBrowserOpen , setMentionFileBrowserOpen ] = useState ( false )
33+ const swipeRef = useRef < HTMLDivElement > ( null )
34+ const { bind } = useSwipeBack ( onClose , { enabled : true , suspendsRouteSwipe : false } )
3135 const { logout } = useAuth ( )
3236 const { data : health } = useServerHealth ( )
3337 const { memoryPluginEnabled } = useMemoryPluginStatus ( )
@@ -37,6 +41,13 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
3741 const selectPromptCommand = useUIState ( ( state ) => state . selectPromptCommand )
3842 const selectPromptFile = useUIState ( ( state ) => state . selectPromptFile )
3943
44+ useEffect ( ( ) => {
45+ if ( isOpen && swipeRef . current ) {
46+ const cleanup = bind ( swipeRef . current )
47+ return cleanup
48+ }
49+ } , [ isOpen , bind ] )
50+
4051 const { data : repo } = useQuery ( {
4152 queryKey : [ 'repo' , repoId ] ,
4253 queryFn : ( ) => repoId ? getRepo ( repoId ) : null ,
@@ -107,7 +118,7 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
107118
108119 return (
109120 < SideDrawer isOpen = { isOpen } onClose = { onClose } side = "right" ariaLabel = "More" widthClass = "w-screen sm:w-[min(90vw,420px)]" >
110- < div className = "flex flex-col flex-shrink-0 border-b border-border bg-background px-4 py-1.5" >
121+ < div ref = { swipeRef } className = "flex flex-col flex-shrink-0 border-b border-border bg-background px-4 py-1.5" >
111122 < div className = "flex items-center justify-between gap-3 mb-2" >
112123 { versionLabel && (
113124 < span className = "truncate text-xs leading-tight text-muted-foreground" > { versionLabel } </ span >
@@ -121,10 +132,20 @@ export function MoreDrawer({ isOpen, onClose }: MoreDrawerProps) {
121132 < X className = "h-5 w-5" />
122133 </ button >
123134 </ div >
124- { currentBranch && (
135+ { ( repo || currentBranch ) && (
125136 < div className = "flex items-center gap-2 text-xs text-muted-foreground" >
126- < GitBranch className = "h-3.5 w-3.5" />
127- < span > { currentBranch } </ span >
137+ { repo && (
138+ < span className = "font-medium text-foreground" > { getRepoDisplayName ( repo . repoUrl , repo . localPath , repo . sourcePath ) } </ span >
139+ ) }
140+ { repo && currentBranch && (
141+ < span className = "text-muted-foreground" > ·</ span >
142+ ) }
143+ { currentBranch && (
144+ < >
145+ < GitBranch className = "h-3.5 w-3.5" />
146+ < span > { currentBranch } </ span >
147+ </ >
148+ ) }
128149 </ div >
129150 ) }
130151 </ div >
0 commit comments