fix(widgets): address CodeRabbit review — badge in context menu target, edit-only pending gate

- Move title badge inside WidgetContextMenu wrapper so right-clicking the title overlay also triggers the context menu
- Remove full-menu hide during integration loading; only disable 'Edit' action while isPending
- Add isPending to allActions useMemo dependency array
This commit is contained in:
ajnart committed 2026-06-29 15:10:34 +02:00
1 parent bf26f17fcd
commit 1136b3a99b
2 files changed
+27 -27

No files matched your search

@@ -59,32 +59,32 @@ export const BoardItemContent = ({ item }: BoardItemContentProps) => {
);
return (
<>
<WidgetContextMenu item={item} widgetStateRef={widgetStateRef}>
<WidgetContextMenu item={item} widgetStateRef={widgetStateRef}>
<div style={{ position: "relative" }}>
{cardElement}
</WidgetContextMenu>
{item.advancedOptions.title?.trim() && (
<Badge
pos="absolute"
// It's 4 because of the mantine-react-table that has z-index 3
style={{ zIndex: 4 }}
top={2}
left={16}
size="xs"
radius={board.itemRadius}
styles={{
root: {
"--border-color": item.advancedOptions.borderColor !== "" ? item.advancedOptions.borderColor : undefined,
"--opacity": board.opacity / 100,
},
}}
className={itemContentClasses.badge}
c="var(--mantine-color-text)"
>
{item.advancedOptions.title}
</Badge>
)}
</>
{item.advancedOptions.title?.trim() && (
<Badge
pos="absolute"
// It's 4 because of the mantine-react-table that has z-index 3
style={{ zIndex: 4 }}
top={2}
left={16}
size="xs"
radius={board.itemRadius}
styles={{
root: {
"--border-color": item.advancedOptions.borderColor !== "" ? item.advancedOptions.borderColor : undefined,
"--opacity": board.opacity / 100,
},
}}
className={itemContentClasses.badge}
c="var(--mantine-color-text)"
>
{item.advancedOptions.title}
</Badge>
)}
</div>
</WidgetContextMenu>
);
};
@@ -153,6 +153,7 @@ export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetCont
label: tItem("action.edit"),
icon: IconPencil,
onClick: openEditModal,
disabled: isPending,
});
actions.push({
key: "moveResize",
@@ -191,6 +192,7 @@ export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetCont
return actions.filter((a) => !a.hidden);
}, [
isEditMode,
isPending,
autoToggleActions,
widgetContextActions,
openEditModal,
@@ -202,8 +204,6 @@ export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetCont
duplicateItem,
]);
if (isPending) return <>{children}</>;
return (
<Menu shadow="md" width={200}>
<Menu.ContextMenu>{children}</Menu.ContextMenu>