From 8a45f49a04e762a38ba9c7d027502fd84d2a9826 Mon Sep 17 00:00:00 2001 From: Emily Neighbour Date: Mon, 12 May 2025 13:52:47 +0100 Subject: [PATCH] admin button added --- src/components/navbar.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx index b8a2414..af3804c 100644 --- a/src/components/navbar.tsx +++ b/src/components/navbar.tsx @@ -1,14 +1,13 @@ "use client"; import Image from "next/image"; import Link from "next/link"; -import { usePathname } from "next/navigation"; +import { usePathname, useRouter } from "next/navigation"; import { Dispatch, SetStateAction, useMemo, useState } from "react"; import { FaRegUserCircle } from "react-icons/fa"; import { Currency } from "@appTypes/StoreModel"; import AuthModal from "@components/AuthModal"; import { useStoreActions, useStoreState } from "@hooks/store"; -import { useRouter } from "next/navigation"; export default function Navbar({}: // currencySelector, { @@ -18,7 +17,7 @@ export default function Navbar({}: // currencySelector, const user = useStoreState((state) => state.user); const selectedCurrency = useStoreState((state) => state.currency.selectedCurrency); const setSelectedCurrency = useStoreActions((actions) => actions.currency.setSelectedCurrency); - const navOptions = useMemo(() => ["Earthquakes", "Observatories", "Shop","Administrator"], []); + const navOptions = useMemo(() => ["Earthquakes", "Observatories", "Shop"], []); // const navOptions = useMemo(() => ["Earthquakes"], []); const aboutDropdown = ["Contact Us", "Our Mission", "The Team"]; // { label: "Our Mission", path: "/our-mission" }, @@ -136,6 +135,11 @@ export default function Navbar({}: // currencySelector, )} + {user && user.role === "ADMIN" && ( +
+ +
+ )}