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, hasGlobalSms, 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 omniSubsteps = [ { id: 'profile', label: 'Add / Select Profile', done: hasGlobalSms, active: isGlobalSmsRoute && !hasGlobalSms }, { id: 'validate', label: 'Validate cURL', done: hasGlobalSms, active: false }, { id: 'fields', label: 'Complete Fields', done: isSetupComplete, active: isGlobalSmsRoute && hasGlobalSms && !isSetupComplete }, { id: 'ready', label: 'Ready', done: isSetupComplete, active: isGlobalSmsRoute && isSetupComplete }, ]; const stepItems = [ { id: 'globalSms', to: globalSmsPath, label: 'Omni-channel SMS', enabled: true, done: isSetupComplete && !isGlobalSmsRoute, active: isGlobalSmsRoute, expanded: isGlobalSmsRoute, substeps: omniSubsteps, }, { 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 ( ); }