import { useEffect, useRef } from "react"; import { COLORS, FONT } from "./theme"; /** Confirmation modal for deleting a workspace. Warns when live terminals * would be killed, but still allows the delete (per product decision). */ export function ConfirmDelete({ name, activeCount, onConfirm, onCancel, }: { name: string; activeCount: number; onConfirm: () => void; onCancel: () => void; }) { const confirmRef = useRef(null); useEffect(() => { confirmRef.current?.focus(); }, []); function onKeyDown(e: React.KeyboardEvent) { e.stopPropagation(); if (e.key === "Escape") { e.preventDefault(); onCancel(); } else if (e.key === "Enter") { e.preventDefault(); onConfirm(); } } return (
e.stopPropagation()} onKeyDown={onKeyDown} style={{ width: 420, background: COLORS.bgApp, border: `1px solid ${COLORS.borderStrong}`, borderRadius: 14, padding: 24, color: COLORS.textPrimary, fontFamily: FONT.ui }} >
Delete workspace
Delete {name}? This removes the workspace and its layout.
{activeCount > 0 && (
{activeCount} active terminal{activeCount === 1 ? "" : "s"} will be terminated.
)}
); }