diff --git a/frontend/src/components/AccountsOverview.tsx b/frontend/src/components/AccountsOverview.tsx index a12c058..cbb2e79 100644 --- a/frontend/src/components/AccountsOverview.tsx +++ b/frontend/src/components/AccountsOverview.tsx @@ -16,6 +16,40 @@ import { formatCurrency, formatDate } from "../lib/utils"; import LoadingSpinner from "./LoadingSpinner"; import type { Account, Balance } from "../types/api"; +// Helper function to get status indicator color and styles +const getStatusIndicator = (status: string) => { + const statusLower = status.toLowerCase(); + + switch (statusLower) { + case 'ready': + return { + color: 'bg-green-500', + tooltip: 'Ready', + }; + case 'pending': + return { + color: 'bg-yellow-500', + tooltip: 'Pending', + }; + case 'error': + case 'failed': + return { + color: 'bg-red-500', + tooltip: 'Error', + }; + case 'inactive': + return { + color: 'bg-gray-500', + tooltip: 'Inactive', + }; + default: + return { + color: 'bg-blue-500', + tooltip: status, + }; + } +}; + export default function AccountsOverview() { const { data: accounts, @@ -247,7 +281,7 @@ export default function AccountsOverview() {

- {account.institution_id} • {account.status} + {account.institution_id}

) : ( @@ -265,7 +299,7 @@ export default function AccountsOverview() {

- {account.institution_id} • {account.status} + {account.institution_id}

{account.iban && (

@@ -279,7 +313,30 @@ export default function AccountsOverview() { {/* Balance and date section */}

-
+ {/* Mobile: date/status on left, balance on right */} + {/* Desktop: balance on top, date/status on bottom */} + + {/* Date and status indicator - left on mobile, bottom on desktop */} +
+
+ {/* Tooltip */} +
+ {getStatusIndicator(account.status).tooltip} +
+
+
+

+ Updated{" "} + {formatDate(account.last_accessed || account.created)} +

+
+ + {/* Balance - right on mobile, top on desktop */} +
{isPositive ? ( ) : ( @@ -293,10 +350,6 @@ export default function AccountsOverview() { {formatCurrency(balance, currency)}

-

- Updated{" "} - {formatDate(account.last_accessed || account.created)} -