/** * Debug Status Bar Component * * VS Code-style status bar at the bottom of the screen showing quick debug stats. * Clicking expands to show the full debug panel. */ import { memo } from 'react'; import { Bug, HardDrive, Cpu, Bot, ChevronUp, X, Maximize2, Minimize2 } from 'lucide-react'; import { cn } from '@/lib/utils'; import { useDebugStore } from '@/store/debug-store'; import { useDebugMetrics } from '@/hooks/use-debug-metrics'; import { formatBytes } from '@automaker/types'; interface DebugStatusBarProps { className?: string; } /** * Quick stat display component */ const QuickStat = memo(function QuickStat({ icon, label, value, onClick, className, }: { icon: React.ReactNode; label: string; value: string; onClick?: () => void; className?: string; }) { return ( ); }); export function DebugStatusBar({ className }: DebugStatusBarProps) { const { isOpen, isDockedExpanded, panelMode, setOpen, toggleDockedExpanded, setActiveTab, togglePanelMode, } = useDebugStore(); const metrics = useDebugMetrics(); // Only show in docked mode when debug is enabled if (panelMode !== 'docked') { return null; } // Don't render if debug panel is not open (toggled off with Ctrl+Shift+D) if (!isOpen) { return null; } const heapUsed = metrics.latestSnapshot?.memory.server?.heapUsed ?? 0; const cpuPercent = metrics.latestSnapshot?.cpu.server?.percentage ?? 0; const processCount = metrics.processSummary?.running ?? 0; return (
{/* Left side - Debug label and quick stats */}
{/* Debug label with status indicator */}
{/* Quick stats */} } label="Heap" value={formatBytes(heapUsed)} onClick={() => { setActiveTab('memory'); if (!isDockedExpanded) toggleDockedExpanded(); }} /> } label="CPU" value={`${cpuPercent.toFixed(0)}%`} onClick={() => { setActiveTab('cpu'); if (!isDockedExpanded) toggleDockedExpanded(); }} /> } label="Processes" value={String(processCount)} onClick={() => { setActiveTab('processes'); if (!isDockedExpanded) toggleDockedExpanded(); }} />
{/* Right side - Actions */}
{/* Toggle to floating mode */} {/* Close debug panel */}
); } /** * Debug Status Bar Wrapper - Only renders in development mode */ export function DebugStatusBarWrapper({ className }: DebugStatusBarProps) { const isDev = import.meta.env.DEV || import.meta.env.VITE_ENABLE_DEBUG_PANEL === 'true'; if (!isDev) { return null; } return ; }