Skip to content

feat(mobile): Used/Remaining setting for the phone's usage bars - #43864

Merged
AmoabaKelvin merged 1 commit into
mainfrom
phone-usage-display-preference
Nov 18, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
phone-usage-display-preference

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

Desktop lets you choose whether usage bars count up (how much you've used) or count down (how much is left). The phone always counted up. Now the phone has the same choice in Settings › Appearance.

Files Added Deleted Net
Test 0 0 0 0
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​175 $\color{#cf222e}{\Huge{\mathbf{−}}}$​20 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​155

What Changed

  • Setting: Settings › Appearance has a new "Usage percentages" section with Used and Remaining. The choice is saved on this phone only, the same way desktop saves its own.
  • Bars: the Home Usage meters and the Accounts bars fill to the chosen percentage. Their colour still follows how much is used, as on desktop, so a nearly empty limit stays red. In Remaining mode the value reads "66% left". In Used mode nothing changes.
  • Accounts page: the desktop host serves the Accounts screen as a page. orca:usagePercentageDisplay is now in the page storage allowlist, in the negotiated keys, and in the list of keys the app republishes when Settings changes. On a page, the hook reads the app's copy of the setting.
  • Store: the preference store comes from @gsxdsm's composer-usage-display-preference.ts in feat(mobile): usage meter in the chat composer #36746, renamed and pointed at the bars.

Why

The phone always showed percentage used, but desktop has a Used/Remaining preference (usagePercentageDisplay). The issue asks for the same choice on the phone. Kelvin approved this design (option A) before it was built.

Supersedes the Used/Remaining part of #36746 by @gsxdsm. We kept their per-device preference store. Their PR is mostly a chat-composer usage meter stacked on #36726, which is parked for now.

Linked Issue

Fixes #27737

Visual Proof

These are rendered from the real mobile components (React Native Web, 390 pt wide) on the same host snapshot. Settings and Home are native screens, so they're shown with the same section, row and meter components and the same styles, not inside the app shell.

Before After
proof-mode-settings-before-display-used.png proof-mode-settings-display-remaining.png
proof-mode-accounts-display-used.png proof-mode-accounts-display-remaining.png
proof-mode-home-display-used.png proof-mode-home-display-remaining.png

Testing

  • Mobile typecheck and test typecheck pass, as do check:changed, check:code-quality:changed and verify:mobile-localization.

  • The 35 mobile test files related to the changed modules pass (131 tests). These include the page storage key and page AsyncStorage suites.

  • The path from native Settings to an open Accounts page was traced by both reviewers but not run on a device: persistMirrored, then the mirrored-key listener, then the page storage refresh frame, then the page's useShellStorage. It's the same path orca:nativeChatText already uses.

  • No tests added. The display math is desktop's shared getDisplayedUsagePercentage, and the storage lists are plain allowlist entries.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Risk

The riskiest part is the page storage contract. The new key is negotiated, so the app only sends it to a page that lists it in storageKeys. An Accounts page served by an older desktop never receives it and keeps showing Used. An older phone never sends it, so a newer page also shows Used. Home and Settings are native, so they follow the setting on any host.

Users who never touch the setting see no change.

Back out with a plain revert. A saved orca:usagePercentageDisplay value stays in phone storage, unused.

Level: Low

AI Disclosure

Review

Two reviewers, one round. Neither found a P0, P1 or P2. Changes from the review:

  • Fixed: the store now reads the saved choice when the module loads, so native screens don't draw Used for a frame before switching to Remaining.
  • Kept: in Remaining mode, "5% left" and "100% left" have different widths, so a card's tracks can end a few points apart. A fixed-width column would cut off longer translations.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The preference store is credited to @gsxdsm (#36746) with a Co-authored-by trailer. Mobile: older phones and older desktop pages keep Used, as described above. SSH/remote: none. Cross-platform: none.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Settings > Appearance gets a per-device Usage percentages choice. Home and Accounts
bars fill to the chosen percentage, keep colouring by consumption, and read
"N% left" when showing what remains. Open Accounts pages follow the setting through
the page storage refresh; older pages and phones keep showing used.

Co-authored-by: gsxdsm <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The mobile app adds a Used or Remaining preference for usage percentages in Appearance settings. It saves the preference and makes it available through page storage. The Home and Accounts usage bars use the selected mode for the displayed percentage, fill width, and value label. Fill color remains based on consumption.

Merge Risk: Minimal · up to 1b164

This adds a Used or Remaining display choice for usage percentages on mobile. Users who do not change the setting see no change. No merge-blocking risk was found. A brief stale selection in the Appearance screen on web is possible but not established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(mobile): Used/Remaining setting for the phone's usage bars" matches the main change. The PR adds a per-device Used/Remaining usage-percentage setting under mobile Settings › Appearance…
Description check Passed The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Fixes #27737), Visual Proof (before/after images in a table), Testing, Risk with level, AI Disclosur…
Linked Issues check Passed Directly linked issue #27737 requires a mobile Used / Remaining preference applied to usage bars on Home and Accounts. The diff summary shows the required pieces at the reviewed head: (1) Settings > A…
Out of Scope Changes check Passed All changed areas connect to #27737. UsageBar.tsx, MobileHomeUsageTab.tsx, and mobile-home-usage-styles.ts (minWidth instead of fixed width for the value label, needed for '% left' text) implement the…
Full details: Title check

Explanation

The title "feat(mobile): Used/Remaining setting for the phone's usage bars" matches the main change. The PR adds a per-device Used/Remaining usage-percentage setting under mobile Settings › Appearance, and the Home and Accounts usage bars follow it. The title is specific and concise.

Full details: Description check

Explanation

The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue (Fixes #27737), Visual Proof (before/after images in a table), Testing, Risk with level, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. The explanations are specific and cover the mechanism, the page storage contract, and the backout path.

Full details: Linked Issues check

Explanation

Directly linked issue #27737 requires a mobile Used / Remaining preference applied to usage bars on Home and Accounts. The diff summary shows the required pieces at the reviewed head: (1) Settings > Appearance gains a Used/Remaining selector (appearance-settings-screen.tsx, en.json strings); (2) a per-device preference store, usage-percentage-display-preference.ts, with useUsagePercentageDisplay; (3) Accounts bars in UsageBar.tsx use the displayed percentage for fill and label, with formatUsageBarValue rendering '% left' in Remaining mode; (4) Home meters in MobileHomeUsageTab.tsx use the same preference for fill, color and value text. The issue requires label, fill and warning colors to stay semantically consistent. The PR keeps color tied to consumption and fill and label tied to the chosen display, so a nearly exhausted limit stays red in both modes. Reset times and unavailable/loading states are preserved: unavailable bars pass null to the label formatter and render an em dash. The issue excludes changes to quota calculation and provider support; the diff summary shows none. The issue does not request automated tests, so the absence of added tests does not fail a stated requirement. Scope limit: this review used the diff summary and did not run the UI or read every hunk. The Accounts page path depends on the page storage contract described in the PR risk section; that path was not run on a device.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to #27737. UsageBar.tsx, MobileHomeUsageTab.tsx, and mobile-home-usage-styles.ts (minWidth instead of fixed width for the value label, needed for '% left' text) implement the bar requirement. usage-percentage-display-preference.ts and the Settings screen implement the selector. en.json adds the strings for that UI. page-storage-keys.ts adds orca:usagePercentageDisplay to the allowlist, negotiated keys, and republish list. The issue requires the preference on Accounts, and Accounts pages are served from the desktop host, so this change is needed for that requirement. The preference store is credited to #36746 and is the same mechanism used for the setting. It is supporting code, not unrelated work. No change in the summary falls outside the usage display preference.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 60df1338-f3b7-40eb-84d0-f7d3b62dbc18
Commits

Reviewing files that changed from the base of the PR and between 57184fb and 1b16408.

Files selected for processing: 7

  • mobile/src/accounts/usage/UsageBar.tsx
  • mobile/src/accounts/usage/usage-percentage-display-preference.ts
  • mobile/src/home/tabs/MobileHomeUsageTab.tsx
  • mobile/src/home/tabs/mobile-home-usage-styles.ts
  • mobile/src/i18n/locales/en.json
  • mobile/src/mobile-web-shell/page-storage/page-storage-keys.ts
  • mobile/src/settings/appearance-settings-screen.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@AmoabaKelvin
AmoabaKelvin merged commit 47c63cb into main Nov 18, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Mobile usage cards should offer Used / Remaining display preference

1 participant