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