Update formatCurrency to use currency code from UserSettings

Changes:
- Updated formatCurrency function:
  - Added currencyCode parameter with EUR default
  - Implemented Intl.NumberFormat for proper currency formatting
  - Added fallback for invalid currency codes
- Updated component hierarchy to pass currency:
  - HomePage: Fetch userSettings and pass to MonthLocationList
  - MonthLocationList: Accept and pass currency to child components
  - LocationCard: Accept currency prop and use in formatCurrency
  - MonthCard: Accept currency prop and use in formatCurrency
  - ViewLocationCard: Pass currency from userSettings to formatCurrency
- Removed hardcoded $ symbols, now using proper currency formatting

All currency amounts now display with the user's selected currency code
from their settings, using locale-appropriate formatting (hr-HR).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-11-22 23:04:42 +01:00
parent 4655b342f2
commit c025c6f2ce
6 changed files with 38 additions and 20 deletions

View File

@@ -52,7 +52,7 @@ export const ViewLocationCard:FC<ViewLocationCardProps> = ({location, userSettin
{
monthlyExpense > 0 ?
<p className="text-[1.2rem]">
{ t("payed-total-label") } <strong>${formatCurrency(monthlyExpense)}</strong>
{ t("payed-total-label") } <strong>{formatCurrency(monthlyExpense, userSettings?.currency)}</strong>
</p>
: null
}