Skip to content

feat(widget): show a prepaid balance as its amount in the bar - #107

Merged
bernardopg merged 3 commits into
mainfrom
feat/bar-balance-pill
Nov 8, 2026
Merged

bernardopg merged 3 commits into
mainfrom
feat/bar-balance-pill

Conversation

@bernardopg

Copy link
Copy Markdown
Owner

Stacked on #106. Merge the stack bottom-up with a merge commit; until #106 merges, this diff also shows its commits.

Summary

Split out of #101 (the "prepaid balance pill" part by @DotRedstone, credited as co-author) and rebuilt around an explicit flag. Stacked on #106, because it shares the card header lines; review that one first.

A prepaid balance has no total to measure against, so its window reports 0% used (100% only once empty), and the bar read "100% left" for any balance. With this PR the bar pill, its tooltip, multi-window pills and the card header show the amount ($95.50, ¥9.34).

Changes from #101:

  • Explicit flag instead of a heuristic. feat(providers): add Grok Bot weekly quota adapter and fix bar/balance display #101 decided by matching English resetDescription text ("balance", "credits") and the shape of displayValue. Adapters now set isBalance: true on real balance windows: DeepSeek (all three), Kimi available balance, xAI prepaid credits, Cline credits (only when the balance is known), Ollama Cloud purchased credits and Vercel AI Gateway. Informational values such as Unlimited keep their percentage.
  • No currency table in QML. feat(providers): add Grok Bot weekly quota adapter and fix bar/balance display #101 rewrote CNY / USD / EUR / GBP prefixes in the widget and changed formatUsageLine() for every provider. Instead, DeepSeek formats at the source like the other balance adapters: currency symbol and two decimals (¥9.34 rather than CNY 9.34; unknown ISO codes keep their prefix).
  • Contract documented. isBalance is described in architecture.md and providers.md.

Tests:

  • test-cov-d2-deepseek.sh and test-cov-d-simple-api.sh cover symbols, rounding, unknown codes, the flag on all three windows and credits.remaining.
  • test-widget-runtime.sh renders a balance window and checks the pill, the card header, the tooltip, the multi-window pill row, and that an informational displayValue keeps its percentage. I ran it natively on Wayland.

Related issues

Part of #101.

Type of change

  • New provider
  • Bug fix
  • Enhancement
  • Documentation / i18n
  • CI / tooling

Checklist

  • plugin.json .version and CHANGELOG.md are consistent (not release-bearing; ## Unreleased bullet)
  • New/changed provider scripts are executable and emit valid JSON
  • i18n/en.json keys have translations in every locale
  • Every commit is signed off (git commit -s) under the DCO
  • CI is green

Local gates: check-metadata, check-changelog, check-dco, bash -n, shellcheck -S warning, qmllint, actionlint, gitleaks, every tests/test-*.sh (including the native widget runtime on Wayland), and AIOC_COVERAGE_MIN=95 scripts/coverage.

bernardopg and others added 2 commits November 8, 2026 15:51
A prepaid balance has no total to measure against, so its window
reports 0% used (100% only once it is empty) and the bar read 100% left
for any balance. Adapters now mark such a window with isBalance, and the
bar pill, its tooltip and the card header show its displayValue amount
instead of the percentage.

The flag is explicit rather than guessed from the label or the shape
of displayValue: DeepSeek, Kimi, xAI prepaid credits, Cline, Ollama
Cloud purchased credits and Vercel AI Gateway set it, and an
informational value such as Unlimited keeps its percentage. DeepSeek
formats its amounts at the source with the currency symbol and two
decimals, like the other balance adapters, so the widget hard-codes no
currency table.

Co-authored-by: dotredstone <[email protected]>
Signed-off-by: Bernardo Pinto Gomes <[email protected]>
@github-actions github-actions Bot added documentation Improvements or additions to documentation area:providers Provider adapters (providers/) area:i18n Translations (i18n/) area:qml QML UI code area:ci CI, workflows, tooling labels Nov 8, 2026
@github-actions github-actions Bot removed the area:i18n Translations (i18n/) label Nov 8, 2026
@bernardopg
bernardopg merged commit 51aa50f into main Nov 8, 2026
20 checks passed
@bernardopg
bernardopg deleted the feat/bar-balance-pill branch November 8, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, workflows, tooling area:providers Provider adapters (providers/) area:qml QML UI code documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant