From db75080cfee058a0fc57a42d4383471810deae23 Mon Sep 17 00:00:00 2001 From: Ramir Mesquita Date: Wed, 20 Jul 2022 12:50:41 -0300 Subject: [PATCH 1/3] Adding capabilities property on session user and verifying the correct capability on menu rendering --- src/AppMenu.tsx | 69 ++++++++++++++++++++++++++++++++----------------- src/types.d.ts | 1 + 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/AppMenu.tsx b/src/AppMenu.tsx index 8592342..f2f42db 100644 --- a/src/AppMenu.tsx +++ b/src/AppMenu.tsx @@ -1,6 +1,8 @@ import React from "react"; import { Link } from "react-router-dom"; +import useCurrentUser from "./hooks/useCurrentUser"; + import playerSvg from "./assets/icons/player.svg"; import skull from "./assets/icons/skull.svg"; import sword from "./assets/icons/sword.svg"; @@ -14,6 +16,8 @@ interface GamesHQRouteOption { to: string; } export const AppMenu = ({ children }: { children: JSX.Element }) => { + const { currentUser } = useCurrentUser(); + const inspectRoutes = [ { name: "Inspect Arena", to: "/inspect/arena", icon: playerSvg }, ]; @@ -35,6 +39,7 @@ export const AppMenu = ({ children }: { children: JSX.Element }) => { const gameDevRoutes = [{ name: "Games", to: "/games", icon: games }]; const generateRouteList = (route: GamesHQRouteOption[]) => { + return route.map((route, i) => (