Skip to content

UN-4290 [FEAT] Add the v1 account menu and organisation switcher - #2395

Open
athul-rs wants to merge 9 commits into
UN-4286-plugin-manifestfrom
UN-4290-v1-account-menu
Open

athul-rs wants to merge 9 commits into
UN-4286-plugin-manifestfrom
UN-4290-v1-account-menu

Conversation

@athul-rs

@athul-rs athul-rs commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What

  • The v1 account menu and organisation switcher (P2-T02, pages 01 and 19).
  • Account menu: name and e-mail, Profile & preferences, Help & docs, Sign out, and a account-menu.plan-billing slot that cloud fills.
  • Organisation switcher: the user's organisations with role, member count and region (from PB-T15), search, and a confirm step before switching.

Why

How

  • Sign out calls POST /logout, resets analytics and opens the URL the backend returns (the identity provider's logout). If the POST fails it falls back to the GET logout, which still ends the session.
  • A user with no name sees the e-mail once, as the title line.
  • lib/http.ts is a small axios client with the CSRF header. It is a stand-in for P0-T05 (UN-4313, the shared HTTP client) and is replaced when that lands.
  • Styling uses v0's CSS variables for now and moves to the P0-T04 tokens (and their #v1-portal container) when those land.

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No. All files are new and under frontend/src/v1/; nothing in v0 imports them, and no route renders them until the v1 shell (P2-T01) mounts them.

Database Migrations

  • None.

Env Config

  • None.

Relevant Docs

  • Design: frames NEW09 (account menu), O01 to O04 (switcher, confirm, single organisation, member), designs repo at 83e4fff.
  • Deferred, with owners: create organisation (the plan rule that forbids it is undecided); avatar photo; region labels (codes are shown as the backend sends them).

Related Issues or PRs

Dependencies Versions

  • None.

Notes on Testing

Screenshots

To add from the dev run.

Checklist

I have read and understood the Contribution Guidelines.

🤖 Generated with Claude Code

athul-rs and others added 7 commits October 27, 2026 18:05
P2-T02 (pages 01 and 19). The account menu from the avatar: identity,
Profile & preferences, the account-menu.plan-billing slot for cloud,
Help & docs and Sign out. Sign out POSTs /api/v1/logout with the CSRF
token, resets analytics and opens the returned URL; if the POST fails it
falls back to the GET logout. No "Switch to old version" item (D14).

The organisation switcher from the pill: search, a row per organisation
with role, member count and region (absent fields left out), the current
one marked, a confirmation before switching, the one-organisation and
member states, and a load error with retry. After a switch the app does a
full load of the same section in the new organisation, else its
dashboard. Create organisation is left for a decision (plan gap 6).

lib/http.ts is the shared client: session cookie, X-CSRFToken on unsafe
methods. Invisible until the shell (P2-T01) renders these components.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… has no name

Found on the dev preview: a user without a name got an empty title line
above the e-mail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e and guard the CSRF cookie

signOut now throws when the reply has no redirect URL so the GET logout
fallback runs. signOutAndLeave in services/session.ts owns the whole
sequence (POST, analytics reset, navigate, fallback) and AccountMenu calls
it. A malformed CSRF cookie sends no header instead of throwing. The
account trigger shows one letter, and the Help & docs link announces that
it opens in a new tab.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A switch in flight can no longer be cancelled, a 412 from the list sends the
user to sign-in, an empty search says so, the dialog's from side comes from
the current organisation, and overlapping list loads keep only the latest.
The loading text is a live region and the current row carries aria-current.
The Switch button gets the arrows icon, and avatars show two letters for a
one-word name while the pill shows one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

via Greptile

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] No blocking issue remains, with the two earlier theme findings addressed by dependent PR #2402.

Summary

Adds the v1 account menu, organisation search and confirmed switching, plus shared HTTP and sign-out helpers.

  • People can search and confirm before changing organisations.
  • People can open account details and sign out from the v1 menu.

Review used source and test inspection. No tests or browser checks were run; neither menu has a production route yet.

Reviews (3) · Last reviewed commit: "Merge branch 'UN-4286-plugin-manifest' i..." · Reviewed by Greptile

<li
key={org.id}
{...(isCurrent ? { "aria-current": "true" } : {})}
className={`flex h-14 items-center gap-2.5 rounded-lg px-2.5 ${isCurrent ? "bg-[#f5f5fa]" : ""}`}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Current row fades in darkness

The current organisation row always uses the light background #f5f5fa, but OrgLine uses --foreground, which becomes near-white in dark mode. This makes the organisation's name hard to read. Use a theme-aware background for this row.

Suggested change
className={`flex h-14 items-center gap-2.5 rounded-lg px-2.5 ${isCurrent ? "bg-[#f5f5fa]" : ""}`}
className={`flex h-14 items-center gap-2.5 rounded-lg px-2.5 ${isCurrent ? "bg-[var(--muted)]" : ""}`}
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/v1/shell/OrganizationSwitcher.tsx
Line: 307

Comment:
**Current row fades in darkness**

The current organisation row always uses the light background `#f5f5fa`, but `OrgLine` uses `--foreground`, which becomes near-white in dark mode. This makes the organisation's name hard to read. Use a theme-aware background for this row.

```suggestion
                        className={`flex h-14 items-center gap-2.5 rounded-lg px-2.5 ${isCurrent ? "bg-[var(--muted)]" : ""}`}
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid on this branch alone. The token port that follows #2399 moves the current row to bg-muted and defines --primary-muted in all three themes. Leaving this open until it lands.

className="z-50 flex w-[280px] flex-col gap-0.5 rounded-[10px] border border-[var(--border)] bg-[var(--sidebar)] p-1.5 shadow-[0_8px_24px_0_#0000001f]"
>
<div className="flex items-center gap-2.5 px-[9px] pt-1.5 pb-2">
<span className="flex size-9 shrink-0 items-center justify-center rounded-full bg-[var(--primary-muted)] text-[13px] font-semibold text-[var(--primary)]">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Avatar and badge backgrounds disappear

--primary-muted is not defined in the frontend styles. The account avatar, switch dialog icon and Current badge therefore lose their intended background. Use an existing colour variable or provide a fallback until the v1 colours land.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/v1/shell/AccountMenu.tsx
Line: 69

Comment:
**Avatar and badge backgrounds disappear**

`--primary-muted` is not defined in the frontend styles. The account avatar, switch dialog icon and Current badge therefore lose their intended background. Use an existing colour variable or provide a fallback until the v1 colours land.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid on this branch alone. The token port that follows #2399 moves the current row to bg-muted and defines --primary-muted in all three themes. Leaving this open until it lands.

jaseemjaskp added a commit that referenced this pull request Oct 29, 2026
…ins in the ignore check (UN-4270)

Reported by Athul while building #2394/#2395 on this branch:
- src/v1/tsconfig.json: skipLibCheck back on, as in tsconfig.json. Off, tsc
  also checked third-party typings, and @types/chai 5.2.3 and vitest 3.2.6
  both declare `containSubset`, so any v1 test importing vitest failed
  typecheck:v1. A fixture test now imports vitest to keep this covered.
- The "no v1 file is git-ignored" check skips src/v1/plugins/<id>/: cloud
  plugins copied there are git-ignored on purpose (#2394).
…o the viewport

The popover had no height limit, so with many organisations the rows ran
past the bottom of a short window. The panel now takes Radix's measured
available height (8px collision padding) and only the list scrolls, so
the search box stays in view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

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