Let aggregate money figures use the install's currency - #45
Closed
puneet1409 wants to merge 1 commit into
Closed
Conversation
Every per-deal call site passes deal.currency. The aggregates — the overview tiles, the stage donut, the deals table footer — have no single deal to read one from, so they fell through to a hard-coded "usd". On a non-USD install one page shows both: the open-deals rows render in the deal's own currency while the "Open pipeline" tile above them renders the same money as US$. DEFAULT_CURRENCY sets the fallback, published to the bundle the way next.config.ts already publishes API_URL. Unset, behaviour is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
@puneet1409 is attempting to deploy a commit to the Comp AI - PoC Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
Obsolete — I'd branched from a stale fetch. #39's reportingCurrency plus the multi_currency migrations already solve this properly, and sales-dashboard.tsx:60 now passes it through. Converting at a real rate beats a build-time constant. Sorry for the noise. |
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.
Running this on an INR portal, the overview shows two different currencies for
the same money: the open-deals list renders each row in the deal's own
currency, and the "Open pipeline" tile directly above it renders the total as
US$. Same page, same deals.
Every per-deal call site passes
deal.currency. The aggregates — the tiles,the stage donut, the chart tooltips, the deals-table footer — have no single
deal to read one from, so they fall through to the hard-coded
"usd"defaultin
packages/ui/src/lib/format.ts. It's invisible on a USD install, which ispresumably why it's lasted.
This adds
DEFAULT_CURRENCY, published to the bundle the same waynext.config.tsalready publishesAPI_URL— a value that only exists in theroot
.envisundefinedin a client bundle, so theenvmap is themechanism that already works here. Unset, nothing changes.
Not multi-currency (#19) — a single-tenant CRM has one reporting currency, and
this is just making that one value not be a constant. Mixed-currency portals
would still need real conversion.
Biome passes. I couldn't run
check-typeslocally:nestjs-trpcships noaarch64-pc-windows-msvcbinary, so the generate step can't run on thismachine.
🤖 Generated with Claude Code
Summary by cubic
Aggregate money figures now use the install’s currency via
DEFAULT_CURRENCY, fixing mixed USD/non-USD displays on overview tiles, stage donut, and table footers.Bug Fixes
formatMoneyandformatMoneyCompactinpackages/ui/src/lib/format.tsto default toNEXT_PUBLIC_DEFAULT_CURRENCYinstead of hard-coded"usd".apps/app/next.config.tspublishesDEFAULT_CURRENCYasNEXT_PUBLIC_DEFAULT_CURRENCY; added docs in.env.example.Migration
DEFAULT_CURRENCY="inr"(or your install currency) in.env. If unset, behavior stays"usd".Written for commit bfac068. Summary will update on new commits.