Skip to content

Let aggregate money figures use the install's currency - #45

Closed
puneet1409 wants to merge 1 commit into
trycompai:mainfrom
puneet1409:fix/aggregate-currency
Closed

Let aggregate money figures use the install's currency#45
puneet1409 wants to merge 1 commit into
trycompai:mainfrom
puneet1409:fix/aggregate-currency

Conversation

@puneet1409

@puneet1409 puneet1409 commented Aug 6, 2026

Copy link
Copy Markdown

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" default
in packages/ui/src/lib/format.ts. It's invisible on a USD install, which is
presumably why it's lasted.

This adds DEFAULT_CURRENCY, published to the bundle the same way
next.config.ts already publishes API_URL — a value that only exists in the
root .env is undefined in a client bundle, so the env map is the
mechanism 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-types locally: nestjs-trpc ships no
aarch64-pc-windows-msvc binary, so the generate step can't run on this
machine.

🤖 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

    • Updated formatMoney and formatMoneyCompact in packages/ui/src/lib/format.ts to default to NEXT_PUBLIC_DEFAULT_CURRENCY instead of hard-coded "usd".
    • apps/app/next.config.ts publishes DEFAULT_CURRENCY as NEXT_PUBLIC_DEFAULT_CURRENCY; added docs in .env.example.
  • Migration

    • Set DEFAULT_CURRENCY="inr" (or your install currency) in .env. If unset, behavior stays "usd".

Written for commit bfac068. Summary will update on new commits.

Review in cubic

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>
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

@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.

@puneet1409

Copy link
Copy Markdown
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.

@puneet1409 puneet1409 closed this Aug 6, 2026
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.

1 participant