import { useState, useEffect } from 'react'; import { Dialog, DialogContent, DialogTitle, DialogDescription } from '@/components/ui/dialog'; import { Progress } from '@/components/ui/progress'; import { WelcomeStep } from './WelcomeStep'; import { AISettingsStep } from './AISettingsStep'; import { ProjectStep } from './ProjectStep'; interface OnboardingDialogProps { open: boolean; onOpenChange: (open: boolean) => void; onProjectCreated?: (projectId: string) => void; onComplete: () => void; currentStep: number; onNextStep: () => void; onPreviousStep: () => void; initialPrompt?: string; } const STEPS = [ { id: 'welcome', title: 'Welcome' }, { id: 'ai-settings', title: 'AI Settings' }, { id: 'project', title: 'Create Project' }, ]; export function OnboardingDialog({ open, onOpenChange, onProjectCreated, onComplete, currentStep: propCurrentStep, onNextStep, onPreviousStep, initialPrompt = '' }: OnboardingDialogProps) { const [localStep, setLocalStep] = useState(propCurrentStep); // Sync local step with prop when it changes useEffect(() => { setLocalStep(propCurrentStep); }, [propCurrentStep]); const currentStep = Math.min(localStep, STEPS.length - 1); const progress = ((currentStep + 1) / STEPS.length) * 100; const handleNext = () => { if (currentStep < STEPS.length - 1) { setLocalStep(prev => prev + 1); onNextStep(); } }; const handlePrevious = () => { if (currentStep > 0) { setLocalStep(prev => prev - 1); onPreviousStep(); } }; const handleSkip = () => { onComplete(); onOpenChange(false); }; const handleComplete = () => { onComplete(); onOpenChange(false); }; const renderStep = () => { switch (STEPS[currentStep]?.id) { case 'welcome': return ( ); case 'ai-settings': return ( ); case 'project': return ( ); default: return null; } }; return (
Getting Started Onboarding Complete the onboarding process to get started with Shakespeare

Getting Started

{currentStep + 1} / {STEPS.length}
{STEPS.map((step, index) => ( {step.title} ))}
{renderStep()}
); }