summaryrefslogtreecommitdiff
path: root/frontend/components/prism/ValuationPage.tsx
diff options
context:
space:
mode:
authorTyler Hoang <tyler@tylerhoang.xyz>2026-06-29 01:41:24 -0700
committerTyler Hoang <tyler@tylerhoang.xyz>2026-06-29 01:41:24 -0700
commitab699a136169e8661b4f22fbce023ca7f033ce18 (patch)
tree86d898d86ff917b7ecffc1db7b1e73581fe3b1fb /frontend/components/prism/ValuationPage.tsx
parentdfec7587305fee59f8304000994ca16a495f7389 (diff)
feat: update ValuationPage and valuation cards
Diffstat (limited to 'frontend/components/prism/ValuationPage.tsx')
-rw-r--r--frontend/components/prism/ValuationPage.tsx21
1 files changed, 15 insertions, 6 deletions
diff --git a/frontend/components/prism/ValuationPage.tsx b/frontend/components/prism/ValuationPage.tsx
index 3a3ba27..ed8d93c 100644
--- a/frontend/components/prism/ValuationPage.tsx
+++ b/frontend/components/prism/ValuationPage.tsx
@@ -5,7 +5,7 @@ import { buildKpis } from "@/lib/overview";
import { ValuationCard } from "@/components/prism/ValuationCard";
import { KPIStrip } from "@/components/prism/KPIStrip";
import { TickerHeader } from "@/components/prism/TickerHeader";
-import type { TickerOverview, ValuationResponse } from "@/types/api";
+import type { TickerOverview, ValuationResponse, WaccResponse } from "@/types/api";
type ValState = "loading" | "ready" | "error";
@@ -18,6 +18,8 @@ type Props = {
export function ValuationPage({ ticker, overview, isSaved, onToggleWatchlist }: Props) {
const [data, setData] = useState<ValuationResponse | null>(null);
+ const [waccData, setWaccData] = useState<WaccResponse | null>(null);
+ const [seedRevenue, setSeedRevenue] = useState<number | null>(null);
const [valState, setValState] = useState<ValState>("loading");
const kpis = buildKpis(overview);
@@ -25,12 +27,19 @@ export function ValuationPage({ ticker, overview, isSaved, onToggleWatchlist }:
let cancelled = false;
setValState("loading");
setData(null);
+ setWaccData(null);
+ setSeedRevenue(null);
- api
- .valuation(ticker)
- .then((res) => {
+ Promise.all([api.valuation(ticker), api.wacc(ticker), api.financials(ticker)])
+ .then(([valuationRes, waccRes, financialsRes]) => {
if (!cancelled) {
- setData(res);
+ const revenueRow = financialsRes?.income?.rows?.find(
+ (r) => r.label === "Total Revenue"
+ );
+ const latestRevenue = revenueRow?.values?.[0] ?? null;
+ setData(valuationRes);
+ setWaccData(waccRes);
+ setSeedRevenue(latestRevenue);
setValState("ready");
}
})
@@ -55,7 +64,7 @@ export function ValuationPage({ ticker, overview, isSaved, onToggleWatchlist }:
<p className="psm-muted-copy">Valuation data unavailable for {ticker}.</p>
</section>
)}
- {valState === "ready" && data && <ValuationCard data={data} />}
+ {valState === "ready" && data && <ValuationCard data={data} waccData={waccData} seedRevenue={seedRevenue} />}
</>
);
}