From 73aec1d9dbdf684bd223ac1282559d5d60c854e0 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Feb 2026 04:19:20 +0000 Subject: [PATCH] feat(studio): wire right icon rail to sidebar-manager-state Replace the placeholder local-state right rail with the real sidebar-manager-state system. The rail buttons now map to the registered sidebar panels (AI Assistant, Editor, Advisor) and toggling them opens/closes the same panels that Cmd+I / Cmd+E already control. - RightIconRail reads activeSidebar from the Valtio store and calls toggleSidebar on click - RightSidebarPanel renders the active sidebar's component in a fixed- width panel (420px) - DefaultLayoutV2 wraps content with LayoutSidebarProvider so panels are registered with their hotkeys and localStorage persistence https://claude.ai/code/session_01L9iApfr7zpXcfd3dnq6MAy --- .../layouts/NavigationV2/DefaultLayoutV2.tsx | 25 +++--- .../layouts/NavigationV2/RightIconRail.tsx | 82 ++++++++----------- .../components/layouts/NavigationV2/index.tsx | 2 +- 3 files changed, 48 insertions(+), 61 deletions(-) diff --git a/apps/studio/components/layouts/NavigationV2/DefaultLayoutV2.tsx b/apps/studio/components/layouts/NavigationV2/DefaultLayoutV2.tsx index d0896ecd4a7..447c4184104 100644 --- a/apps/studio/components/layouts/NavigationV2/DefaultLayoutV2.tsx +++ b/apps/studio/components/layouts/NavigationV2/DefaultLayoutV2.tsx @@ -6,6 +6,7 @@ import { AppBannerWrapper } from 'components/interfaces/App/AppBannerWrapper' import { SidebarInset, SidebarProvider } from 'ui' import { AppSidebarV2 } from './AppSidebarV2' import { RightRailLayout } from './RightIconRail' +import { LayoutSidebarProvider } from '../ProjectLayout/LayoutSidebar/LayoutSidebarProvider' import { ProjectContextProvider } from '../ProjectLayout/ProjectContext' export interface DefaultLayoutV2Props { @@ -30,17 +31,19 @@ export const DefaultLayoutV2 = ({ children }: PropsWithChildren -
- - - - {!router.pathname.startsWith('/account') && } - -
{children}
-
-
-
-
+ +
+ + + + {!router.pathname.startsWith('/account') && } + +
{children}
+
+
+
+
+
) } diff --git a/apps/studio/components/layouts/NavigationV2/RightIconRail.tsx b/apps/studio/components/layouts/NavigationV2/RightIconRail.tsx index ea3e87da55e..7ffa0a69293 100644 --- a/apps/studio/components/layouts/NavigationV2/RightIconRail.tsx +++ b/apps/studio/components/layouts/NavigationV2/RightIconRail.tsx @@ -1,40 +1,38 @@ -import { Bell, Bot, CircleHelp, Database, type LucideIcon } from 'lucide-react' -import { useMemo, useState, type ReactNode } from 'react' +import { Bot, Lightbulb, PenLine, type LucideIcon } from 'lucide-react' +import type { ReactNode } from 'react' +import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state' +import { SIDEBAR_KEYS } from '../ProjectLayout/LayoutSidebar/LayoutSidebarProvider' import { cn } from 'ui' -type RailItem = { +interface RailItem { + id: string label: string icon: LucideIcon } -const rightRailItems: RailItem[] = [ - { label: 'AI', icon: Bot }, - { label: 'SQL', icon: Database }, - { label: 'Alerts', icon: Bell }, - { label: 'Help', icon: CircleHelp }, +const RAIL_ITEMS: RailItem[] = [ + { id: SIDEBAR_KEYS.AI_ASSISTANT, label: 'AI', icon: Bot }, + { id: SIDEBAR_KEYS.EDITOR_PANEL, label: 'Editor', icon: PenLine }, + { id: SIDEBAR_KEYS.ADVISOR_PANEL, label: 'Advisor', icon: Lightbulb }, ] -export function RightIconRail({ - activeItemLabel, - onSelect, -}: { - activeItemLabel: string | null - onSelect: (label: string) => void -}) { +function RightIconRail() { + const { activeSidebar, toggleSidebar } = useSidebarManagerSnapshot() + return ( -