authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-07 21:01:48-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-07 21:01:48-07:00
log6ba15c027a6d411c7f75cc0ca59b601a295c3633
tree241c105bd420d230eeabc3426279302540368a36
parenta37c66406830525888465b2eaebf34df2265de86
signature Signed by PGP key B5690EEEBB952194

fix: hide email-bearing account labels in usage limits (#10668)


2 files changed, 52 insertions(+), 7 deletions(-)

apps/mobile/src/features/usage/UsageLimitsSection.tsx+24-3
......@@ -97,6 +97,29 @@ function WindowRow(props: {
9797 );
9898}
9999
100function AccountInstanceLabel({ value }: { readonly value: string }) {
101 const [revealed, setRevealed] = useState(false);
102 if (!value.includes("@")) {
103 return (
104 <Text className="shrink text-xs text-foreground-tertiary" numberOfLines={1}>
105 · {value}
106 </Text>
107 );
108 }
109 return (
110 <Pressable
111 className="shrink active:opacity-60"
112 accessibilityRole="button"
113 accessibilityLabel={revealed ? "Hide account label" : "Reveal account label"}
114 onPress={() => setRevealed((current) => !current)}
115 >
116 <Text className="text-xs text-foreground-tertiary" numberOfLines={1}>
117 · {revealed ? value : "••••••@••••••"}
118 </Text>
119 </Pressable>
120 );
121}
122
100123/** One account: icon, name and plan on a single line, then its windows. */
101124export function AccountLimits(props: {
102125 readonly driver: Driver;
......@@ -128,9 +151,7 @@ export function AccountLimits(props: {
128151 <View className="min-w-0 flex-1 flex-row items-baseline gap-2">
129152 <Text className="text-base font-t3-medium text-foreground">{props.label}</Text>
130153 {props.instanceLabel !== props.label ? (
131 <Text className="shrink text-xs text-foreground-tertiary" numberOfLines={1}>
132 · {props.instanceLabel}
133 </Text>
154 <AccountInstanceLabel key={props.instanceLabel} value={props.instanceLabel} />
134155 ) : null}
135156 {props.detail ? (
136157 <Text className="shrink text-sm text-foreground-muted" numberOfLines={1}>
apps/web/src/components/chat/ComposerUsageLimits.tsx+28-4
......@@ -3,6 +3,7 @@ import { limitsNotice } from "@t3tools/shared/usageLimits";
33import { GaugeIcon } from "lucide-react";
44
55import { getDriverOption } from "../settings/providerDriverMeta";
6import { RedactedSensitiveText } from "../settings/RedactedSensitiveText";
67import { LimitWindows, ResetCredits } from "../usage/UsageLimits";
78import { ComposerBanner } from "./ComposerBanner";
89import type { ComposerBannerStackItem } from "./ComposerBannerStack";
......@@ -20,6 +21,27 @@ function accountLabel(account: UsageLimitsReport["accounts"][number]): string {
2021 : driver;
2122}
2223
24function AccountSummary({ account }: { readonly account: UsageLimitsReport["accounts"][number] }) {
25 const label = accountLabel(account);
26 return (
27 <>
28 {label.includes("@") ? (
29 <RedactedSensitiveText
30 key={label}
31 value={label}
32 ariaLabel="Toggle account label visibility"
33 revealTooltip="Click to reveal account"
34 hideTooltip="Click to hide account"
35 className="max-w-full truncate align-bottom font-sans text-xs leading-normal"
36 />
37 ) : (
38 label
39 )}
40 {account.plan ? ` · ${account.plan}` : null}
41 </>
42 );
43}
44
2345/** The /usage-limits result as a composer notice: it stacks under warnings and dismisses like one. */
2446export function usageLimitsBannerItem(
2547 id: string,
......@@ -29,9 +51,11 @@ export function usageLimitsBannerItem(
2951): ComposerBannerStackItem {
3052 const [first] = report.accounts;
3153 const single = report.accounts.length === 1 && first ? first : null;
32 const summary = single
33 ? [accountLabel(single), single.plan].filter(Boolean).join(" · ")
34 : `${report.accounts.length} accounts`;
54 const summary = single ? (
55 <AccountSummary account={single} />
56 ) : (
57 `${report.accounts.length} accounts`
58 );
3559 return {
3660 id,
3761 variant: "info",
......@@ -65,7 +89,7 @@ function UsageLimitsBannerBody({
6589 <div key={account.id} className="flex min-w-0 flex-col gap-1">
6690 {report.accounts.length > 1 ? (
6791 <span className="truncate text-xs text-muted-foreground">
68 {[accountLabel(account), account.plan].filter(Boolean).join(" · ")}
92 <AccountSummary account={account} />
6993 </span>
7094 ) : null}
7195 {notice ? (