"use client"; import { useState, useCallback } from 'react'; import { Search, Plus, LayoutList, Map, Folder, FileText, Settings, } from 'lucide-react'; import type { PaneType } from '../panes/types'; interface LeftToolbarProps { onSearchClick: () => void; onAddStuffClick: () => void; onSettingsClick: () => void; onPaneTypeClick: (paneType: PaneType) => void; activePane: 'A' | 'B'; slotAType: PaneType | null; slotBType: PaneType | null; } // Map pane types to their icons (chat removed in rah-light) const PANE_TYPE_ICONS: Record = { views: LayoutList, map: Map, dimensions: Folder, guides: FileText, }; const PANE_TYPE_LABELS: Record = { views: 'Feed', map: 'Map', dimensions: 'Dimensions', guides: 'Guides', }; // Pane types shown in the toolbar (excludes 'node' which is opened via Feed, chat removed in rah-light) const TOOLBAR_PANE_TYPES: PaneType[] = ['views', 'map', 'dimensions', 'guides']; interface ToolbarButtonProps { icon: typeof Search; label: string; shortcut?: string; onClick: () => void; disabled?: boolean; isActive?: boolean; } function ToolbarButton({ icon: Icon, label, shortcut, onClick, disabled, isActive }: ToolbarButtonProps) { const [isHovered, setIsHovered] = useState(false); return ( ); } interface PaneTypeButtonProps { icon: typeof LayoutList; label: string; paneType: PaneType; isOpen: boolean; isActivePane: boolean; onClick: () => void; } function PaneTypeButton({ icon: Icon, label, paneType, isOpen, isActivePane, onClick }: PaneTypeButtonProps) { const [isHovered, setIsHovered] = useState(false); // Determine color: green if open, brighter if it's the active pane const getColor = () => { if (isOpen) { return isActivePane ? '#4ade80' : '#22c55e'; // Brighter green for active } return isHovered ? '#aaa' : '#666'; }; return ( ); } export default function LeftToolbar({ onSearchClick, onAddStuffClick, onSettingsClick, onPaneTypeClick, activePane, slotAType, slotBType, }: LeftToolbarProps) { // Determine which pane types are currently open const openPaneTypes = new Set( [slotAType, slotBType].filter((t): t is PaneType => t !== null) ); // Determine which pane type is in the active pane (null if pane is closed) const activePaneType = activePane === 'A' ? slotAType : slotBType; return (
{/* Top section - Actions */}
{/* Middle section - Pane Types */}
{TOOLBAR_PANE_TYPES.map((paneType) => { const Icon = PANE_TYPE_ICONS[paneType]; const label = PANE_TYPE_LABELS[paneType]; const isOpen = openPaneTypes.has(paneType); const isActivePane = activePaneType === paneType; return ( onPaneTypeClick(paneType)} /> ); })}
{/* Bottom section - Settings */}
); }