/** * Terminal Connection Progress * Displays connection progress with logs and timeout */ import { Loader2, Play } from 'lucide-react'; import React from 'react'; import { useI18n } from '../../application/i18n/I18nProvider'; import { Button } from '../ui/button'; import { ScrollArea } from '../ui/scroll-area'; export interface TerminalConnectionProgressProps { status: 'connecting' | 'connected' | 'disconnected'; error: string | null; timeLeft: number; isAwaitingUserInput?: boolean; showEnterReconnectHint?: boolean; isCancelling: boolean; showLogs: boolean; progressLogs: string[]; onCancelConnect: () => void; onCloseSession: () => void; onRetry?: () => void; reconnectLabel?: string; } export interface TerminalConnectionLogListProps { progressLogs: string[]; error?: string | null; } export const TerminalConnectionLogList: React.FC = ({ progressLogs, error, }) => (
{progressLogs.map((line, idx) => (
{line}
))} {error && (
{error}
)}
); export const TerminalConnectionProgress: React.FC = ({ status, error, timeLeft, isAwaitingUserInput = false, showEnterReconnectHint = false, isCancelling: _isCancelling, showLogs, progressLogs, onCancelConnect: _onCancelConnect, onCloseSession, onRetry, reconnectLabel, }) => { const { t } = useI18n(); return ( <>
{status === 'connecting' ? ( <> {isAwaitingUserInput ? t('terminal.progress.waitingForUserInput') : t('terminal.progress.timeoutIn', { seconds: timeLeft })} ) : ( <>
{error || t('terminal.progress.disconnected')} )}
{showLogs && ( )} {status !== 'connecting' && (
{showEnterReconnectHint && (
{t('terminal.progress.enterReconnectHint')}
)}
{onRetry && ( )}
)} ); }; export default TerminalConnectionProgress;