From 54dc5301a479cbd0e1cdc2b95ffe9d2215ed8e38 Mon Sep 17 00:00:00 2001 From: ezraexe Date: Sat, 7 Mar 2026 20:49:50 -0500 Subject: [PATCH 1/4] added changes for part 1 --- src/components/NavBarLayout.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/NavBarLayout.tsx b/src/components/NavBarLayout.tsx index 15816966..2f6c8d0e 100644 --- a/src/components/NavBarLayout.tsx +++ b/src/components/NavBarLayout.tsx @@ -230,6 +230,13 @@ function ResetButton() { ); } +function getPortalLabel(isPartnerUser: boolean, isSuper?: boolean) { + if (isPartnerUser) return "Partner Portal"; + if (isSuper) return "Admin Portal"; + + return "Staff Portal"; +} + function DesktopNavbar() { const { user } = useUser(); const isPartnerUser = isPartner(user?.type); @@ -243,7 +250,7 @@ function DesktopNavbar() { Hope for Haiti Logo

- {isPartnerUser ? "Partner Portal" : "Staff Portal"} + {getPortalLabel(isPartnerUser, user?.isSuper)}


@@ -275,7 +282,7 @@ function MobileNavbar() { className={`w-full h-full flex flex-col items-start transition-all ${open ? "opacity-100" : "opacity-0"}`} >

- {isPartnerUser ? "Partner Portal" : "Staff Portal"} + {getPortalLabel(isPartnerUser, user?.isSuper)}


From e566ea2566050ee0dd59018825aeb2ebd07ca28d Mon Sep 17 00:00:00 2001 From: ezraexe Date: Sat, 7 Mar 2026 21:57:27 -0500 Subject: [PATCH 2/4] added part 2 --- src/auth/index.ts | 10 ++++++++++ src/components/NavBarLayout.tsx | 3 +++ src/components/context/UserContext.tsx | 1 + 3 files changed, 14 insertions(+) diff --git a/src/auth/index.ts b/src/auth/index.ts index a47a7929..ff385889 100644 --- a/src/auth/index.ts +++ b/src/auth/index.ts @@ -27,6 +27,7 @@ declare module "next-auth" { enabled: boolean; pending: boolean; tag?: string; + siteName?: string; } interface Session { @@ -39,6 +40,7 @@ declare module "next-auth" { tag?: string; enabled: boolean; pending: boolean; + siteName?: string; } & DefaultSession["user"] & PermissionFlags; } @@ -54,6 +56,7 @@ declare module "next-auth/jwt" { streamUserId: string | null; streamUserToken: string | null; tag?: string; + siteName?: string; } } @@ -80,6 +83,7 @@ export const { handlers, signIn, signOut, auth } = NextAuth({ tag: true, streamUserId: true, streamUserToken: true, + partnerDetails: true, ...PERMISSION_SELECT, }, }); @@ -101,6 +105,10 @@ export const { handlers, signIn, signOut, auth } = NextAuth({ streamUserId: user.streamUserId, streamUserToken: user.streamUserToken, tag: user.tag ?? undefined, + siteName: + user.type === "PARTNER" && user.partnerDetails + ? (user.partnerDetails as { siteName?: string })?.siteName + : undefined, }; }, }), @@ -116,6 +124,7 @@ export const { handlers, signIn, signOut, auth } = NextAuth({ token.streamUserId = user.streamUserId; token.streamUserToken = user.streamUserToken; token.tag = user.tag; + token.siteName = user.siteName; PERMISSION_FIELDS.forEach((field) => { token[field] = user[field]; }); @@ -132,6 +141,7 @@ export const { handlers, signIn, signOut, auth } = NextAuth({ session.user.streamUserId = token.streamUserId; session.user.streamUserToken = token.streamUserToken; session.user.tag = token.tag; + session.user.siteName = token.siteName; PERMISSION_FIELDS.forEach((field) => { session.user[field] = Boolean(token[field]); }); diff --git a/src/components/NavBarLayout.tsx b/src/components/NavBarLayout.tsx index 2f6c8d0e..019a91dc 100644 --- a/src/components/NavBarLayout.tsx +++ b/src/components/NavBarLayout.tsx @@ -157,6 +157,9 @@ function NavLinks() { )} {/* Spacer to push the profile and sign out buttons to the bottom */}
  • +

    + {isPartnerUser ? user?.siteName : user?.name} +

    • Date: Sat, 7 Mar 2026 22:00:59 -0500 Subject: [PATCH 3/4] fixing up bugs --- src/components/NavBarLayout.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/NavBarLayout.tsx b/src/components/NavBarLayout.tsx index 019a91dc..08c26e0f 100644 --- a/src/components/NavBarLayout.tsx +++ b/src/components/NavBarLayout.tsx @@ -157,9 +157,11 @@ function NavLinks() { )} {/* Spacer to push the profile and sign out buttons to the bottom */}
    • -

      - {isPartnerUser ? user?.siteName : user?.name} -

      +
    • +

      + {isPartnerUser ? (user?.siteName ?? user?.name) : user?.name } +

      +
      • Date: Sun, 8 Mar 2026 09:32:37 -0400 Subject: [PATCH 4/4] Added Logged In As as per PR request --- src/components/NavBarLayout.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/NavBarLayout.tsx b/src/components/NavBarLayout.tsx index 08c26e0f..c9c545d5 100644 --- a/src/components/NavBarLayout.tsx +++ b/src/components/NavBarLayout.tsx @@ -159,6 +159,8 @@ function NavLinks() {
      • + Logged in as +
        {isPartnerUser ? (user?.siteName ?? user?.name) : user?.name }