/** * Terminal Connection Dialog * Full connection overlay with host info, progress indicator, and auth/progress content */ import { User } from 'lucide-react'; import React from 'react'; import { cn } from '../../lib/utils'; import { Host, SSHKey } from '../../types'; import { DistroAvatar } from '../DistroAvatar'; import { Button } from '../ui/button'; import { TerminalAuthDialog, TerminalAuthDialogProps } from './TerminalAuthDialog'; import { TerminalConnectionProgress, TerminalConnectionProgressProps } from './TerminalConnectionProgress'; export interface ChainProgress { currentHop: number; totalHops: number; currentHostLabel: string; } export interface TerminalConnectionDialogProps { host: Host; status: 'connecting' | 'connected' | 'disconnected'; error: string | null; progressValue: number; chainProgress: ChainProgress | null; needsAuth: boolean; showLogs: boolean; _setShowLogs: (show: boolean) => void; // Auth dialog props authProps: Omit; keys: SSHKey[]; // Progress props progressProps: Omit; } export const TerminalConnectionDialog: React.FC = ({ host, status, error, progressValue, chainProgress, needsAuth, showLogs, _setShowLogs: setShowLogs, // Rename back to setShowLogs for internal use authProps, keys, progressProps, }) => { const hasError = Boolean(error); const isConnecting = status === 'connecting'; return (
{/* Show chain progress if available */} {chainProgress ? ( <>
Chain{' '} {chainProgress.currentHop}{' '} of{' '} {chainProgress.totalHops}:{' '} {chainProgress.currentHostLabel}
SSH {host.hostname}:{host.port || 22}
) : ( <>
{host.label}
SSH {host.hostname}:{host.port || 22}
)}
{!needsAuth && ( )}
{/* Progress indicator - icons with progress bar below */}
{'>_'}
{needsAuth ? ( ) : ( )}
); }; export default TerminalConnectionDialog;