diff --git a/frontend/src/components/NotificationBell.tsx b/frontend/src/components/NotificationBell.tsx index d8acce2..de2c6ce 100644 --- a/frontend/src/components/NotificationBell.tsx +++ b/frontend/src/components/NotificationBell.tsx @@ -47,10 +47,12 @@ function getNotificationTitle(notification: NotificationHistoryEntry): string { } } -function formatPrice(price: number | null, currency: string | null): string { - if (price === null) return ''; +function formatPrice(price: number | string | null, currency: string | null): string { + if (price === null || price === undefined) return ''; + const numPrice = typeof price === 'string' ? parseFloat(price) : price; + if (isNaN(numPrice)) return ''; const symbol = currency === 'EUR' ? '\u20AC' : currency === 'GBP' ? '\u00A3' : '$'; - return `${symbol}${price.toFixed(2)}`; + return `${symbol}${numPrice.toFixed(2)}`; } export default function NotificationBell() { diff --git a/frontend/src/pages/NotificationHistory.tsx b/frontend/src/pages/NotificationHistory.tsx index 67381b8..e6d8df6 100644 --- a/frontend/src/pages/NotificationHistory.tsx +++ b/frontend/src/pages/NotificationHistory.tsx @@ -40,10 +40,12 @@ function getNotificationTypeLabel(type: NotificationType): string { } } -function formatPrice(price: number | null, currency: string | null): string { - if (price === null) return '-'; +function formatPrice(price: number | string | null, currency: string | null): string { + if (price === null || price === undefined) return '-'; + const numPrice = typeof price === 'string' ? parseFloat(price) : price; + if (isNaN(numPrice)) return '-'; const symbol = currency === 'EUR' ? '\u20AC' : currency === 'GBP' ? '\u00A3' : currency === 'CHF' ? 'CHF ' : '$'; - return `${symbol}${price.toFixed(2)}`; + return `${symbol}${numPrice.toFixed(2)}`; } function getChannelIcon(channel: string): string { @@ -429,7 +431,7 @@ export default function NotificationHistory() {