import React from "react"; import { Button } from "@/components/button.tsx"; import { Shield, ExternalLink, Loader2, AlertCircle } from "lucide-react"; import { useTranslation } from "react-i18next"; interface OPKSSHDialogProps { isOpen: boolean; authUrl: string; requestId: string; stage: "chooser" | "waiting" | "authenticating" | "completed" | "error"; error?: string; providers?: Array<{ alias: string; issuer: string }>; onCancel: () => void; onOpenUrl: () => void; onSelectProvider?: (alias: string) => void; backgroundColor?: string; } export function OPKSSHDialog({ isOpen, authUrl, stage, error, providers, onCancel, onOpenUrl, onSelectProvider, backgroundColor, }: OPKSSHDialogProps) { const { t } = useTranslation(); if (!isOpen) return null; return (

{t("terminal.opksshAuthRequired")}

{stage === "chooser" && (

{t("terminal.opksshAuthDescription")}

)}
{stage === "chooser" && ( <> {providers && providers.length > 0 && onSelectProvider ? (
{providers.map((provider) => ( ))}
) : authUrl ? ( ) : null}
)} {(stage === "waiting" || stage === "authenticating") && ( <>

{stage === "waiting" ? t("terminal.opksshWaitingForAuth") : t("terminal.opksshAuthenticating")}

)} {stage === "error" && error && ( <>

{t("common.error")}

{error}

)}
); }