feat(web): add reusable ConfirmDialog and polish delete interactions

Extracts reusable ConfirmDialog component, refactors ship delete to show
the ship name in confirmation, and improves interaction consistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bas van Rossem
2026-02-19 16:27:43 +01:00
parent 1ef2f6338c
commit b3a55d9fac
2 changed files with 49 additions and 25 deletions

View File

@@ -0,0 +1,35 @@
import Modal from './Modal';
interface Props {
open: boolean;
onClose: () => void;
onConfirm: () => void;
title: string;
message: string;
confirmLabel?: string;
danger?: boolean;
}
export default function ConfirmDialog({
open,
onClose,
onConfirm,
title,
message,
confirmLabel = 'Confirm',
danger = false,
}: Props) {
return (
<Modal open={open} onClose={onClose} title={title}>
<p style={{ margin: 'var(--spacing-md) 0', lineHeight: 1.5 }}>{message}</p>
<div className="modal-actions">
<button className="btn-secondary" onClick={onClose}>
Cancel
</button>
<button className={danger ? 'btn-danger' : 'btn-primary'} onClick={onConfirm}>
{confirmLabel}
</button>
</div>
</Modal>
);
}