) {
event.preventDefault();
if (results[0]) {
navigateToTicker(results[0].symbol);
return;
}
if (query.trim()) navigateToTicker(query);
}
async function addOrRemoveCurrentTicker() {
if (!selectedTicker) return;
try {
const next = isSaved ? await api.removeWatchlist(selectedTicker) : await api.addWatchlist(selectedTicker);
setWatchlist(next);
setWatchlistError(null);
} catch (exc) {
setWatchlistError(exc instanceof Error ? exc.message : "Could not update watchlist");
}
}
async function removeFromWatchlist(symbol: string) {
try {
const next = await api.removeWatchlist(symbol);
setWatchlist(next);
setWatchlistError(null);
} catch (exc) {
setWatchlistError(exc instanceof Error ? exc.message : "Could not update watchlist");
}
}
const shell = (
}
topbar={
}
>
{!selectedTicker ? : null}
{selectedTicker && overviewState === "loading" ? : null}
{selectedTicker && overviewState === "invalid" ? : null}
{selectedTicker && overviewState === "error" ? : null}
{overview && overviewState === "ready" ? (
tab === "valuation" ? (
) : tab === "financials" ? (
) : (
<>
>
)
) : null}
);
return shell;
}
function MarketStrip({ indices }: { indices: MarketIndex[] }) {
if (!indices.length) {
return Market data is temporarily unavailable.;
}
return (
{indices.map((index) => (
{index.name}
{fmtNumber(index.price)}
{fmtPct(index.change_pct, 2, true)}
))}
);
}
function EmptyOverviewState({ watchlist, onSelectTicker }: { watchlist: WatchlistResponse; onSelectTicker: (symbol: string) => void }) {
return (
Overview
Choose a ticker to enter the workbench.
Search from the top bar or jump into one of your saved symbols from the sidebar watchlist.
{watchlist.items.length ? (
{watchlist.items.map((item) => (
))}
) : null}
);
}
function LoadingOverviewState({ symbol }: { symbol: string }) {
return (
Loading
{symbol}
Fetching quote, profile, signals, and supporting metrics.
);
}
function InvalidTickerState({ symbol, onClear }: { symbol: string; onClear: () => void }) {
return (
Invalid Ticker
{symbol}
This symbol could not be resolved into usable market data. Try another search or return to the empty workspace.
);
}
function ErrorOverviewState({ message }: { message: string }) {
return (
Data Error
Overview unavailable
{message}
);
}
function SignalCard({ overview }: { overview: TickerOverview }) {
return (
{overview.signals.map((signal) => (
{signal.key}
{signal.description}
{signal.value}
))}
);
}
function DataStatusCard({ overview, missingFields }: { overview: TickerOverview; missingFields: string[] }) {
const entries = Object.entries(overview.meta.sources).slice(0, 6);
const visibleMissing = missingFields.slice(0, 4);
const hiddenMissingCount = Math.max(0, missingFields.length - visibleMissing.length);
return (
{availableFieldSummary(overview)}
{overview.meta.is_partial ? (
{missingFields.length ? visibleMissing.map((field) => {field}) : null}
{hiddenMissingCount ? +{hiddenMissingCount} more : null}
) : null}
{entries.length ? (
entries.map(([field, source]) => (
{field}
{source}
))
) : (
Sources
Unavailable
)}
);
}
function ProfileCard({ overview }: { overview: TickerOverview }) {
return (
Company Profile
Company Profile
Sector
{overview.profile.sector || "Unavailable"}
Industry
{overview.profile.industry || "Unavailable"}
Exchange
{overview.profile.exchange || "Unavailable"}
{overview.profile.summary || "Business summary unavailable."}
);
}
function ShortInterestCard({ overview }: { overview: TickerOverview }) {
const short = overview.short_interest;
const items = [
{ label: "Short Float", value: fmtPct(short.short_percent_of_float), missing: short.short_percent_of_float == null },
{ label: "Days Cover", value: fmtNumber(short.short_ratio), missing: short.short_ratio == null },
{ label: "Shares Short", value: fmtNumber(short.shares_short, 0), missing: short.shares_short == null },
{ label: "Prior Delta", value: fmtPct(short.shares_short_delta_pct, 1, true), missing: short.shares_short_delta_pct == null }
];
const visibleItems = items.filter((i) => !i.missing);
if (!visibleItems.length) return null;
const suppressed = items.length - visibleItems.length;
return (
Short Interest
Short Interest
{visibleItems.map((item) => (
))}
{suppressed > 0 && (
· Short interest data incomplete
)}
);
}
function StatsCard({ overview }: { overview: TickerOverview }) {
const referenceRows = [
{ 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 },
{ label: "EPS TTM", value: fmtCurrency(overview.stats.trailing_eps), missing: overview.stats.trailing_eps == null },
{ label: "P/B", value: overview.ratios.price_to_book == null ? "-" : `${fmtNumber(overview.ratios.price_to_book)}x`, missing: overview.ratios.price_to_book == null },
{ label: "P/S", value: overview.ratios.price_to_sales == null ? "-" : `${fmtNumber(overview.ratios.price_to_sales)}x`, missing: overview.ratios.price_to_sales == null },
{ label: "EV/Sales", value: overview.ratios.ev_to_sales == null ? "-" : `${fmtNumber(overview.ratios.ev_to_sales)}x`, missing: overview.ratios.ev_to_sales == null },
{ label: "EV/EBITDA", value: overview.ratios.ev_to_ebitda == null ? "-" : `${fmtNumber(overview.ratios.ev_to_ebitda)}x`, missing: overview.ratios.ev_to_ebitda == null },
{ label: "Gross Margin", value: fmtPct(overview.ratios.gross_margin_ttm), missing: overview.ratios.gross_margin_ttm == null },
{ label: "Op Margin", value: fmtPct(overview.ratios.operating_margin_ttm), missing: overview.ratios.operating_margin_ttm == null },
{ label: "Net Margin", value: fmtPct(overview.ratios.net_margin_ttm), missing: overview.ratios.net_margin_ttm == null },
{ label: "ROE", value: fmtPct(overview.ratios.roe_ttm), missing: overview.ratios.roe_ttm == null },
{ label: "ROA", value: fmtPct(overview.ratios.roa_ttm), missing: overview.ratios.roa_ttm == null },
{ label: "ROIC", value: fmtPct(overview.ratios.roic_ttm), missing: overview.ratios.roic_ttm == null },
{ label: "D/E", value: overview.ratios.debt_to_equity == null ? "-" : `${fmtNumber(overview.ratios.debt_to_equity)}x`, missing: overview.ratios.debt_to_equity == null },
{ label: "Current Ratio", value: overview.ratios.current_ratio == null ? "-" : `${fmtNumber(overview.ratios.current_ratio)}x`, missing: overview.ratios.current_ratio == null },
{ label: "Dividend Yield", value: fmtPct(overview.ratios.dividend_yield_ttm), missing: overview.ratios.dividend_yield_ttm == null },
{ label: "Payout Ratio", value: fmtPct(overview.ratios.dividend_payout_ratio_ttm), missing: overview.ratios.dividend_payout_ratio_ttm == null }
];
const visibleRows = referenceRows.filter((r) => !r.missing);
const suppressedCount = referenceRows.length - visibleRows.length;
return (
{visibleRows.length > 0 && (
{visibleRows.map((row) => (
))}
)}
{suppressedCount > 0 && (
0 ? "var(--sp-4)" : 0 }}>
· Statement data incomplete
)}
);
}
function DetailItem({ label, value, missing = false }: { label: string; value: string; missing?: boolean }) {
return (
{label}
{missing ? "Unavailable" : value}
);
}
function StatRow({ label, value, missing = false }: { label: string; value: string; missing?: boolean }) {
return (
{label}
{missing ? "Unavailable" : value}
);
}
function LoadingShell() {
return (
}
topbar={}
>
);
}