Chat: show the active Claude account in the send tooltip, menu and limit banner

usage.account now carries the email and organization of the account
Claude Code is signed in to (from its initialize account, or the saved
account just switched to), sent at process start and after a switch.
The app shows it as the send tooltip's usage prefix, the Claude account
menu subtitle, the usage-limit banner's status line and the info sheet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 16:33:46 +00:00
parent e80f18969c
commit 0dc805ae0e
22 changed files with 386 additions and 62 deletions
@@ -100,6 +100,22 @@ String chatUsageRingResetTime(DateTime at, DateTime now) {
return '${local.day} ${months[local.month - 1]} $time';
}
/// The send button's tooltip: [label] ("Send"), then the account the chat
/// runs on and its usage: "sam@example.com · 5-hour 42% · resets 17:20 · …".
/// Either part may be missing; with neither the tooltip is the label alone.
String chatSendTooltip(
String label,
ChatAccountUsage? usage,
ChatUsageRing? ring,
DateTime now,
) {
final line = [
if (usage?.email case final email? when email.isNotEmpty) email,
if (ring != null) chatUsageRingSummary(ring, now),
].join(' · ');
return line.isEmpty ? label : '$label\n$line';
}
/// "5-hour 42% · resets 17:20 · Weekly 61% · resets Thu 09:00", then any
/// extra usage note.
String chatUsageRingSummary(ChatUsageRing ring, DateTime now) => [