import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '../ui/dialog'; import { Button } from '../ui/button'; import type { CoupledRemovalDescription } from '../../utils/coupledRemoval'; interface CoupledRemovalConfirmDialogProps { description?: CoupledRemovalDescription; onConfirm: () => void; onOpenChange: (open: boolean) => void; // Set when the caller has already determined this removal cannot proceed (e.g. it would leave the // staff member with zero workspaces assigned). Renders an explanatory, non-destructive dialog in // place of the "Remove both" confirm - no destructive action is offered, and nothing is removed. blockedReason?: string; } // House modal rule: no Cancel button - the X dismisses; the single action sits bottom-right. // Open state is derived from `description` so there is one source of truth for "is there a pending removal". const CoupledRemovalConfirmDialog = ({ description, onConfirm, onOpenChange, blockedReason, }: CoupledRemovalConfirmDialogProps) => ( {blockedReason ? `Can't remove ${description?.removedLabel}` : `Remove ${description?.removedLabel}?`} {blockedReason ?? description?.message} {!blockedReason && ( )} ); export default CoupledRemovalConfirmDialog;