From 3c60b4f56978d57eb3648bb23c0ce3de2ac8bc96 Mon Sep 17 00:00:00 2001 From: zomars Date: Tue, 13 Sep 2022 11:11:37 -0500 Subject: [PATCH] V2 Layout fixes --- .../ui/v2/core/layouts/SettingsLayout.tsx | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) 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")}

- + ); })}