diff --git a/packages/ui/v2/core/layouts/SettingsLayout.tsx b/packages/ui/v2/core/layouts/SettingsLayout.tsx index 3c9bad4b1f..fb9f152799 100644 --- a/packages/ui/v2/core/layouts/SettingsLayout.tsx +++ b/packages/ui/v2/core/layouts/SettingsLayout.tsx @@ -1,3 +1,4 @@ +import { UserPermissionRole, MembershipRole } from "@prisma/client"; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/react-collapsible"; import { useSession } from "next-auth/react"; import React, { ComponentProps, useEffect, useState } from "react"; @@ -85,7 +86,8 @@ const adminRequiredKeys = ["admin"]; const useTabs = () => { const session = useSession(); - const isAdmin = session.data?.user.role === "ADMIN"; + + const isAdmin = session.data?.user.role === UserPermissionRole.ADMIN; // check if name is in adminRequiredKeys return tabs.filter((tab) => { if (isAdmin) return true; @@ -124,11 +126,9 @@ const SettingsSidebarContainer = ({ className = "" }) => { {tabsWithPermissions.map((tab) => { return tab.name !== "teams" ? ( - <> +
-
+
{tab && tab.icon && ( )} @@ -136,23 +136,21 @@ const SettingsSidebarContainer = ({ className = "" }) => {
- {tab.children?.map((tab) => ( + {tab.children?.map((child) => ( ))}
- + ) : ( - <> +
-
+
{tab && tab.icon && ( )} @@ -194,7 +192,7 @@ const SettingsSidebarContainer = ({ className = "" }) => {
{team.logo && ( {team.name @@ -215,7 +213,7 @@ const SettingsSidebarContainer = ({ className = "" }) => { textClassNames="px-3 text-gray-900 font-medium text-sm" disableChevron /> - {(team.role === "OWNER" || team.role === "ADMIN") && ( + {(team.role === MembershipRole.OWNER || team.role === MembershipRole.ADMIN) && ( <> { ))} -
+

{t("add_a_team")}

- + ); })}