AdminCustomersPage: USD default + INR toggle for founder-friendly MRR display#46
Merged
Merged
Conversation
Track B (PR #45) shipped MRR formatted as INR because that's the wire format Track A returns (paise). Founder convention for SaaS dashboards is USD — switch the default and add an INR toggle for India context. - New src/lib/currency.ts with formatINR / formatUSD / formatMoney + resolveInrToUsd. Static rate constant (INR_TO_USD = 0.012, May 2026), override via VITE_INR_TO_USD at build time. Inline comments note this is directional signal only; daily-refreshed FX is a follow-up. - AdminCustomersPage gains a [USD] [INR] toggle in the header, persists the choice in localStorage (instant.admin.currency), defaults to USD, threads the chosen currency into CustomerDetailDrawer. - Tooltip on the toggle documents the static rate ("1₹ = $0.012; for directional comparison only"). - 11 new tests (34 total in the file, 376 across the project, 0 fail): default render USD/$, toggle INR/₹, localStorage persists across unmount, drawer inherits choice, lib helpers + resolveInrToUsd parser rules. The override flow is asserted at the parser unit because Vite statically inlines import.meta.env.VITE_* at transform time and the module-load constant can't be re-driven from a test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/lib/currency.tswithformatINR/formatUSD/formatMoney+resolveInrToUsd. Static rateINR_TO_USD = 0.012(May 2026), overridable at build time viaVITE_INR_TO_USD. Inline docs note this is directional signal only — daily-refreshed FX is a follow-up if accuracy ever matters.AdminCustomersPagegains a[USD] [INR]toggle in the header, persists choice inlocalStorage(instant.admin.currency), defaults to USD, threads selection intoCustomerDetailDrawer. Tooltip on the toggle documents the static rate.Test plan
npm test— 376 passed / 3 pre-existing skips (34 inAdminCustomersPage.test.tsx, 11 new for Track H)npm run build— clean TS + Vite bundle$prefix on MRR cells + drawerINRtoggle: cells + drawer re-render with₹prefixresolveInrToUsdparser: positive numeric → that value; empty/null/NaN/zero/negative → static fallbackPushback
VITE_INR_TO_USDenv override is not asserted at the integration level — Vite statically inlinesimport.meta.env.VITE_*at transform time, so the module-load constant can't be re-driven from a runtime test. The parser (resolveInrToUsd) is asserted directly instead. If we ever need the override to be testable end-to-end, expose the resolver as agetActiveRate()getter that reads from a swappable source.🤖 Generated with Claude Code