mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix(navigation): scope the mobile Files tab to the assistant workspace
This commit is contained in:
1 parent
0045a74716
commit
e133d37842
2 files changed
+46
-1
No files matched your search
@@ -106,6 +106,50 @@ describe('MobileTabBar', () => {
|
||||
expect(screen.getByText('Schedules')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('opens the assistant-scoped file browser from the assistant route', async () => {
|
||||
vi.mocked(useMobile).mockReturnValue(true)
|
||||
const queryClient = new QueryClient()
|
||||
const user = userEvent.setup()
|
||||
|
||||
render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<MemoryRouter initialEntries={['/assistant']}>
|
||||
<Routes>
|
||||
<Route path="*" element={<>
|
||||
<MobileTabBar />
|
||||
<LocationSpy />
|
||||
</>} />
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Files' }))
|
||||
expect(screen.getByTestId('location')).toHaveTextContent('dialog=files')
|
||||
})
|
||||
|
||||
it('opens the global file browser from the repos route', async () => {
|
||||
vi.mocked(useMobile).mockReturnValue(true)
|
||||
const queryClient = new QueryClient()
|
||||
const user = userEvent.setup()
|
||||
|
||||
render(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<MemoryRouter initialEntries={['/']}>
|
||||
<Routes>
|
||||
<Route path="*" element={<>
|
||||
<MobileTabBar />
|
||||
<LocationSpy />
|
||||
</>} />
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
</QueryClientProvider>,
|
||||
)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'Files' }))
|
||||
expect(screen.getByTestId('location')).toHaveTextContent('mobileTab=files')
|
||||
})
|
||||
|
||||
it('navigates to /assistant when assistant is clicked from repo context', async () => {
|
||||
vi.mocked(useMobile).mockReturnValue(true)
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
@@ -70,9 +70,10 @@ function buildGlobalTabs({ pathname, openSheet, open, close, navigate, isInsideR
|
||||
}
|
||||
|
||||
const inRepo = isInsideRepo && repoId !== null
|
||||
const filesAreScoped = inRepo || isAssistantPath(pathname)
|
||||
|
||||
const handleFilesClick = () => {
|
||||
if (inRepo) {
|
||||
if (filesAreScoped) {
|
||||
openRepoDialog('files')
|
||||
} else {
|
||||
open('files')
|
||||
|
||||
Reference in new issue
Block a user