diff --git a/src/app/statements/page.tsx b/src/app/statements/page.tsx
index 9d0cfae..b28b1b9 100644
--- a/src/app/statements/page.tsx
+++ b/src/app/statements/page.tsx
@@ -1,7 +1,7 @@
"use client";
import Link from "next/link";
-import { useStatements } from "@/lib/hooks";
+import { useStatements, useParticipants, useUpdateStatement } from "@/lib/hooks";
function formatDate(d: string | null) {
if (!d) return "—";
@@ -32,6 +32,8 @@ function formatAmount(n: number | null): string {
export default function StatementsPage() {
const { data: statements, isLoading } = useStatements();
+ const { data: participants } = useParticipants();
+ const updateStatement = useUpdateStatement();
return (
@@ -49,18 +51,25 @@ export default function StatementsPage() {
Bank |
Account |
Period |
-
Due / Updated |
+
Due / End |
Ccy |
Amount |
Txns |
+
Owner |
|
{statements.map((s) => {
- const isCreditCard = Number(s.credit_limit) > 0 || s.payment_due_date != null;
+ const isCreditCard = s.statement_type?.toLowerCase().includes("card") ?? false;
const displayAmount = isCreditCard ? s.total_amount_due : s.closing_balance;
- const amountLabel = isCreditCard ? "due" : "balance";
+ const amount = Number(displayAmount);
+ // CC: red (you owe). Bank: green if positive balance, red if overdraft.
+ const amountColor = isCreditCard
+ ? "text-red-400"
+ : amount >= 0
+ ? "text-green-400"
+ : "text-red-400";
return (
@@ -88,17 +97,35 @@ export default function StatementsPage() {
|
{displayAmount !== null && displayAmount !== undefined ? (
-
+
{formatAmount(displayAmount)}
) : (
—
)}
- {amountLabel}
|
{s.transaction_count}
|
+
+ {participants?.length ? (
+
+ ) : (
+ {s.owner_name}
+ )}
+ |
|