"use client"; import * as React from "react"; import { useNetWorth, useTransactions } from "@/api/hooks/reads"; import { Card } from "@/ds"; import { tugrikRaw } from "@/ds/money"; import { assetsStrings as s } from "./strings"; const mutedStyle: React.CSSProperties = { color: "var(--seed-color-fg-neutral-subtle)" }; export interface AccountDetailProps { accountId: number; } /** * Read-only account detail — no bank-server actions live here (that's iOS's * `AccountDetailView`, gated behind a live bank connection this web app * doesn't drive yet). Shows the balance from `/networth` plus this * account's recent transactions. */ export function AccountDetail({ accountId }: AccountDetailProps) { const netWorth = useNetWorth(); const transactions = useTransactions({ account: accountId, limit: 30 }); const account = (netWorth.data?.accounts ?? []).find((a) => a.accountId === accountId); return (

{account?.bank ?? s.accountDetail.bank}

{account?.accountNumber}
{tugrikRaw(account?.balance ?? "0")}

{s.accountDetail.recentTransactions}

{transactions.isLoading ? (

) : (transactions.data ?? []).length === 0 ? (

{s.accountDetail.noTransactions}

) : ( {(transactions.data ?? []).map((txn, i) => { const income = txn.direction === "income"; return ( {i > 0 && }
{txn.title || txn.category}
{txn.date.slice(0, 10)}
{income ? "+" : "−"} {tugrikRaw(txn.amount)}
); })}
)}
); } function BackLink() { return ( ← {s.common.back} ); } function DetailRow({ label, value }: { label: string; value: string }) { return (
{label} {value}
); } function Divider() { return
; }