Skip to content

fix(navbar): /me/ai-usage showed the visitor navbar while authenticated (#71)#72

Merged
trentas merged 1 commit into
RocketBus:mainfrom
gabriel-vieira-clickbus:fix/me-ai-usage-visitor-navbar
Jun 3, 2026
Merged

fix(navbar): /me/ai-usage showed the visitor navbar while authenticated (#71)#72
trentas merged 1 commit into
RocketBus:mainfrom
gabriel-vieira-clickbus:fix/me-ai-usage-visitor-navbar

Conversation

@gabriel-vieira-clickbus
Copy link
Copy Markdown
Contributor

Closes #71

Problem

After signing in, navigating to /me/ai-usage rendered the public/visitor navbar (Deck/FAQ, language toggle, Entrar / Começar) — making the page look logged out — even though the page body still rendered the user's personal AI-usage metrics. The session was never actually lost; only the header was wrong.

Root cause

/me/* is authenticated but lives outside src/app/[tenant]/, so it never inherits the tenant layout (which is what mounts the authenticated TenantNavbar). On top of that, ConditionalNavbar treated /me/ as a public prefix, so the root layout actively rendered the visitor Navbar there. Net result: authenticated content under a visitor header.

Changes

  • src/app/me/layout.tsx (new) — authenticated chrome for /me/*, mirroring [tenant]/layout.tsx: getServerSession guard (redirect to signin when unauthenticated) + TenantProvider + TenantNavbar, scoped to the user's primary org for the navbar links/org switcher. The layout owns the page padding (p-4 sm:p-6), consistent with how [tenant]/layout.tsx does it.
  • src/components/ConditionalNavbar.tsx — remove /me/ from PUBLIC_PREFIXES so the visitor navbar no longer renders on a logged-in page (with a comment so it isn't "helpfully" re-added).
  • src/app/me/ai-usage/page.tsx — drop the per-page padding that was sized for the floating visitor navbar (py-28 lg:pt-44); padding now comes from the layout.

Validation (local)

  • Logged out: GET /me/ai-usage307 to /auth/signin?callbackUrl=/me/ai-usage.
  • Logged in: GET /me/ai-usage200; rendered HTML contains the authenticated TenantNavbar shell (border-b bg-background/95) and zero occurrences of the visitor pill navbar (rounded-4xl). Before the fix this was inverted.
  • npx tsc --noEmit clean on the changed files; pre-commit eslint --fix + prettier applied.

Notes

  • A separate, pre-existing local issue causes GET /api/auth/* (csrf/session) to return 500 under password auth (NextAuth v4 + Next 16). It does not affect this fix or production (which uses GitHub OAuth), but it limits client-side useSession() hydration locally — worth a separate [BUG].

🤖 Generated with Claude Code

@clickbussuperuser
Copy link
Copy Markdown

Atlantis commands can't be run on fork pull requests. To enable, set --allow-fork-prs or, to disable this message, set --silence-fork-pr-errors

@clickbussuperuser
Copy link
Copy Markdown

Error parsing command: EOF found when expecting closing quote

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

@gabriel-vieira-clickbus is attempting to deploy a commit to the Clickbus Team on Vercel.

A member of the Team first needs to authorize it.

…ed (RocketBus#71)

/me/* is authenticated but lives outside /[tenant], so it never got the
tenant layout. ConditionalNavbar treated /me/ as a public prefix, so the
root layout rendered the visitor navbar (Entrar/Começar) on a logged-in
page even though the body still showed personal metrics.

- Add src/app/me/layout.tsx: authenticated chrome (session guard +
  TenantProvider + TenantNavbar) scoped to the user's primary org.
- Drop /me/ from ConditionalNavbar PUBLIC_PREFIXES so the visitor navbar
  no longer renders there.
- Move page padding into the layout (p-4 sm:p-6), matching how
  [tenant]/layout.tsx owns padding; drop the floating-navbar offset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gabriel-vieira-clickbus gabriel-vieira-clickbus force-pushed the fix/me-ai-usage-visitor-navbar branch from 83ec3ac to 95b2377 Compare June 2, 2026 22:30
@clickbussuperuser
Copy link
Copy Markdown

Atlantis commands can't be run on fork pull requests. To enable, set --allow-fork-prs or, to disable this message, set --silence-fork-pr-errors

@clickbussuperuser
Copy link
Copy Markdown

Error parsing command: EOF found when expecting closing quote

@trentas trentas merged commit 3ac7358 into RocketBus:main Jun 3, 2026
2 of 3 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.

[BUG] /me/ai-usage mostra navbar de visitante (deslogado) apesar da sessão ativa

3 participants