import { useEffect, useCallback } from 'react' import { CheckCircle2, XCircle, Loader2, ExternalLink } from 'lucide-react' import { useSetupStatus, useHealthCheck } from '../hooks/useProjects' import { Button } from '@/components/ui/button' import { Card, CardContent } from '@/components/ui/card' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' interface SetupWizardProps { onComplete: () => void } export function SetupWizard({ onComplete }: SetupWizardProps) { const { data: setupStatus, isLoading: setupLoading, error: setupError } = useSetupStatus() const { data: health, error: healthError } = useHealthCheck() const isApiHealthy = health?.status === 'healthy' && !healthError const isReady = isApiHealthy && setupStatus?.claude_cli && setupStatus?.credentials // Memoize the completion check to avoid infinite loops const checkAndComplete = useCallback(() => { if (isReady) { onComplete() } }, [isReady, onComplete]) // Auto-complete if everything is ready useEffect(() => { checkAndComplete() }, [checkAndComplete]) return (
Let's make sure everything is ready to go
{description}
{(status === 'error' || status === 'warning') && helpLink && ( {helpText}