Skip to content

Ezra/295 role and profile UI - #301

Merged
ND68 merged 4 commits into
mainfrom
ezra/295-role-and-profile-ui
Mar 9, 2026
Merged

ND68 merged 4 commits into
mainfrom
ezra/295-role-and-profile-ui

Conversation

@ezraexe

@ezraexe ezraexe commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Description

Resolves ticket number: #295

Explain what your code changes:

src/auth/index.ts

  • Added partnerDetails to the query to the DB, extracted the siteName, and updated type declarations

src/components/context/UserContext.tsx

  • Added siteName to SessionUser type

src/components/NavBarLayout.tsx

  • Added getPortalLabel helper and added name display element

List the steps you took to test your code:

Checked expected behavior on 4 different accounts. Here are the images for those:
image

image image image

Checklist

  • The ticket is mentioned above
  • The changes fulfill the success criteria of the ticket
  • The changes were self-reviewed
  • A review was requested

@ezraexe
ezraexe requested a review from ND68 March 8, 2026 03:10
@ezraexe ezraexe linked an issue Mar 8, 2026 that may be closed by this pull request
@netlify

netlify Bot commented Mar 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for hope-for-haiti ready!

Name Link
🔨 Latest commit 02ad2ff
🔍 Latest deploy log https://app.netlify.com/projects/hope-for-haiti/deploys/69ad7a7c1c4f7800085c0618
😎 Deploy Preview https://deploy-preview-301--hope-for-haiti.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@greptile-apps

greptile-apps Bot commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR successfully implements role- and profile-aware UI in the navbar. Partners now see their site name (with fallback to account name), and the portal label distinguishes between "Partner Portal", "Admin Portal", and "Staff Portal" based on user role.

Changes verified:

  • src/auth/index.ts — selects partnerDetails at login and extracts siteName, threading it through the NextAuth JWT → session pipeline.
  • src/components/context/UserContext.tsx — extends SessionUser with the optional siteName field.
  • src/components/NavBarLayout.tsx — adds getPortalLabel helper and displays the site name (or fallback name) at the bottom of the navbar for partner users.

The implementation is sound: type declarations are consistent across modules, the JWT/session pipeline is correctly wired, and the UI fallback logic is clean. All changes are minimal and focused on the ticket requirements.

Confidence Score: 5/5

  • This PR is safe to merge — the changes are small, focused, and correctly implement the feature without introducing risks.
  • The PR is well-executed. Type declarations are consistent, the JWT/session pipeline correctly propagates siteName from database to UI, and the navbar display logic (including the getPortalLabel helper and name fallback) is sound. The author followed the ticket requirements and tested on multiple account types.
  • No files require special attention.

Sequence Diagram

sequenceDiagram
    participant DB as Database
    participant Auth as NextAuth authorize()
    participant JWT as JWT Callback
    participant Session as Session Callback
    participant Nav as NavBarLayout

    Auth->>DB: findUnique({ select: { partnerDetails: true, ... } })
    DB-->>Auth: user (with partnerDetails: Json?)
    Auth->>Auth: Extract siteName if type=PARTNER && partnerDetails
    Auth-->>JWT: user { siteName, type, name, ... }
    JWT->>JWT: token.siteName = user.siteName
    JWT-->>Session: token
    Session->>Session: session.user.siteName = token.siteName
    Session-->>Nav: session.user { siteName?, name, type, isSuper, ... }
    Nav->>Nav: getPortalLabel(isPartnerUser, isSuper)
    Nav->>Nav: Display siteName ?? name for partners
Loading

Last reviewed commit: da7b3d8

@ND68 ND68 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style looks good, code is simple. nice work

@ND68
ND68 merged commit 75af6d2 into main Mar 9, 2026
5 checks passed
@ND68
ND68 deleted the ezra/295-role-and-profile-ui branch March 9, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Role and Profile UI

2 participants