@@ -3,6 +3,7 @@ import { limitsNotice } from "@t3tools/shared/usageLimits";
33import { GaugeIcon } from "lucide-react" ;
44
55import { getDriverOption } from "../settings/providerDriverMeta" ;
6+ import { 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
24+ function 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 ? (
0 commit comments