diff --git a/src/workspaces/officerdev/src/apps/Chat/components/UsagePopover.tsx b/src/workspaces/officerdev/src/apps/Chat/components/UsagePopover.tsx index c9714afc..04552754 100644 --- a/src/workspaces/officerdev/src/apps/Chat/components/UsagePopover.tsx +++ b/src/workspaces/officerdev/src/apps/Chat/components/UsagePopover.tsx @@ -154,7 +154,7 @@ const AccountSwitcher = ({ switchingTo: string | null; onSwitch: (accountUuid: string) => void; }) => ( -
+
{accounts.map((account) => { const busy = isSwitching && switchingTo === account.accountUuid; return ( @@ -180,9 +180,13 @@ const AccountSwitcher = ({ } ${isSwitching && !busy ? 'opacity-50' : ''}`} > {busy && } - {/* The local part alone: the domain is what these accounts have in common and the part before it - is what tells them apart, in a 320px panel. */} - {account.emailAccount.split('@')[0]} + {/* The WHOLE address. This showed the local part alone, on the reasoning that the domain is what + accounts have in common — which is wrong for the case that matters: a personal and a work + account belonging to one person are `andre.padez@gmail.com` and `andre.padez@pertento.ai`, so + the local part is the half they SHARE and the domain is the half that tells them apart. Two + chips read as the same account. The strip wraps instead of scrolling, so a long address is + readable rather than clipped off the edge. */} + {account.emailAccount} ); })} @@ -238,7 +242,14 @@ export function UsagePopover({ label, harness }: UsagePopoverProps) { another's chip lit — and that disagreement is the exact confusion this whole change set out to remove. */ const selected = accounts[0] ?? null; - const hidden = Math.max(0, allAccounts.length - accounts.length); + /* + Accounts with a stored READING but no stored credential — an old login that can be looked at and not + returned to. That is what is worth saying out loud. + + This counted `allAccounts - accounts` until the switcher existed, which then double-counted: it called + an account "not shown" while its chip sat two lines below. + */ + const unreachable = allAccounts.filter((a) => !switchable.some((s) => s.emailAccount === a.email)).length; // The countdowns tick. Only while the panel is open — an interval running behind a closed popover is a // re-render a minute for something nobody is looking at. @@ -287,9 +298,9 @@ export function UsagePopover({ label, harness }: UsagePopoverProps) { {switchError instanceof Error ? switchError.message : 'could not switch account'}
)} - {hidden > 0 && ( + {unreachable > 0 && (
- {hidden} other account{hidden === 1 ? '' : 's'} not shown + {unreachable} older account{unreachable === 1 ? '' : 's'} with no saved sign-in
)} {/*