admin button added
This commit is contained in:
parent
8d007a7393
commit
8a45f49a04
@ -1,14 +1,13 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname, useRouter } from "next/navigation";
|
||||||
import { Dispatch, SetStateAction, useMemo, useState } from "react";
|
import { Dispatch, SetStateAction, useMemo, useState } from "react";
|
||||||
import { FaRegUserCircle } from "react-icons/fa";
|
import { FaRegUserCircle } from "react-icons/fa";
|
||||||
|
|
||||||
import { Currency } from "@appTypes/StoreModel";
|
import { Currency } from "@appTypes/StoreModel";
|
||||||
import AuthModal from "@components/AuthModal";
|
import AuthModal from "@components/AuthModal";
|
||||||
import { useStoreActions, useStoreState } from "@hooks/store";
|
import { useStoreActions, useStoreState } from "@hooks/store";
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
|
|
||||||
export default function Navbar({}: // currencySelector,
|
export default function Navbar({}: // currencySelector,
|
||||||
{
|
{
|
||||||
@ -18,7 +17,7 @@ export default function Navbar({}: // currencySelector,
|
|||||||
const user = useStoreState((state) => state.user);
|
const user = useStoreState((state) => state.user);
|
||||||
const selectedCurrency = useStoreState((state) => state.currency.selectedCurrency);
|
const selectedCurrency = useStoreState((state) => state.currency.selectedCurrency);
|
||||||
const setSelectedCurrency = useStoreActions((actions) => actions.currency.setSelectedCurrency);
|
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 navOptions = useMemo(() => ["Earthquakes"], []);
|
||||||
const aboutDropdown = ["Contact Us", "Our Mission", "The Team"];
|
const aboutDropdown = ["Contact Us", "Our Mission", "The Team"];
|
||||||
// { label: "Our Mission", path: "/our-mission" },
|
// { label: "Our Mission", path: "/our-mission" },
|
||||||
@ -136,6 +135,11 @@ export default function Navbar({}: // currencySelector,
|
|||||||
<ManagementNavbarButton name="Warehouse" href="/warehouse"></ManagementNavbarButton>
|
<ManagementNavbarButton name="Warehouse" href="/warehouse"></ManagementNavbarButton>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{user && user.role === "ADMIN" && (
|
||||||
|
<div className="flex h-full mr-5">
|
||||||
|
<ManagementNavbarButton name="Admin" href="/administrator"></ManagementNavbarButton>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<button className="my-auto mr-4" onClick={() => (user ? router.push("/profile") : setIsModalOpen(true))}>
|
<button className="my-auto mr-4" onClick={() => (user ? router.push("/profile") : setIsModalOpen(true))}>
|
||||||
<FaRegUserCircle size={22} />
|
<FaRegUserCircle size={22} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user