-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Copy link
Description
Problem
The Dashboard stat cards currently sum amounts across different currencies without conversion, producing meaningless totals. For example, adding $100 USD + €50 EUR directly results in an incorrect total of "150".
This issue was identified during the review of PR #98 where the new Subscription components correctly implement multi-currency aggregation by showing separate totals for each currency.
Affected Components
Based on code analysis, the following Dashboard components have this currency aggregation issue:
- Dashboard Subscriptions (
src/components/dashboard/subscriptions.tsx
) - Dashboard Invoices Received (
src/components/dashboard/invoices-received.tsx
) - Dashboard Invoices Sent (
src/components/dashboard/invoices-sent.tsx
)
Solution
Update the Dashboard stat cards to follow the same pattern implemented in the Subscription components in PR #98:
- Replace single-currency StatCard with MultiCurrencyStatCard for revenue/amount totals
- Implement proper currency aggregation using BigNumber for precision:
const totalRevenue = payments.reduce((acc, payment) => { const currency = payment.currency; const amount = BigNumber.from(payment.amount); if (acc[currency]) { acc[currency] = acc[currency].add(amount); } else { acc[currency] = amount; } return acc; }, {} as Record<string, BigNumber>);
- Display separate totals per currency instead of one incorrect sum
Context
- Original Issue: Identified in PR feat: add active subscribers table and payments table #98 review
- PR Reference: feat: add active subscribers table and payments table #98
- Comment Reference: feat: add active subscribers table and payments table #98 (comment)
- Reported by: @MantisClone
Acceptance Criteria
- Dashboard stat cards show separate totals for each currency
- No more mixing of different currencies in single totals
- Consistent implementation across all Dashboard components
- Use MultiCurrencyStatCard component like in Subscription components
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done