From 927a77d68b138778690d380fe7931cc37ce06c9e Mon Sep 17 00:00:00 2001 From: Tyler Hoang Date: Tue, 19 May 2026 00:41:35 -0700 Subject: feat: fetch valuation on overview tab, add DCF block to ValuationOverviewCard Co-Authored-By: Claude Sonnet 4.6 --- .../components/prism/ValuationOverviewCard.tsx | 44 ++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'frontend/components/prism/ValuationOverviewCard.tsx') diff --git a/frontend/components/prism/ValuationOverviewCard.tsx b/frontend/components/prism/ValuationOverviewCard.tsx index f85e443..9e59787 100644 --- a/frontend/components/prism/ValuationOverviewCard.tsx +++ b/frontend/components/prism/ValuationOverviewCard.tsx @@ -1,11 +1,15 @@ -import type { TickerOverview } from "@/types/api"; -import { fmtCurrency, fmtLarge, fmtNumber } from "@/lib/format"; +import type { TickerOverview, ValuationResponse } from "@/types/api"; +import { fmtCurrency, fmtLarge, fmtNumber, fmtPct } from "@/lib/format"; + +type ValState = "idle" | "loading" | "ready" | "error"; type Props = { overview: TickerOverview; + valuation: ValuationResponse | null; + valState: ValState; }; -export function ValuationOverviewCard({ overview }: Props) { +export function ValuationOverviewCard({ overview, valuation, valState }: Props) { const rows = [ { label: "Market Cap", value: fmtLarge(overview.stats.market_cap), missing: overview.stats.market_cap == null }, { label: "P/E TTM", value: overview.stats.trailing_pe == null ? "-" : `${fmtNumber(overview.stats.trailing_pe)}x`, missing: overview.stats.trailing_pe == null }, @@ -17,6 +21,8 @@ export function ValuationOverviewCard({ overview }: Props) { ]; const visible = rows.filter((r) => !r.missing); + const dcf = valuation?.dcf; + const showDcf = dcf?.available && dcf.intrinsic_value_per_share != null; return (
@@ -36,6 +42,38 @@ export function ValuationOverviewCard({ overview }: Props) { ))} )} + {valState === "loading" && ( + <> +
+
+
+ + +
+
+ + +
+
+ + )} + {valState === "ready" && showDcf && dcf && ( + <> +
+
+
+ DCF Intrinsic Value + {fmtCurrency(dcf.intrinsic_value_per_share)} +
+ {dcf.growth_rate_used != null && ( +
+ FCF Growth Used + {fmtPct(dcf.growth_rate_used)} +
+ )} +
+ + )}
); } -- cgit v1.3-2-g0d8e