UI: подтверждение перед отменой незавершённой и удалением сыгранной партии (модалка)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-26 16:57:35 +03:00
co-authored by Claude Opus 4.8
parent 4d365a373b
commit 7269afcd4e
3 changed files with 91 additions and 1 deletions
+41
View File
@@ -0,0 +1,41 @@
/** Переиспользуемое модальное подтверждение (без нативного confirm()). */
export function ConfirmDialog({
open,
title,
message,
confirmLabel = "Подтвердить",
cancelLabel = "Отмена",
danger = false,
onConfirm,
onCancel,
}: {
open: boolean;
title: string;
message?: string;
confirmLabel?: string;
cancelLabel?: string;
danger?: boolean;
onConfirm: () => void;
onCancel: () => void;
}) {
if (!open) return null;
return (
<div className="modal-overlay" onClick={onCancel}>
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-title">{title}</div>
{message && <p className="modal-msg">{message}</p>}
<div className="modal-actions">
<button className="btn btn-ghost" onClick={onCancel}>
{cancelLabel}
</button>
<button
className={"btn " + (danger ? "btn-danger-solid" : "btn-primary")}
onClick={onConfirm}
>
{confirmLabel}
</button>
</div>
</div>
</div>
);
}