import { useState, useEffect, useRef, ReactNode } from 'react'; import { motion } from 'framer-motion'; import { MapPin, Navigation, Shield, Bot, X, ChevronLeft, ChevronRight, Volume2 } from 'lucide-react'; interface OnboardingStep { title: string; description: string; icon: ReactNode; highlight?: string; } interface OnboardingModalProps { onComplete: () => void; } const STEPS: OnboardingStep[] = [ { title: 'Plan Your Route', description: 'Enter your start location and destination in the sidebar. You can type an address, city, or use your current location.', icon: , highlight: 'sidebar' }, { title: 'Choose Your Vehicle', description: 'Select between Car or Bicycle mode. SafeRoute calculates the safest route based on your vehicle type and road conditions.', icon: , highlight: 'vehicle' }, { title: 'View Safety Score', description: 'Every route gets a Safety Score from 0-100%. Green means safe, amber means moderate risk, red means high risk. Plan accordingly!', icon: , highlight: 'safety' }, { title: 'Ask the AI Assistant', description: 'Click the chat button to get help with route planning, weather updates, finding nearby places, and driving tips.', icon: , highlight: 'assistant' }, { title: 'Keyboard Shortcuts', description: 'Press Ctrl+K to search, Ctrl+R to calculate route, Ctrl+, for settings. Press Esc to close panels. Use Tab to navigate.', icon: , highlight: 'shortcuts' } ]; export function OnboardingModal({ onComplete }: OnboardingModalProps) { const [currentStep, setCurrentStep] = useState(0); const dialogRef = useRef(null); useEffect(() => { document.body.style.overflow = 'hidden'; return () => { document.body.style.overflow = ''; }; }, []); const handleNext = () => { if (currentStep < STEPS.length - 1) { setCurrentStep(currentStep + 1); } else { onComplete(); } }; const handlePrev = () => { if (currentStep > 0) { setCurrentStep(currentStep - 1); } }; const handleSkip = () => { onComplete(); }; const step = STEPS[currentStep]; return (
{step.icon}

{step.title}

{step.description}

{STEPS.map((_, i) => (
{currentStep > 0 && ( )}

Step {currentStep + 1} of {STEPS.length}

); }