import { Check, Copy, ExternalLink } from 'lucide-react' import { type FC, useState } from 'react' import { Button } from '@/components/ui/button' import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from '@/components/ui/dialog' import type { PendingDeviceCode } from '@/lib/llm-providers/useOAuthProviderFlow' interface DeviceCodeDialogProps { deviceCode: PendingDeviceCode | null onClose: () => void } export const DeviceCodeDialog: FC = ({ deviceCode, onClose, }) => { const [copied, setCopied] = useState(false) const handleCopy = async () => { if (!deviceCode) return try { await navigator.clipboard.writeText(deviceCode.userCode) setCopied(true) setTimeout(() => setCopied(false), 2000) } catch { // Clipboard API failed } } return ( !open && onClose()}> Connect to {deviceCode?.providerName} Paste this code on the {deviceCode?.providerName} page that just opened in your browser.
{deviceCode?.userCode}

This dialog will close automatically once authentication completes.

{deviceCode?.verificationUri && ( Open verification page )}
) }