import { useAutoClose } from '../hooks/useAutoClose'; // --------------------------------------------------------------------------- // Icons // --------------------------------------------------------------------------- const CheckIcon = () => ( ); const ChatBubbleIcon = () => ( ); // --------------------------------------------------------------------------- // Component // --------------------------------------------------------------------------- interface CompletionOverlayProps { /** `done`: the session finished with nothing sent (an annotate Done with * no feedback). Neutral styling. `done` and `exited` (Close) send nothing, * so neither shows the "response has been sent" line. */ submitted: 'approved' | 'denied' | 'feedback' | 'done' | 'exited' | null | false; title: string; subtitle: string; agentLabel: string; /** * Optional destinations shown under the subtitle as ordinary links (opened * in a new tab by a real click, so no popup blocker applies) — e.g. the PR * a platform review was just posted to. Omitted or empty renders nothing. */ links?: ReadonlyArray<{ href: string; label: string }>; } export function CompletionOverlay({ submitted, title, subtitle, agentLabel, links }: CompletionOverlayProps) { const { state, enableAndStart } = useAutoClose(!!submitted); if (!submitted) return null; const isApproved = submitted === 'approved'; const isDone = submitted === 'done'; const sentNothing = isDone || submitted === 'exited'; return (
{isApproved || isDone ? : }

{title}

{subtitle}

{links && links.length > 0 && (
{links.map((link) => ( {link.label} ))}
)}
{state.phase === 'counting' ? ( <>

This tab will close in {state.remaining} second {state.remaining !== 1 ? 's' : ''}...

You can change this in Settings.

) : state.phase === 'closeFailed' ? ( <>

Could not close this tab automatically. Please close it manually.

Auto-close works when the tab is opened by {agentLabel}.

) : ( <>

You can close this tab and return to {agentLabel}.

{state.phase === 'prompt' ? ( <>

You can change the delay in Settings.

) : sentNothing ? null : (

Your response has been sent.

)} )}
); }