AppShell: clickable user menu with logout (fix missing logout UI)#43
Merged
Conversation
The topbar avatar was a static <div> — `api.logout()` existed but no UI surface called it, leaving users unable to sign out from the dashboard. Replace the avatar with a UserMenu component: clicking the avatar opens a dropdown anchored bottom-right showing the user email, team + tier, an Account-settings link, and a Log-out button. Click- outside and Escape both close the dropdown. UserMenu only reads `me.user.email`, `me.team.name`, and `me.team.tier` so the just-landed `experiments` field on /auth/me (PR #40) is left untouched. Tests: - 6 new tests cover trigger render, open/close, click-outside, Escape, logout-then-navigate, and settings navigation. - npm test: 290 pass / 3 skipped (was 284 / 3) across 15 files. - npm run build: clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
User report: "logout in dashboard is missing." Confirmed:
api.logout()clears the token atsrc/api/index.ts:190,ContractsPage.tsxreferences the/auth/logoutendpoint, but no UI surface called it. The topbar avatar atsrc/layout/AppShell.tsx:240was a static<div className="avatar">A</div>— visually clickable but inert. Users were stuck unless they cleared localStorage by hand.Replace it with a
UserMenucomponent:/app/settings) → Log out button.api.logout()thennavigate('/login').Coordination
P1 (PR #40) added the
experimentsfield on/auth/me. UserMenu only readsctx.me?.user?.email,ctx.me?.team?.name, andctx.me?.team?.tier—experimentsis untouched.Test plan
npm test— 290 pass / 3 skipped across 15 files (was 284 / 3 / 14). +6 new tests inUserMenu.test.tsx:role="menu"+ email/team/tier text)api.logout()called +/loginroute renders/app/settingsroute rendersnpm run build— clean (✓ built in 685ms, 116 static pages)/app/*, confirm dropdown opens, click "Log out", confirm token cleared and redirect to/login