From 162e46ed2d1e0c61bac5c8dbc77f89473261aa86 Mon Sep 17 00:00:00 2001 From: Sam Der Date: Sat, 16 Dec 2023 11:13:37 -0800 Subject: [PATCH 01/16] setup: get user identity utility --- apps/site/src/lib/utils/getUserIdentity.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 apps/site/src/lib/utils/getUserIdentity.ts diff --git a/apps/site/src/lib/utils/getUserIdentity.ts b/apps/site/src/lib/utils/getUserIdentity.ts new file mode 100644 index 00000000..69c07548 --- /dev/null +++ b/apps/site/src/lib/utils/getUserIdentity.ts @@ -0,0 +1,12 @@ +import api from "./api"; + +export interface Identity { + uid: string | null; + role: string | null; + status: string | null; +} + +export default async function getUserIdentity() { + const identity = await api.get("/user/me"); + return identity?.data; +} \ No newline at end of file From ff4d8642018113698b63208df90fd2a7be9e874b Mon Sep 17 00:00:00 2001 From: Sam Der Date: Sat, 16 Dec 2023 11:13:49 -0800 Subject: [PATCH 02/16] feat: integrate user identity with navbar --- apps/site/src/app/layout.tsx | 4 +-- .../site/src/lib/components/Navbar/Navbar.tsx | 29 ++++++++++++------- .../lib/components/Navbar/NavbarParent.tsx | 13 +++++++++ 3 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 apps/site/src/lib/components/Navbar/NavbarParent.tsx diff --git a/apps/site/src/app/layout.tsx b/apps/site/src/app/layout.tsx index 206395c0..d6ab1778 100644 --- a/apps/site/src/app/layout.tsx +++ b/apps/site/src/app/layout.tsx @@ -4,7 +4,7 @@ import Footer from "@/lib/components/Footer/Footer"; import "./globals.css"; import { Layout } from "@/components/dom/Layout"; -import Navbar from "@/lib/components/Navbar/Navbar"; +import NavbarParent from "@/lib/components/Navbar/NavbarParent"; export const metadata: Metadata = { title: "IrvineHacks 2024", @@ -26,7 +26,7 @@ export default function RootLayout({ className="overflow-x-hidden bg-top bg-repeat-y bg-[length:100%]" > {/* reference: https://github.com/pmndrs/react-three-next */} - + {children}