import { createLogger } from '@automaker/utils/logger'; import { useSetupStore } from '@/store/setup-store'; import { StepIndicator } from './setup-view/components'; import { WelcomeStep, ThemeStep, CompleteStep, ProvidersSetupStep, GitHubSetupStep, } from './setup-view/steps'; import { useNavigate } from '@tanstack/react-router'; const logger = createLogger('SetupView'); // Main Setup View export function SetupView() { const { currentStep, setCurrentStep, completeSetup } = useSetupStore(); const navigate = useNavigate(); // Simplified steps: welcome, theme, providers (combined), github, complete const steps = ['welcome', 'theme', 'providers', 'github', 'complete'] as const; type StepName = (typeof steps)[number]; const getStepName = (): StepName => { // Map old step names to new consolidated steps if (currentStep === 'welcome') return 'welcome'; if (currentStep === 'theme') return 'theme'; if ( currentStep === 'claude_detect' || currentStep === 'claude_auth' || currentStep === 'cursor' || currentStep === 'codex' || currentStep === 'opencode' || currentStep === 'providers' ) { return 'providers'; } if (currentStep === 'github') return 'github'; return 'complete'; }; const currentIndex = steps.indexOf(getStepName()); const handleNext = (from: string) => { logger.debug('[Setup Flow] handleNext called from:', from, 'currentStep:', currentStep); switch (from) { case 'welcome': logger.debug('[Setup Flow] Moving to theme step'); setCurrentStep('theme'); break; case 'theme': logger.debug('[Setup Flow] Moving to providers step'); setCurrentStep('providers'); break; case 'providers': logger.debug('[Setup Flow] Moving to github step'); setCurrentStep('github'); break; case 'github': logger.debug('[Setup Flow] Moving to complete step'); setCurrentStep('complete'); break; } }; const handleBack = (from: string) => { logger.debug('[Setup Flow] handleBack called from:', from); switch (from) { case 'theme': setCurrentStep('welcome'); break; case 'providers': setCurrentStep('theme'); break; case 'github': setCurrentStep('providers'); break; } }; const handleSkipGithub = () => { logger.debug('[Setup Flow] Skipping GitHub setup'); setCurrentStep('complete'); }; const handleFinish = () => { logger.debug('[Setup Flow] handleFinish called - completing setup'); completeSetup(); logger.debug('[Setup Flow] Setup completed, redirecting to dashboard'); navigate({ to: '/dashboard' }); }; return (
Automaker Setup