summaryrefslogtreecommitdiff
path: root/frontend/components/prism/FinancialsCard.tsx
diff options
context:
space:
mode:
authorTyler Hoang <tyler@tylerhoang.xyz>2026-06-29 01:41:22 -0700
committerTyler Hoang <tyler@tylerhoang.xyz>2026-06-29 01:41:22 -0700
commitdfec7587305fee59f8304000994ca16a495f7389 (patch)
treeb249367a7db0cf1d781f5401fddbd91ec61ba28f /frontend/components/prism/FinancialsCard.tsx
parent2525596329ce57d01b012a18b0505b05fa8011d7 (diff)
feat: update financial overview components
Diffstat (limited to 'frontend/components/prism/FinancialsCard.tsx')
-rw-r--r--frontend/components/prism/FinancialsCard.tsx16
1 files changed, 10 insertions, 6 deletions
diff --git a/frontend/components/prism/FinancialsCard.tsx b/frontend/components/prism/FinancialsCard.tsx
index 43a2dc2..6e2fe01 100644
--- a/frontend/components/prism/FinancialsCard.tsx
+++ b/frontend/components/prism/FinancialsCard.tsx
@@ -1,6 +1,7 @@
"use client";
import type { FinancialRow, FinancialsResponse } from "@/types/api";
import { fmtLarge } from "@/lib/format";
+import { CurrencyWarning } from "./CurrencyWarning";
type StatementKey = "income" | "balance" | "cash_flow";
type PeriodKey = "annual" | "quarterly";
@@ -12,13 +13,13 @@ type Props = {
onChangePeriod: (p: PeriodKey) => void;
};
-function fmtFinVal(val: number | null | undefined, isMargin: boolean): string {
+function fmtFinVal(val: number | null | undefined, isMargin: boolean, currency: string): string {
if (val === null || val === undefined) return "—";
if (isMargin) return `${(val * 100).toFixed(1)}%`;
- return fmtLarge(val);
+ return fmtLarge(val, currency);
}
-function FinRow({ row, lastColIdx }: { row: FinancialRow; lastColIdx: number }) {
+function FinRow({ row, lastColIdx, currency }: { row: FinancialRow; lastColIdx: number; currency: string }) {
if (row.is_section) {
return (
<tr className="psm-fin-section-row">
@@ -52,7 +53,7 @@ function FinRow({ row, lastColIdx }: { row: FinancialRow; lastColIdx: number })
.filter(Boolean)
.join(" ")}
>
- {fmtFinVal(val, row.is_margin)}
+ {fmtFinVal(val, row.is_margin, currency)}
</td>
))}
</tr>
@@ -92,7 +93,10 @@ export function FinancialsCard({
<table className="psm-fin-table">
<thead>
<tr>
- <th className="psm-fin-label-col">USD (millions)</th>
+ <th className="psm-fin-label-col">
+ {data.currency} (millions)
+ <CurrencyWarning warning={data.currency_warning} />
+ </th>
{stmt.columns.map((col, i) => (
<th
key={i}
@@ -105,7 +109,7 @@ export function FinancialsCard({
</thead>
<tbody>
{stmt.rows.map((row, i) => (
- <FinRow key={i} row={row} lastColIdx={lastColIdx} />
+ <FinRow key={i} row={row} lastColIdx={lastColIdx} currency={data.currency} />
))}
</tbody>
</table>