diff --git a/frontend/src/components/session/SessionPickerDialog.test.tsx b/frontend/src/components/session/SessionPickerDialog.test.tsx index 4aecddc2..1edfca4a 100644 --- a/frontend/src/components/session/SessionPickerDialog.test.tsx +++ b/frontend/src/components/session/SessionPickerDialog.test.tsx @@ -500,6 +500,20 @@ describe('SessionPickerDialog', () => { expect(combobox()).toHaveAttribute('placeholder', 'Search sessions...') }) + it('exposes a tabpanel labelled by the active tab and swaps panels on tab switch', async () => { + renderPicker() + + const sessionsPanel = screen.getByRole('tabpanel', { name: 'Sessions' }) + expect(sessionsPanel).toHaveAttribute('data-state', 'active') + expect(screen.queryByRole('tabpanel', { name: 'Projects' })).not.toBeInTheDocument() + + openProjectsTab() + + const projectsPanel = await screen.findByRole('tabpanel', { name: 'Projects' }) + expect(projectsPanel).toHaveAttribute('data-state', 'active') + expect(screen.queryByRole('tabpanel', { name: 'Sessions' })).not.toBeInTheDocument() + }) + it('lists repos in the projects tab and opens the cursor repo on Enter', async () => { mocks.repos = [repo(1, 'alpha', '/w/a'), repo(2, 'beta', '/w/b')] const { onSelectRepo } = renderPicker() diff --git a/frontend/src/components/session/SessionPickerDialog.tsx b/frontend/src/components/session/SessionPickerDialog.tsx index b3c03bda..1305a76e 100644 --- a/frontend/src/components/session/SessionPickerDialog.tsx +++ b/frontend/src/components/session/SessionPickerDialog.tsx @@ -14,7 +14,7 @@ import { } from '@/components/ui/dropdown-menu' import { Input } from '@/components/ui/input' import { SessionStatusIndicator } from '@/components/ui/session-status-indicator' -import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' import { DeleteSessionDialog } from '@/components/session/DeleteSessionDialog' import { ProjectPickerContent } from '@/components/session/ProjectPickerContent' import { partitionSessions } from '@/components/session/session-partition' @@ -765,7 +765,10 @@ export function SessionPickerDialog({ Projects - {tab === 'sessions' ? ( + - ) : ( + + - )} +