'use client'; /** * Desktop Sidebar Navigation * * Vertical sidebar navigation for desktop (≥ 768px). * Shows three navigation links: Convo, Edit, Galaxy * Highlights the active mode based on app state machine. */ import { Stack, NavLink, Box, Title, Group, Divider, Text } from '@mantine/core'; import { IconMessageCircle, IconEdit, IconChartBubbleFilled } from '@tabler/icons-react'; import { useSelector } from '@xstate/react'; import { useAppMachine } from '@/hooks/useAppMachine'; import { UserMenu } from '@/components/UserMenu'; export function DesktopSidebar() { const actor = useAppMachine(); const state = useSelector(actor, (state) => state); const send = actor.send; const handleNavigation = (target: 'convo' | 'edit' | 'galaxy') => { console.log('[Desktop Nav] Navigating to:', target); if (target === 'convo') { send({ type: 'NAVIGATE_TO_CONVO' }); } else if (target === 'edit') { send({ type: 'NAVIGATE_TO_EDIT' }); } else if (target === 'galaxy') { send({ type: 'NAVIGATE_TO_GALAXY' }); } }; const isConvo = state.matches('convo'); const isEdit = state.matches('edit'); const isGalaxy = state.matches('galaxy'); console.log('[Desktop Nav] Current state:', state.value, { isConvo, isEdit, isGalaxy, }); return ( Ponderants logo Ponderants } active={isConvo} onClick={() => handleNavigation('convo')} variant="filled" color="blue" styles={{ root: { borderRadius: '8px', fontWeight: isConvo ? 600 : 400, }, }} /> } active={isEdit} onClick={() => handleNavigation('edit')} variant="filled" color="blue" styles={{ root: { borderRadius: '8px', fontWeight: isEdit ? 600 : 400, }, }} /> } active={isGalaxy} onClick={() => handleNavigation('galaxy')} variant="filled" color="blue" styles={{ root: { borderRadius: '8px', fontWeight: isGalaxy ? 600 : 400, }, }} /> } variant="filled" /> {/* Development state panel */} {process.env.NODE_ENV === 'development' && ( DEV: App State State: {JSON.stringify(state.value)} Tags: {Array.from(state.tags).join(', ')} Mode: {state.context.mode} {state.context.pendingNodeDraft && ( Draft: {state.context.pendingNodeDraft.title || '(untitled)'} )} {state.context.currentNodeId && ( Node: {state.context.currentNodeId} )} )} ); }