fix(plan): drop the redundant 'Zrušit' button in the category-management modal

The Správa kategorií modal footer had two buttons that both just close it (Zrušit + Zavřít). Added an opt-in hideCancel prop to the kit Modal (default false → every other modal unchanged) and set it on PlanCategoriesModal, leaving only 'Zavřít'. Verified: footer shows only Zavřít; close/Escape/backdrop intact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-07 17:09:59 +02:00
parent 3117e80027
commit fa90bcc93b
2 changed files with 9 additions and 3 deletions

View File

@@ -18,6 +18,8 @@ export interface ModalProps {
submitDisabled?: boolean;
submitText?: string;
cancelText?: string;
/** Hide the secondary cancel button (e.g. modals whose only action closes). */
hideCancel?: boolean;
maxWidth?: "xs" | "sm" | "md" | "lg";
}
@@ -33,6 +35,7 @@ export default function Modal({
submitDisabled = false,
submitText = "Uložit",
cancelText = "Zrušit",
hideCancel = false,
maxWidth = "sm",
}: ModalProps) {
useDialogScrollLock(isOpen);
@@ -73,9 +76,11 @@ export default function Modal({
</DialogTitle>
<DialogContent>{children}</DialogContent>
<DialogActions sx={{ px: 3, pb: 2 }}>
<MuiButton onClick={onClose} color="inherit" disabled={shown.loading}>
{cancelText}
</MuiButton>
{!hideCancel && (
<MuiButton onClick={onClose} color="inherit" disabled={shown.loading}>
{cancelText}
</MuiButton>
)}
<MuiButton
onClick={onSubmit}
variant="contained"