Skip to content

Commit f3f3fc6

Browse files
Gate settings admin tab by admin role
1 parent 7321a02 commit f3f3fc6

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

src/frontend/src/pages/SettingsPage/index.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ const SettingsPageBase = ({
107107
const SettingsPageWithClerk = () => {
108108
const { openUserProfile, openOrganizationProfile } = useClerk();
109109
const { organization, isLoaded: isOrganizationLoaded } = useOrganization();
110+
const isAdmin = useAuthStore((state) => state.isAdmin);
110111

111112
const canManageMembers = Boolean(
112113
isOrganizationLoaded && organization?.id && openOrganizationProfile,
@@ -144,16 +145,20 @@ const SettingsPageWithClerk = () => {
144145
onClick: handleManageMembers,
145146
disabled: !canManageMembers,
146147
},
147-
{
148-
title: "Admin",
149-
href: "/admin",
150-
icon: (
151-
<ForwardedIconComponent
152-
name="Shield"
153-
className="w-4 flex-shrink-0 justify-start stroke-[1.5]"
154-
/>
155-
),
156-
},
148+
...(isAdmin
149+
? [
150+
{
151+
title: "Admin",
152+
href: "/admin",
153+
icon: (
154+
<ForwardedIconComponent
155+
name="Shield"
156+
className="w-4 flex-shrink-0 justify-start stroke-[1.5]"
157+
/>
158+
),
159+
} satisfies SidebarNavItem,
160+
]
161+
: []),
157162
{
158163
title: "Debugging",
159164
href: "/settings/debugging",

0 commit comments

Comments
 (0)