import React from 'react'; import { Menu } from 'lucide-react'; import { useAppConfig } from '../contexts/AppConfigContext'; /** * Shared floating header used on every page so the app feels like one surface. * * Props: * currentPage: 'home' | 'chat' | 'canvas' | 'journey' | 'canvas-' * onNavigateToHome, onNavigateToChat, onNavigateToCanvas, onNavigateToJourney * (onNavigateToCanvas may receive 'workspace' | 'deliverables' to deep-link a view; * 'journey' is handled via onNavigateToJourney when provided) * onMobileMenu?: () => void — when present, shows the mobile menu button * children?: ReactNode — extra controls slotted in header-right */ const AppHeader = ({ currentPage = 'home', onNavigateToHome, onNavigateToChat, onNavigateToCanvas, onNavigateToJourney, onMobileMenu, children, }) => { const { config } = useAppConfig(); const goToCanvas = (view) => { if (view === 'journey') { if (onNavigateToJourney) onNavigateToJourney(); else if (onNavigateToCanvas) onNavigateToCanvas('journey'); return; } if (onNavigateToCanvas) onNavigateToCanvas(view); }; // Accept either 'canvas' (all canvas tabs highlight equally) or a more specific // 'canvas-' from CanvasPage so only the active one highlights. const isOnHome = currentPage === 'home'; const isOnChat = currentPage === 'chat'; const isOnJourney = currentPage === 'journey'; const isOnCanvas = currentPage === 'canvas' || currentPage.startsWith('canvas-'); const canvasSub = currentPage.startsWith('canvas-') ? currentPage.slice(7) : null; const tabActive = (sub) => isOnCanvas && (canvasSub === null ? false : canvasSub === sub); return (
{onMobileMenu && ( )}

{config?.app?.title || 'Advisory'}

{config?.app?.subtitle || 'AI-Powered Guidance'}

{/* Hide the view pill bar on the home page — home is a landing page, not part of the chat ↔ canvas surface. */} {!isOnHome && (
)} {/* Compact mobile dropdown — appears in place of the pill bar at narrow widths */} {!isOnHome && ( )}
{children}
); }; export default AppHeader;