From d914f5f3fd4bf9c63e132a4fc5f10145be11d590 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sat, 31 May 2025 11:17:36 -0500 Subject: [PATCH] hide disable from context menu for viewers --- web/src/components/menu/LiveContextMenu.tsx | 31 +++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/web/src/components/menu/LiveContextMenu.tsx b/web/src/components/menu/LiveContextMenu.tsx index 09e65aa44..300bd2212 100644 --- a/web/src/components/menu/LiveContextMenu.tsx +++ b/web/src/components/menu/LiveContextMenu.tsx @@ -46,6 +46,7 @@ import { } from "@/api/ws"; import { useTranslation } from "react-i18next"; import { useDateLocale } from "@/hooks/use-date-locale"; +import { useIsAdmin } from "@/hooks/use-is-admin"; type LiveContextMenuProps = { className?: string; @@ -90,6 +91,10 @@ export default function LiveContextMenu({ const { t } = useTranslation("views/live"); const [showSettings, setShowSettings] = useState(false); + // roles + + const isAdmin = useIsAdmin(); + // camera enabled const { payload: enabledState, send: sendEnabled } = useEnabledState(camera); @@ -301,17 +306,21 @@ export default function LiveContextMenu({ )} - -
sendEnabled(isEnabled ? "OFF" : "ON")} - > -
- {isEnabled ? t("camera.disable") : t("camera.enable")} -
-
-
- + {isAdmin && ( + <> + +
sendEnabled(isEnabled ? "OFF" : "ON")} + > +
+ {isEnabled ? t("camera.disable") : t("camera.enable")} +
+
+
+ + + )}