LibreChat/packages/client
Danny Avila 82cde522f2
💳 feat: Show Balance in the Context Gauge as Credits, Currency, or Percent (#16762)
* 💳 feat: Show Balance in the Context Gauge as Credits, Currency, or Percent

Move the balance out of the account menu into the composer's context gauge,
below the context window, and add `balance.display` (credits | currency |
percent, default credits) to choose how it reads. Currency reuses
`interface.currency` at 1,000,000 credits per USD; percent shows only the
share of the period's allotment spent.

Settings > Account > Billing renders the same summary from the same hook, so
both surfaces show identical figures, bar and refill timing in every mode.

* 🧭 fix: Normalize the Balance Display Mode and Reuse a Fresh Reading on Hover

Admin overrides reach the client without schema validation, so an unknown
`balance.display` now reads as credits instead of being typed as a mode it is
not. Hovering the gauge mounts the balance reader each time the card opens; a
30 s stale window stops every hover from refetching, while the explicit
refetch after each turn still bypasses it.

* 🩹 fix: Restore Gauge Popover Fixes and Tighten Balance States

The popover extraction was written from a pre-sync read of TokenUsage, so it
dropped dev's viewport caps and scrolling, the hideOnInteractOutside close fix,
the Tailwind v4 outline-hidden rename, and the card's max-w-full; restore them.

Refill copy now says when a refill becomes available rather than promising a
deposit, since one lands only once the interval has passed and a charge would
exhaust the balance. An empty balance reads as fully used even without an
allotment, percent mode without one says usage is unavailable instead of
leaving the figure blank, the balance-only ring takes the balance tone (amber
until empty) and is a meter only once it has a value.

* 🪙 fix: Read a Non-Positive Refill Amount as No Auto-Refill in Settings

The server never refills when the amount is not positive, and the balance
summary already says so; Settings showed its load error instead.

* 💸 fix: Show the Insufficient-Funds Error in the Balance Display Mode

The token-balance error still printed raw credit figures, so `percent` leaked
the numbers it hides and `currency` mixed units with the gauge. It now reads
the same display mode and formatter as the balance summary: credits as before,
money in currency mode, no figures in percent mode.

The auto-refill settings row also renders its own loading and failure states,
since settings search can show it without the balance row beside it.

* 🎚️ fix: Keep Fractional Credits and Drop the Moved Popover's Suppression

Credit amounts keep up to two decimals, so an insufficient-funds message no
longer reads 100.4 against 100.3 as 100 against 100; whole amounts still print
without decimals.

The design-rule backlog may not follow code into a new file, so the extracted
popover uses the standard `transition` utility instead of the arbitrary
`transition-[opacity,transform]` (which also misses Tailwind v4's separate
`translate` and `scale` properties) and its suppression is removed. The
composer geometry spec now reads the classes from `Popover.tsx`, where the
gauge button lives.
2026-10-05 06:46:44 -04:00
..
src 💳 feat: Show Balance in the Context Gauge as Credits, Currency, or Percent (#16762) 2026-10-05 06:46:44 -04:00
babel.config.js
jest.config.js 🧵 ci: Keep a Floor of Two Jest Workers in CI (#15819) 2026-09-14 00:32:20 -04:00
jest.resolver.cjs ⬆️ chore: Migrate off deprecated @ariakit/react-core to @ariakit/react-components (#13940) 2026-06-24 23:13:57 -04:00
jest.setup.ts
package.json 🔤 fix: Ship the Theme Font Faces With the Package (#16485) 2026-10-01 03:46:18 +00:00
tailwind.compat.cjs 🎨 feat: Check Color Tokens and Class Existence (#16041) 2026-10-01 03:46:16 +00:00
tailwind.config.js 🎨 feat: Check Color Tokens and Class Existence (#16041) 2026-10-01 03:46:16 +00:00
tailwind.preset.cjs 📏 feat: Size Roles for the Select List (#16714) 2026-10-03 15:25:23 +02:00
tsconfig.json ⚡ refactor: Migrate @librechat/client build to tsdown (#13596) 2026-06-08 11:20:03 -04:00
tsconfig.test.json
tsdown.config.mjs 🔤 fix: Ship the Theme Font Faces With the Package (#16485) 2026-10-01 03:46:18 +00:00