mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix(frontend): collapse the linked-server project header when a tool panel is docked
This commit is contained in:
1 parent
50d920fe6c
commit
da5a9ebabf
4 files changed
+28
-26
No files matched your search
@@ -35,9 +35,15 @@ export function RemoteMultiRunButton({ serverId, directory }: { serverId: string
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button size="sm" variant="outline" onClick={handleOpen} className="shrink-0">
|
||||
<Layers className="mr-1 h-4 w-4" />
|
||||
Multi-run
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={handleOpen}
|
||||
aria-label="Multi-run"
|
||||
className="h-9 w-9 shrink-0 p-0 @min-[36rem]:w-auto @min-[36rem]:px-3"
|
||||
>
|
||||
<Layers className="h-4 w-4 @min-[36rem]:mr-2" />
|
||||
<span className="hidden @min-[36rem]:inline">Multi-run</span>
|
||||
</Button>
|
||||
{mounted ? (
|
||||
<RemoteMultiRun
|
||||
|
||||
@@ -32,11 +32,11 @@ export function RemoteSchedulesButton({ serverId, directory }: { serverId: strin
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => setOpen(true)}
|
||||
className="shrink-0"
|
||||
className="h-9 w-9 shrink-0 p-0 @min-[36rem]:w-auto @min-[36rem]:px-3"
|
||||
aria-label={`Schedules for ${directory}`}
|
||||
>
|
||||
<CalendarClock className="mr-1 h-4 w-4" />
|
||||
<span className="hidden sm:inline">Schedules</span>
|
||||
<CalendarClock className="h-4 w-4 @min-[36rem]:mr-2" />
|
||||
<span className="hidden @min-[36rem]:inline">Schedules</span>
|
||||
</Button>
|
||||
<RemoteSchedulesDialog
|
||||
serverId={serverId}
|
||||
|
||||
@@ -75,16 +75,16 @@ function RemoteProjectContent({ serverId, directory }: { serverId: string; direc
|
||||
return (
|
||||
<div className="flex h-full max-h-full min-w-0">
|
||||
<div className="flex h-full max-h-full min-w-0 flex-1 flex-col overflow-hidden bg-gradient-to-br from-background via-background to-background pb-[calc(env(safe-area-inset-bottom)+56px)] sm:pb-0">
|
||||
<Header>
|
||||
<Header className="@container">
|
||||
<div className="flex min-w-0 flex-1 items-center gap-2 sm:gap-3">
|
||||
<Header.BackButton to="/" />
|
||||
<Header.Title>{title}</Header.Title>
|
||||
<Badge variant="outline" className="hidden shrink-0 sm:inline-flex">
|
||||
<Badge variant="outline" className="hidden shrink-0 @min-[36rem]:inline-flex">
|
||||
<Server className="mr-1 h-3 w-3" />
|
||||
{server?.name ?? 'Linked server'}
|
||||
</Badge>
|
||||
{branch ? (
|
||||
<Badge variant="secondary" className="hidden shrink-0 md:inline-flex">
|
||||
<Badge variant="secondary" className="hidden shrink-0 @min-[44rem]:inline-flex">
|
||||
<GitBranch className="mr-1 h-3 w-3" />
|
||||
{branch}
|
||||
</Badge>
|
||||
@@ -95,31 +95,19 @@ function RemoteProjectContent({ serverId, directory }: { serverId: string; direc
|
||||
<>
|
||||
<RemoteSchedulesButton serverId={serverId} directory={directory} />
|
||||
<RemoteMultiRunButton serverId={serverId} directory={directory} />
|
||||
<Button
|
||||
onClick={handleCreateSession}
|
||||
disabled={createSession.isPending}
|
||||
size="sm"
|
||||
className="hidden bg-primary text-primary-foreground transition-all duration-200 hover:scale-105 hover:bg-primary-hover sm:inline-flex"
|
||||
>
|
||||
{createSession.isPending ? (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
)}
|
||||
<span>New Session</span>
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleCreateSession}
|
||||
disabled={createSession.isPending}
|
||||
aria-label="New Session"
|
||||
size="sm"
|
||||
className="h-10 w-10 bg-primary p-0 text-primary-foreground transition-all duration-200 hover:scale-105 hover:bg-primary-hover sm:hidden"
|
||||
className="h-9 w-9 bg-primary p-0 text-primary-foreground transition-all duration-200 hover:scale-105 hover:bg-primary-hover @min-[36rem]:w-auto @min-[36rem]:px-3"
|
||||
>
|
||||
{createSession.isPending ? (
|
||||
<Loader2 className="h-5 w-5 animate-spin" />
|
||||
<Loader2 className="h-4 w-4 animate-spin @min-[36rem]:mr-2" />
|
||||
) : (
|
||||
<Plus className="h-5 w-5" />
|
||||
<Plus className="h-4 w-4 @min-[36rem]:mr-2" />
|
||||
)}
|
||||
<span className="hidden @min-[36rem]:inline">New Session</span>
|
||||
</Button>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
@@ -155,7 +155,7 @@ describe('RemoteProject', () => {
|
||||
})
|
||||
renderProject()
|
||||
|
||||
fireEvent.click(screen.getAllByRole('button', { name: 'New Session' })[0])
|
||||
fireEvent.click(screen.getByRole('button', { name: 'New Session' }))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('session-route')).toBeInTheDocument()
|
||||
@@ -163,6 +163,14 @@ describe('RemoteProject', () => {
|
||||
expect(mocks.useCreateSession).toHaveBeenCalledWith('/home/me/app')
|
||||
})
|
||||
|
||||
it('exposes the header actions with a single accessible name each', async () => {
|
||||
renderProject()
|
||||
|
||||
expect(await screen.findByRole('button', { name: 'Schedules for /home/me/app' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'Multi-run' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'New Session' })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows a missing-directory state without rendering the session list', async () => {
|
||||
renderProject('/servers/srv_kitchen/projects')
|
||||
|
||||
|
||||
Reference in new issue
Block a user