Skip to content

feat: header auth state — signed-in indicator, Open app + Log out (Privy)#43

Open
sweetmantech wants to merge 1 commit into
mainfrom
feat/header-auth-state
Open

feat: header auth state — signed-in indicator, Open app + Log out (Privy)#43
sweetmantech wants to merge 1 commit into
mainfrom
feat/header-auth-state

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Part of recoupable/chat#1850 (valuation-first homepage + funnel fixes) — the "marketing header auth state" item. Independent of the sibling marketing PR #42 (valuation card $0-tail collapse); either can merge first.

What

After Privy authentication (e.g. via the valuation flow), the site header still showed Sign In / Sign Up and offered no way to log out — testing the funnel fresh required manually clearing cookies (observed in the 2026-07-06 funnel walkthrough on chat#1850).

  • components/layout/HeaderAuth.tsx — renders the signed-in state (account initial avatar) when a Privy session exists; signed-out visitors see the existing Sign In / Sign Up pair unchanged.
  • components/layout/HeaderAccountMenu.tsx — account menu: Open appsiteConfig.appUrl (chat.recoupable.dev) and Log out via @privy-io/react-auth's logout().
  • contexts/PrivyAuthProvider.tsx + app/layout.tsx — the header previously rendered outside any Privy provider; the provider now wraps the layout so the header can read session state (same app id/config as the valuation flow).
  • lib/format/accountInitial.ts (+ test) — pure helper for the avatar initial, TDD (RED→GREEN).
  • components/layout/MobileSignInLink.tsx — mobile nav parity.

Done when (from the issue)

  • Signed-in visitor sees their session state on recoupable.dev and can log out (state flips back to Sign In / Sign Up).
  • Signed-out header unchanged.
  • pnpm build passes (this repo's verification gate).

Verification status: pnpm build green on this branch per the implementing run; logic helper unit-tested. Live signed-in verification on the Vercel preview requires a Privy OTP login — pending; will be exercised in the chat#1850 end-to-end funnel re-test.

🤖 Generated with Claude Code


Summary by cubic

Header now reflects the Privy auth state: shows an avatar menu with “Open app” and “Log out” when signed in, and keeps “Sign In / Sign Up” when signed out. Addresses the “marketing header auth state” requirement from chat#1850.

  • New Features
    • Wrapped Header with PrivyAuthProvider so it can read session state.
    • Added HeaderAuth to toggle between Sign In/Up and the signed‑in account menu.
    • Added HeaderAccountMenu with email, “Open app” (to siteConfig.appUrl), and “Log out” via @privy-io/react-auth’s logout().
    • Added MobileSignInLink to hide “Sign In” in the mobile menu when authenticated.
    • Added accountInitial helper (+ tests) for the avatar initial.

Written for commit b3447a4. Summary will update on new commits.

Review in cubic

After authenticating through the valuation flow the header still showed
Sign In / Sign Up, and the marketing surface had no logout at all (fresh
funnel tests required clearing cookies). The header now renders inside
the existing root PrivyAuthProvider: signed-in visitors get an avatar
menu (session email, "Open app" into chat, "Log out" via the Privy SDK);
signed-out visitors see the unchanged Sign In / Sign Up pair.

Part of recoupable/chat#1850.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marketing Ready Ready Preview Jul 6, 2026 6:51pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@sweetmantech, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5717b7da-cbd2-4e3d-9dae-dae06bffefbc

📥 Commits

Reviewing files that changed from the base of the PR and between f9862ee and b3447a4.

📒 Files selected for processing (8)
  • app/layout.tsx
  • components/layout/Header.tsx
  • components/layout/HeaderAccountMenu.tsx
  • components/layout/HeaderAuth.tsx
  • components/layout/MobileSignInLink.tsx
  • contexts/PrivyAuthProvider.tsx
  • lib/format/__tests__/accountInitial.test.ts
  • lib/format/accountInitial.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/header-auth-state

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="components/layout/HeaderAccountMenu.tsx">

<violation number="1" location="components/layout/HeaderAccountMenu.tsx:36">
P2: Screen-reader users can be told this is an ARIA menu, but keyboard interaction stays like plain links/buttons because menu keyboard behavior isn’t implemented. Consider either implementing full WAI-ARIA menu keyboard/focus handling or removing `role="menu"`/`role="menuitem"` so semantics match actual behavior.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

</button>
{open && (
<div
role="menu"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Screen-reader users can be told this is an ARIA menu, but keyboard interaction stays like plain links/buttons because menu keyboard behavior isn’t implemented. Consider either implementing full WAI-ARIA menu keyboard/focus handling or removing role="menu"/role="menuitem" so semantics match actual behavior.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At components/layout/HeaderAccountMenu.tsx, line 36:

<comment>Screen-reader users can be told this is an ARIA menu, but keyboard interaction stays like plain links/buttons because menu keyboard behavior isn’t implemented. Consider either implementing full WAI-ARIA menu keyboard/focus handling or removing `role="menu"`/`role="menuitem"` so semantics match actual behavior.</comment>

<file context>
@@ -0,0 +1,69 @@
+      </button>
+      {open && (
+        <div
+          role="menu"
+          className="absolute right-0 top-full mt-2 w-56 rounded-xl bg-(--background) py-1.5"
+          style={{
</file context>

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.

1 participant