From f1b1e85b53db87a04442181a40c530aca4791a14 Mon Sep 17 00:00:00 2001 From: Tyler Hoang Date: Mon, 29 Jun 2026 01:41:20 -0700 Subject: feat: add DCF panel components --- frontend/components/prism/SensitivityTable.tsx | 72 ++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 frontend/components/prism/SensitivityTable.tsx (limited to 'frontend/components/prism/SensitivityTable.tsx') diff --git a/frontend/components/prism/SensitivityTable.tsx b/frontend/components/prism/SensitivityTable.tsx new file mode 100644 index 0000000..ef86e9b --- /dev/null +++ b/frontend/components/prism/SensitivityTable.tsx @@ -0,0 +1,72 @@ +"use client"; + +import { fmtCurrency, fmtPct } from "@/lib/format"; +import type { SensitivityMatrix } from "@/types/api"; + +type Props = { + matrix: SensitivityMatrix; + centerWacc?: number; + centerTerminalGrowth?: number; + currency: string; +}; + +export function SensitivityTable({ matrix, centerWacc, centerTerminalGrowth, currency }: Props) { + const { wacc, terminal_growth, implied_prices } = matrix; + const centerRow = + centerWacc != null ? wacc.findIndex((v) => Math.abs(v - centerWacc) < 1e-9) : -1; + const centerCol = + centerTerminalGrowth != null + ? terminal_growth.findIndex((v) => Math.abs(v - centerTerminalGrowth) < 1e-9) + : -1; + + return ( +
+
+ Implied Price Sensitivity + WACC × Terminal Growth +
+ + + + + {terminal_growth.map((g, i) => ( + + ))} + + + + {wacc.map((w, rowIdx) => ( + + + {implied_prices[rowIdx]?.map((price, colIdx) => { + const isCenter = rowIdx === centerRow && colIdx === centerCol; + const isNegative = price != null && price < 0; + return ( + + ); + })} + + ))} + +
WACC \ g + {fmtPct(g)} +
+ {fmtPct(w)} + + {price != null && !isNegative ? fmtCurrency(price, 2, currency) : "—"} +
+
+ ); +} -- cgit v1.3-2-g0d8e