From 69793d9d47f65a40ed822e98cd500124dbe88f11 Mon Sep 17 00:00:00 2001 From: Carlos Ortiz Date: Sat, 1 Mar 2025 14:46:44 -0600 Subject: [PATCH] created top right badge with admin if it's admin and user if it's user --- sc4p-frontend/src/components/AdminBadge.tsx | 27 ++++++++++++++ sc4p-frontend/src/components/Navbar.tsx | 40 ++++----------------- 2 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 sc4p-frontend/src/components/AdminBadge.tsx diff --git a/sc4p-frontend/src/components/AdminBadge.tsx b/sc4p-frontend/src/components/AdminBadge.tsx new file mode 100644 index 0000000..7665c8f --- /dev/null +++ b/sc4p-frontend/src/components/AdminBadge.tsx @@ -0,0 +1,27 @@ +import React from "react"; +import { useAuth } from "../AuthContext"; // Adjust the path as needed + +const AdminBadge: React.FC = () => { + const { isAdmin } = useAuth(); + + return ( +
+ {isAdmin ? "Admin" : "User"} +
+ ); +}; + +export default AdminBadge; diff --git a/sc4p-frontend/src/components/Navbar.tsx b/sc4p-frontend/src/components/Navbar.tsx index 34a082f..f466b65 100644 --- a/sc4p-frontend/src/components/Navbar.tsx +++ b/sc4p-frontend/src/components/Navbar.tsx @@ -1,5 +1,7 @@ import React, { useState } from "react"; import BellIcon from "../images/bell-icon.png"; +import AdminBadge from "./AdminBadge"; + const Navbar: React.FC = () => { const [isToggled, setIsToggled] = useState(false); @@ -34,14 +36,13 @@ const Navbar: React.FC = () => { 2nd Chance for Pets - {/* Right-side Buttons */}
- {/* Toggle Button */} -
- {/* Sliding Circle */} -
-
+
);