Skip to content

feat(dashboard): show org name in sidebar, move org picker from header#902

Merged
aaight merged 1 commit intodevfrom
feature/org-name-in-sidebar
Mar 16, 2026
Merged

feat(dashboard): show org name in sidebar, move org picker from header#902
aaight merged 1 commit intodevfrom
feature/org-name-in-sidebar

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 16, 2026

Summary

  • Extends auth.me API to return orgName for all users (not just superadmins via availableOrgs)
  • Updates OrgProvider to expose orgName in context, derived from availableOrgs for superadmins and from me.orgName for regular users
  • Replaces static "CASCADE" branding in the sidebar top-left with the current organization name (for regular users) or a Select dropdown org picker (for superadmins with multiple orgs)
  • Removes org picker and org name display from the header, simplifying it to just the mobile menu trigger and breadcrumbs

Card: https://trello.com/c/pySGhfyj/428-instead-of-cascade-name-in-the-upper-left-corner-of-the-screen-in-dashboard-ui-we-should-show-currently-logged-in-to-displayed-o

Changes

Backend (src/api/routers/auth.ts)

  • Import getOrganization from settingsRepository
  • Look up org by ctx.effectiveOrgId and include orgName in all me responses

Frontend Context (web/src/lib/org-context.tsx)

  • Added orgName: string | null to OrgContextValue interface
  • Added orgName?: string | null to MeData interface
  • Derive orgName in provider: from availableOrgs lookup for superadmins, from me.orgName for regular users
  • Expose orgName in context value

Sidebar (web/src/components/layout/sidebar.tsx)

  • Added OrgBranding sub-component: renders <Select> dropdown for superadmins with multiple orgs; static org name with Building2 icon for all other users
  • Removed LayoutDashboard icon and "CASCADE" text
  • Added imports: Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Building2, useOrgContext

Header (web/src/components/layout/header.tsx)

  • Removed org picker <Select> block and static org name fallback
  • Removed unused imports: Select*, Building2, useOrgContext
  • Removed orgName local variable computation
  • Left side simplified to mobile menu trigger + breadcrumbs only

Tests (tests/unit/api/routers/auth.test.ts)

  • Added mockGetOrganization mock
  • Updated both admin and superadmin test cases to assert orgName: 'Org One' is returned
  • Verified getOrganization is called with the effective org ID

Test plan

  • All 5404 unit tests pass
  • TypeScript type checking passes (zero errors)
  • Biome lint passes (zero errors)
  • Manual: regular user sees org name instead of "CASCADE" in sidebar
  • Manual: superadmin sees org picker dropdown in sidebar
  • Manual: switching org as superadmin updates sidebar
  • Manual: header no longer shows org picker or org name
  • Manual: mobile sidebar also shows org name/picker

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

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

Summary

LGTM — Clean feature relocation with correct data plumbing.

The change moves the org picker/name display from the header to the sidebar, adds orgName to the auth.me API response, and wires it through the OrgProvider context. The implementation is well-structured:

  • Backend: The extra getOrganization call in auth.me is a simple indexed lookup, and while slightly redundant for superadmins (who already get availableOrgs), it correctly provides orgName for regular users who don't receive the full org list. Pragmatic tradeoff.
  • Frontend context: orgName derivation correctly uses availableOrgs for superadmins (to reflect the switched-to org) and me.orgName for regular users. This handles the org-switching scenario where effectiveOrgId differs from me.orgId.
  • Sidebar: OrgBranding correctly gates the dropdown on isSuperadmin && availableOrgs.length > 1, falling back to static display for single-org superadmins and regular users. Mobile sidebar inherits this via component reuse.
  • Header cleanup: All removed imports and variables are confirmed unused in the final state.
  • Tests: Both admin and superadmin cases assert orgName and verify getOrganization is called with the correct ID. Mock cleanup is handled by vitest's global clearMocks: true.

All CI checks pass.

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit c940a24 into dev Mar 16, 2026
6 checks passed
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.

2 participants