Skip to content

feat(app): sidebar account entry with login avatar and logout - #341

Merged
quickbeard merged 4 commits into
mainfrom
feat/sidebar-account
Aug 28, 2026
Merged

quickbeard merged 4 commits into
mainfrom
feat/sidebar-account

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Summary

Adds an account entry to the sidebar, right under Settings:

  • Signed out — a Log in row (same styling as the other nav rows) that opens the existing configure dialog via the gateway.apiKey.new command.
  • Signed in — an avatar with the user's two initials (email on hover). Its menu holds Help — moved there from the sidebar, which no longer shows a Help row — and a new Log out (danger-styled).
  • Log out mirrors codevhub logout: it clears only the SSO token block from the shared auth file (the gateway API key and config blocks survive, so chat keeps working), writes the force-login sentinel so the next sign-in re-prompts for credentials, best-effort revokes both tokens against the SSO wrapper (3s cap, errors swallowed), and drops the hub admin cookie.

Implementation

  • @codev/gateway: new logout(), loadAccount() (identity on disk independent of access-token expiry — a refresh-revivable session still counts), clearSkillhubCookie(), markForceLogin(); revocation accepts a fetchImpl so the desktop passes Electron's net.fetch.
  • packages/desktop: controller gains getAccount()/logout() (logout cancels an in-flight login and resets state so every window's account UI refetches); new gateway-sso-get-account / gateway-sso-logout IPC channels; preload bridge extended.
  • packages/app: fork-only AccountNav component; app-sidebar.tsx now renders its own Settings row instead of HomeUtilityNav (Help lives only in the account menu; no upstream home.tsx edit needed; the e2e Settings handle is unchanged). i18n keys sidebar.login / sidebar.logout / sidebar.account in en/es/vi.
  • DIVERGENCES.md rows (persistent app sidebar, gateway key recovery) amended; CHANGELOG.md Unreleased entry added.

Testing

  • bun typecheck clean in codev-gateway, desktop, app.
  • bun test: gateway 60 pass (new logout/loadAccount/clearSsoSession suites), desktop 17 pass (new controller logout/getAccount tests), app 814 unit tests pass.
  • Live-verified in the dev desktop app via CDP: signed-in avatar shows initials with the email on hover, sidebar has no Help row, avatar menu shows Help + Log out; Log out itself exercised through the gateway/controller tests (not clicked against the real session).

🤖 Generated with Claude Code

https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx

quickbeard and others added 3 commits August 28, 2026 09:12
Add an account entry to the sidebar right under Settings: a Log in row
(opening the existing configure dialog) while signed out, and an
initials avatar while signed in whose menu holds Help (moved out of the
sidebar rows) and a new Log out.

Log out mirrors codevhub logout: @codev/gateway gains logout() — drop
the SSO block from the shared auth file (keeping the gateway api-key and
config blocks), leave the force-login sentinel, best-effort revoke both
tokens — plus loadAccount(), clearSkillhubCookie() and markForceLogin().
The desktop controller exposes getAccount/logout over new gateway-sso
IPC channels, cancelling any in-flight login on logout so every window's
account UI resets.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx
loadAccount showed the avatar for a file whose access token had expired
with no refresh token to revive it — a session no silent refresh can
bring back. Require the session to be live or refresh-revivable; a
present refresh token stays optimistic since its server-side validity
is unknowable from disk.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx
The initials avatar grows from 24px to 32px. The persistent "Session
upload is paused" toast now dismisses itself when a login completes
(phase "ready"), from whichever entry point — its own action, the
sidebar's Log in, or the menu item — instead of waiting for its close
button.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx
First-two-words initials read family + middle name for a
family-name-first name ("Nguyễn Hoàng Minh" showed NH); first + last
word yields NM there and is unchanged for two-word Western names. The
avatar menu now leads with the signed-in email as a group label above
Help and Log out.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BcADw33oD8qs5jvn5NWMJx
@quickbeard
quickbeard merged commit 4fce45e into main Aug 28, 2026
0 of 5 checks passed
@quickbeard
quickbeard deleted the feat/sidebar-account branch August 28, 2026 06:52
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