'use client' import type { ComponentType, ReactNode } from 'react' import { Tooltip, TooltipContent, TooltipTrigger, } from './../../../components/ui/primitives/tooltip' import { cn } from './../../../lib/utils' export type PanelId = string export type ExtraPanel = { id: string; icon: ReactNode; label: string; component: ComponentType } interface IconRailProps { activePanel: PanelId onPanelChange: (panel: PanelId) => void appMenuButton?: ReactNode extraPanels?: ExtraPanel[] className?: string } const sitePanel: { id: PanelId; iconSrc: string; label: string } = { id: 'site', iconSrc: '/icons/level.png', label: 'Site', } const settingsPanel: { id: PanelId; iconSrc: string; label: string } = { id: 'settings', iconSrc: '/icons/settings.png', label: 'Settings', } const panels: { id: PanelId; iconSrc: string; label: string }[] = [sitePanel, settingsPanel] export function IconRail({ activePanel, onPanelChange, appMenuButton, extraPanels, className, }: IconRailProps) { return (
{/* App menu slot */} {appMenuButton} {/* Divider */}
{/* Site panel */} {[sitePanel].map((panel) => { const isActive = activePanel === panel.id return ( {panel.label} ) })} {/* Extra panels (injected between site and settings) */} {extraPanels?.map((panel) => { const isActive = activePanel === panel.id return ( {panel.label} ) })} {/* Settings panel */} {[settingsPanel].map((panel) => { const isActive = activePanel === panel.id return ( {panel.label} ) })}
) } export { panels }