'use client'; import { usePythonBootstrap } from '@/hooks/use-python-bootstrap'; import { Progress } from '@/components/ui/progress'; import { Loader2, XCircle } from 'lucide-react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; const STAGE_LABELS: Record = { checking: 'Verificando', downloading: 'Baixando', extracting: 'Extraindo', creating_venv: 'Criando ambiente virtual', installing_pip: 'Instalando pip', copying_scripts: 'Copiando scripts', installing_deps: 'Instalando dependências', validating: 'Validando', done: 'Concluído', }; export function PythonBootstrapProgress() { const bootstrap = usePythonBootstrap(); // Se estiver completo e sem erro, não mostrar nada if (bootstrap.isComplete && !bootstrap.error) { return null; } // Se houver erro, mostrar alerta if (bootstrap.error) { return (
Erro no Bootstrap do Python O aplicativo não pode funcionar sem o runtime Python

{bootstrap.error}

Por favor, reinicie o aplicativo ou verifique os logs para mais detalhes.

); } // Mostrar progresso durante bootstrap const stageLabel = STAGE_LABELS[bootstrap.stage] || bootstrap.stage; const progressValue = bootstrap.progress ?? 0; return (
Inicializando Python Runtime Configurando ambiente Python para scraping web
{stageLabel} {bootstrap.progress !== null && ( {Math.round(progressValue * 100)}% )}
{bootstrap.progress !== null && ( )}

{bootstrap.message}

); }