From bcbef91f99e4f451fe84ba953762e38c326707ae Mon Sep 17 00:00:00 2001 From: ddelpiano Date: Fri, 9 Feb 2024 12:56:31 +0100 Subject: [PATCH 1/3] SCKAN-262: fix UI crash for button menu --- frontend/src/components/Widgets/CustomGroupedButtons.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Widgets/CustomGroupedButtons.tsx b/frontend/src/components/Widgets/CustomGroupedButtons.tsx index 8ea777d1..0420f633 100644 --- a/frontend/src/components/Widgets/CustomGroupedButtons.tsx +++ b/frontend/src/components/Widgets/CustomGroupedButtons.tsx @@ -40,6 +40,7 @@ export default function GroupedButtons({handleClick, selectedOption, options, se aria-label="select merge strategy" aria-haspopup="menu" onClick={handleToggle} + disabled={options?.length > 0 ? false : true} > @@ -65,7 +66,7 @@ export default function GroupedButtons({handleClick, selectedOption, options, se - {options.map((option: string, index: number) => ( + {options?.map((option: string, index: number) => ( Date: Fri, 9 Feb 2024 15:14:37 +0100 Subject: [PATCH 2/3] rename disabled prop as its passed naming --- frontend/src/components/Widgets/CustomGroupedButtons.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Widgets/CustomGroupedButtons.tsx b/frontend/src/components/Widgets/CustomGroupedButtons.tsx index 0420f633..6d7f472a 100644 --- a/frontend/src/components/Widgets/CustomGroupedButtons.tsx +++ b/frontend/src/components/Widgets/CustomGroupedButtons.tsx @@ -9,7 +9,7 @@ import MenuList from "@mui/material/MenuList"; import MenuItem from "@mui/material/MenuItem"; import FormControl from "@mui/material/FormControl"; -export default function GroupedButtons({handleClick, selectedOption, options, selectedIndex, handleMenuItemClick , hasFormat = false, format, disabled}: any) { +export default function GroupedButtons({handleClick, selectedOption, options, selectedIndex, handleMenuItemClick , hasFormat = false, format, isDisabled}: any) { const anchorRef = React.useRef(null); const [open, setOpen] = React.useState(false); @@ -31,7 +31,7 @@ export default function GroupedButtons({handleClick, selectedOption, options, se return ( - +