wacrm/src/components/pipelines
Arnas Donauskas 3abecb433b
feat(deals): make default deal currency configurable per account (#218)
wacrm hardcoded USD across every deal-value formatter, the new-deal
form, and automation-created deals, making deal tracking unhelpful for
non-US self-hosted users. Add a per-account default currency.

- Migration 021: accounts.default_currency TEXT NOT NULL DEFAULT 'USD'
  with a 3-letter-code CHECK. The existing admin-only accounts_update
  RLS policy already gates writes.
- New src/lib/currency.ts: single source of truth (CURRENCIES list,
  formatCurrency, formatCurrencyShort), replacing ~6 duplicated
  USD-hardcoded helpers.
- useAuth exposes defaultCurrency (joined from accounts), falling back
  to USD while loading / on pre-021 schemas.
- Settings → Deals tab to pick the currency (admin-only, read-only for
  others to match RLS).
- Deal form defaults new deals to the account currency and sources its
  dropdown from CURRENCIES; existing deals keep their saved currency.
- Pipeline board/analytics, dashboard "Open Deals Value", and the
  pipeline donut format totals in the account currency. Individual
  deal cards still show each deal's own currency.
- Automation create_deal sets the new deal's currency from the
  account default instead of the static DB default.

One currency per account (no FX conversion) per the issue's
recommended first pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 13:59:48 +03:00
..
deal-card.tsx feat(deals): make default deal currency configurable per account (#218) 2026-06-08 13:59:48 +03:00
deal-form.tsx feat(deals): make default deal currency configurable per account (#218) 2026-06-08 13:59:48 +03:00
pipeline-analytics.tsx feat(deals): make default deal currency configurable per account (#218) 2026-06-08 13:59:48 +03:00
pipeline-board.tsx feat(deals): make default deal currency configurable per account (#218) 2026-06-08 13:59:48 +03:00
pipeline-settings.tsx feat(theme): sweep remaining violet-* → primary across all surfaces 2026-05-22 17:00:32 +03:00