Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(usage): show each account's own mark in the Limits bar #11881

Closedvitalyiegorov(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/11881/headopened View on GitHub

Showing 4 changed files with 67 additions and 51 deletions (loading 1).

x
0 of 4 viewed, 4 left
29 additions and 13 deletionsapps/mobile/src/features/usage/UsageLimitsPooled.tsxModified
View file
@@ -21,7 +21,7 @@
​
import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text } from "../../components/AppText";
-import { ProviderIcon } from "../../components/ProviderIcon";
+import { ProviderIcon, ProviderInstanceIcon } from "../../components/ProviderIcon";
import { SettingsScreen } from "../settings/components/SettingsScreen";
import { environmentPresentations } from "../../state/presentation";
import { ResetCredits } from "./UsageLimitsSection";
@@ -37,6 +37,28 @@
return `${local[0] ?? ""}${domain[0] ?? ""}`.toUpperCase() || "Account";
​
+/**
+ * The account's own mark, matching the web Limits bar: the provider glyph with
+ * its account initials badge. Replaces the position number that was hard to map
+ * to an account.
+ */
+function AccountAvatar({ account }: { readonly account: LimitAccount }) {
+ return (
+ <ProviderInstanceIcon
+ provider={account.driver}
+ size={20}
+ // Initials from the full email, as on web: two addresses on one domain
+ // would otherwise share a badge.
+ displayName={account.displayName ?? account.email ?? accountName(account)}
+ accentColor={account.accentColor}
+ showBadge={Boolean(account.displayName ?? account.email)}
+ // The badge sits on hatched segments and list rows, with no single