fix(widgets): gate context menu behind authenticated session
- Only show right-click context menu for logged-in users - Unauthenticated users see plain children without menu wrapper - Matches existing BoardItemMenu session gating pattern
This commit is contained in:
1 parent
2f7bdbfe1c
commit
8d22df5123
1 file changed
+4
@@ -5,6 +5,7 @@ import { Menu } from "@mantine/core";
|
||||
import { IconCopy, IconLayoutKanban, IconPencil, IconTrash } from "@tabler/icons-react";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useSession } from "@homarr/auth/client";
|
||||
import { useRequiredBoard } from "@homarr/boards/context";
|
||||
import { useEditMode } from "@homarr/boards/edit-mode";
|
||||
import { useConfirmModal, useModalAction } from "@homarr/modals";
|
||||
@@ -27,6 +28,7 @@ interface WidgetContextMenuProps {
|
||||
}
|
||||
|
||||
export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetContextMenuProps) => {
|
||||
const { data: session } = useSession();
|
||||
const [isEditMode] = useEditMode();
|
||||
const board = useRequiredBoard();
|
||||
const tItem = useScopedI18n("item");
|
||||
@@ -204,6 +206,8 @@ export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetCont
|
||||
duplicateItem,
|
||||
]);
|
||||
|
||||
if (!session) return <>{children}</>;
|
||||
|
||||
return (
|
||||
<Menu shadow="md" width={200}>
|
||||
<Menu.ContextMenu>{children}</Menu.ContextMenu>
|
||||
|
||||
Reference in new issue
Block a user