diff --git a/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx b/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx index 7ae606241f..fe9ef7afd5 100644 --- a/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx +++ b/apps/desktop/src/app/chat/sidebar/connection-switcher.test.tsx @@ -161,6 +161,24 @@ describe('ConnectionSwitcher', () => { expect(selectConnection).toHaveBeenCalledTimes(1) }) + it('fits the shared statusbar slot without changing its gateway identity', () => { + $connectionsRegistry.set(registry([connection('local', 'This device', 'local'), connection('homelab', 'Homelab')])) + render() + + const group = screen.getByRole('group', { name: 'Registered gateways' }) + const trigger = screen.getByRole('button', { name: 'Registered gateways: This device' }) + + expect(group.className).toContain('h-full') + expect(group.className).toContain('min-w-20') + expect(group.className).toContain('max-w-40') + expect(group.className).toContain('shrink') + expect(group.className).toContain('overflow-hidden') + expect(trigger.className).toContain('text-[0.6875rem]') + expect(trigger.className).toContain('min-w-0') + expect(trigger.className).toContain('overflow-hidden') + expect(trigger.textContent).toContain('This device') + }) + it('keeps source controls stable while a remote is opening', () => { $connectionsRegistry.set(registry([connection('local', 'This device', 'local'), connection('homelab', 'Homelab')])) $pendingConnectionId.set('homelab') diff --git a/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx b/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx index 87c81f610d..9c7a398d76 100644 --- a/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx +++ b/apps/desktop/src/app/chat/sidebar/connection-switcher.tsx @@ -37,7 +37,7 @@ import { import { closeFindBar } from '@/store/find-in-page' import { notifyError } from '@/store/notifications' -export function ConnectionSwitcher({ onConnect }: { onConnect: () => void }) { +export function ConnectionSwitcher({ compact = false, onConnect }: { compact?: boolean; onConnect: () => void }) { const { t } = useI18n() const registry = useStore($connectionsRegistry) const activeConnectionId = useStore($activeConnectionId) @@ -132,7 +132,7 @@ export function ConnectionSwitcher({ onConnect }: { onConnect: () => void }) {
@@ -149,6 +149,7 @@ export function ConnectionSwitcher({ onConnect }: { onConnect: () => void }) { @@ -230,7 +231,10 @@ export function ConnectionSwitcher({ onConnect }: { onConnect: () => void }) { )} - + @@ -241,12 +245,14 @@ export function ConnectionSwitcher({ onConnect }: { onConnect: () => void }) { interface ConnectionMenuProps { activeConnection?: DesktopRegistryConnection + compact: boolean pending: boolean title: string } function ConnectionSwitcherTrigger({ activeConnection, + compact, pending, title, ...triggerProps @@ -257,6 +263,7 @@ function ConnectionSwitcherTrigger({ aria-label={activeConnection ? `${title}: ${activeConnection.label}` : title} className={cn( 'w-full min-w-0 justify-between overflow-hidden px-1 text-(--ui-text-secondary) data-[state=open]:bg-(--ui-control-active-background) data-[state=open]:text-foreground', + compact && 'h-full min-h-0 rounded-none px-1.5 text-[0.6875rem] font-normal', triggerProps.className )} size="xs" diff --git a/apps/desktop/src/app/chat/sidebar/profile-rail-connect.test.tsx b/apps/desktop/src/app/chat/sidebar/profile-rail-connect.test.tsx index bc2414284d..5a0d2b0a93 100644 --- a/apps/desktop/src/app/chat/sidebar/profile-rail-connect.test.tsx +++ b/apps/desktop/src/app/chat/sidebar/profile-rail-connect.test.tsx @@ -59,8 +59,6 @@ vi.mock('@/store/profile', () => ({ vi.mock('@/store/connections', () => ({ $hasMultipleConnections: atom(false) })) -vi.mock('./connection-switcher', () => ({ ConnectionSwitcher: () => null })) - vi.mock('@/store/profile-share', () => ({ runExportProfileFlow: vi.fn(), runImportProfileFlow: vi.fn() @@ -110,11 +108,11 @@ describe('ProfileRail multi-gateway entry point', () => { expect(screen.getByRole('button', { name: 'Manage profiles…' })).toBeTruthy() }) - it('does not duplicate the default home when source buttons identify multiple single-profile backends', () => { + it('keeps the active profile explicit when gateway identity moves to the statusbar', () => { hasMultipleConnections.set(true) render() - expect(screen.queryByRole('button', { name: 'default' })).toBeNull() + expect(screen.getByRole('button', { name: 'default' })).toBeTruthy() expect(screen.queryByRole('button', { name: 'Manage gateways…' })).toBeNull() expect(screen.getByRole('button', { name: 'Manage profiles…' })).toBeTruthy() }) @@ -139,7 +137,7 @@ describe('ProfileRail multi-gateway entry point', () => { expect(screen.getByRole('button', { name: 'Profiles' })).toBeTruthy() }) - it('stays shrinkable when source and condensed profile controls coexist', () => { + it('stays shrinkable with many profiles and multiple gateways', () => { hasMultipleConnections.set(true) profiles.set([ { is_default: true, name: 'default' }, diff --git a/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx b/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx index 924bda27cd..5b86c788f5 100644 --- a/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx +++ b/apps/desktop/src/app/chat/sidebar/profile-switcher.tsx @@ -78,7 +78,6 @@ import { DeleteProfileDialog } from '../../profiles/delete-profile-dialog' import { RenameProfileDialog } from '../../profiles/rename-profile-dialog' import { PROFILES_ROUTE, SETTINGS_ROUTE } from '../../routes' -import { ConnectionSwitcher } from './connection-switcher' import { useProfilePrewarm } from './use-profile-prewarm' import { useProfileRailRefreshOnActive } from './use-profile-rail-refresh-on-active' @@ -114,11 +113,9 @@ const stepThroughCells: Modifier = ({ containerNodeRect, draggingNodeRect, trans // Arc-Spaces-style profile rail at the sidebar foot: a default↔all toggle pinned // left, the colored named profiles scrolling between, and Manage pinned right. -// The active profile pops in its own color — the "where am I" cue. Single- -// source users see the default home, "+", and Manage. With several sources, a -// named environment selector sits before a separator; square profile identities -// follow it. Colored named squares and the default↔all toggle only appear once -// a second profile exists on the active source. +// The active profile pops in its own color — the "where am I" cue. Gateway +// identity lives in the statusbar, so this strip remains entirely available to +// profiles regardless of how many backends are registered. export function ProfileRail() { const { t } = useI18n() const p = t.profiles @@ -243,8 +240,6 @@ export function ProfileRail() { return (
- navigate(`${SETTINGS_ROUTE}?tab=connections`)} /> - {multipleConnections &&