From dfec7587305fee59f8304000994ca16a495f7389 Mon Sep 17 00:00:00 2001 From: Tyler Hoang Date: Mon, 29 Jun 2026 01:41:22 -0700 Subject: feat: update financial overview components --- frontend/components/prism/FinancialsCard.tsx | 16 ++++++++++------ frontend/components/prism/PriceVsValueCard.tsx | 8 ++++---- frontend/components/prism/TickerHeader.tsx | 14 ++++++++------ 3 files changed, 22 insertions(+), 16 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 ( @@ -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)} ))} @@ -92,7 +93,10 @@ export function FinancialsCard({ - + {stmt.columns.map((col, i) => ( {stmt.rows.map((row, i) => ( - + ))}
USD (millions) + {data.currency} (millions) + +
diff --git a/frontend/components/prism/PriceVsValueCard.tsx b/frontend/components/prism/PriceVsValueCard.tsx index cf5a3c7..5d9291c 100644 --- a/frontend/components/prism/PriceVsValueCard.tsx +++ b/frontend/components/prism/PriceVsValueCard.tsx @@ -48,8 +48,8 @@ export function PriceVsValueCard({ overview, valuation, valState }: Props) { : `Trading at ${Math.abs(pct).toFixed(1)}% discount to DCF`; const [leftLabel, rightLabel] = isPremium - ? [`IV ${fmtCurrency(iv)}`, `Price ${fmtCurrency(price)}`] - : [`Price ${fmtCurrency(price)}`, `IV ${fmtCurrency(iv)}`]; + ? [`IV ${fmtCurrency(iv, 2, valuation?.currency ?? overview.currency)}`, `Price ${fmtCurrency(price, 2, overview.currency)}`] + : [`Price ${fmtCurrency(price, 2, overview.currency)}`, `IV ${fmtCurrency(iv, 2, valuation?.currency ?? overview.currency)}`]; return (
@@ -60,9 +60,9 @@ export function PriceVsValueCard({ overview, valuation, valState }: Props) {
- {fmtCurrency(price)} + {fmtCurrency(price, 2, overview.currency)} - IV {fmtCurrency(iv)} + IV {fmtCurrency(iv, 2, valuation?.currency ?? overview.currency)}
diff --git a/frontend/components/prism/TickerHeader.tsx b/frontend/components/prism/TickerHeader.tsx index 804ffc0..c47f67f 100644 --- a/frontend/components/prism/TickerHeader.tsx +++ b/frontend/components/prism/TickerHeader.tsx @@ -1,6 +1,7 @@ import { deltaClass, fmtCurrency, fmtPct } from "@/lib/format"; import { rangePercent } from "@/lib/overview"; import type { TickerOverview } from "@/types/api"; +import { CurrencyWarning } from "./CurrencyWarning"; type Props = { overview: TickerOverview; @@ -25,15 +26,16 @@ export function TickerHeader({ overview, onToggleWatchlist, isSaved }: Props) {
{overview.profile.exchange ? {overview.profile.exchange} : null} {overview.meta.is_partial ? Partial Data : null} +
52 Week Range
- {fmtCurrency(overview.range_52w.low)} - {fmtCurrency(overview.range_52w.price ?? overview.quote.price)} - {fmtCurrency(overview.range_52w.high)} + {fmtCurrency(overview.range_52w.low, 2, overview.currency)} + {fmtCurrency(overview.range_52w.price ?? overview.quote.price, 2, overview.currency)} + {fmtCurrency(overview.range_52w.high, 2, overview.currency)}
{pct != null ? : null} @@ -42,11 +44,11 @@ export function TickerHeader({ overview, onToggleWatchlist, isSaved }: Props) {
- {fmtCurrency(overview.quote.price)} + {fmtCurrency(overview.quote.price, 2, overview.currency)} - {fmtCurrency(overview.quote.change)} · {fmtPct(overview.quote.change_pct, 2, true)} + {fmtCurrency(overview.quote.change, 2, overview.currency)} · {fmtPct(overview.quote.change_pct, 2, true)} - Prev close {fmtCurrency(overview.quote.prev_close)} + Prev close {fmtCurrency(overview.quote.prev_close, 2, overview.currency)} {lastSource ? Source {lastSource.replaceAll("_", " ")} : null}