import { NavLink, useLocation, useNavigate } from 'react-router-dom'; import { useBusiness } from '../context/BusinessContext'; import { getBusinessImage } from '../utils/businessProfile'; const SVG_ICONS = { analytics: ( ), globalSms: ( ), events: ( ), templates: ( ), }; function TopLevelStatus({ done, active }) { if (done) { return ( ); } if (active) { return ; } return ; } function StageMarker({ done, active, enabled }) { if (done) { return ( ); } if (active) { return ; } if (!enabled) { return ; } return ; } export default function Sidebar({ onOpenReview, reviewLoading = false, reviewError = '' }) { const { activeBusiness, activeBusinessId, clearBusiness, isSetupComplete, hasSelectedTemplates, } = useBusiness(); const navigate = useNavigate(); const location = useLocation(); const businessImage = getBusinessImage(activeBusiness); const analyticsPath = `/${activeBusinessId}/analytics`; const globalSmsPath = `/${activeBusinessId}/global-sms`; const eventsPath = `/${activeBusinessId}/events`; const templatesPath = `/${activeBusinessId}/templates`; const isAnalyticsRoute = location.pathname === analyticsPath; const isGlobalSmsRoute = location.pathname === globalSmsPath; const isEventsRoute = location.pathname === eventsPath; const isTemplatesRoute = location.pathname === templatesPath; const stepItems = [ { id: 'globalSms', to: globalSmsPath, label: 'Omni-channel SMS', enabled: true, done: isSetupComplete && !isGlobalSmsRoute, active: isGlobalSmsRoute, expanded: false, }, { id: 'events', to: eventsPath, label: 'Events', enabled: isSetupComplete, done: hasSelectedTemplates && !isEventsRoute, active: isEventsRoute, }, { id: 'templates', to: templatesPath, label: 'Templates', enabled: hasSelectedTemplates, done: false, active: isTemplatesRoute, }, ]; function handleSwitch() { clearBusiness(); navigate('/'); } return ( ); }