import type { ReactNode } from 'react' import { useNavigate } from '@tanstack/react-router' import { AlertCircle, CheckCircle2, Circle, Loader2, Server, Settings, WifiOff, } from 'lucide-react' import { useTranslation } from 'react-i18next' import { cn } from '@/lib/utils' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Button } from '@/components/ui/button' type LoadingPhase = 'idle' | 'settings' | 'connection' | 'done' type StepStatus = 'pending' | 'loading' | 'done' function getSettingsStatus(phase: LoadingPhase): StepStatus { if (phase === 'settings') return 'loading' if (phase === 'connection' || phase === 'done') return 'done' return 'pending' } function getConnectionStatus( phase: LoadingPhase, connectionOk: boolean | null ): StepStatus { if (phase === 'connection') return 'loading' if (phase === 'done' && connectionOk) return 'done' return 'pending' } interface DeploymentAccessGuardProps { children: ReactNode loading: boolean loadingPhase?: LoadingPhase isEnabled: boolean connectionLoading: boolean connectionOk: boolean | null connectionError: string | null onRetry: () => void } function LoadingStep({ label, status, }: { label: string status: 'pending' | 'loading' | 'done' }) { return (