From 4e38e04777396934bbfb869fff3f78f3672381ef Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 27 May 2026 13:43:01 +0200 Subject: [PATCH 1/2] feat(sidebar): hide unauthorized settings buttons in the sidebar for non-admins --- .../views/workspace/WorkspaceHomeView.tsx | 10 ++++++- .../views/workspace/WorkspaceSettingsView.tsx | 30 ++++++++++++------- .../workspaces/WorkspaceSettingsRoute.tsx | 11 ++++--- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/echo/frontend/src/features/sidebar/views/workspace/WorkspaceHomeView.tsx b/echo/frontend/src/features/sidebar/views/workspace/WorkspaceHomeView.tsx index 2917ac5f..2bc26d98 100644 --- a/echo/frontend/src/features/sidebar/views/workspace/WorkspaceHomeView.tsx +++ b/echo/frontend/src/features/sidebar/views/workspace/WorkspaceHomeView.tsx @@ -2,6 +2,7 @@ import { Trans } from "@lingui/react/macro"; import { Gear, House, Plus, PushPin } from "@phosphor-icons/react"; import { useMemo } from "react"; import { useParams } from "react-router"; +import { isAdminRole } from "@/lib/roles"; import { useWorkspace } from "@/hooks/useWorkspace"; import { useWorkspaceProjects } from "@/hooks/useWorkspaceProjects"; import { BackButton } from "../../primitives/BackButton"; @@ -29,6 +30,13 @@ export const WorkspaceHomeView = () => { const backLabel = workspace?.org_name ?? "Home"; const isExternal = workspace?.role === "external"; const canCreateProject = !isExternal; + const isAdmin = isAdminRole(workspace?.role); + const isBilling = workspace?.role === "billing"; + const settingsPath = isAdmin + ? `${base}/settings/general` + : isBilling + ? `${base}/settings/billing` + : `${base}/settings/members`; return (