import { createSignal, For, Show, onMount } from "solid-js"; import { useParams } from "@solidjs/router"; import { api, type ReportPayload } from "../lib/api"; import { Citations } from "../components/Citations"; import { RecBadge, Skeleton } from "../components/ui"; export default function Report() { const params = useParams(); const [rep, setRep] = createSignal(null); const [md, setMd] = createSignal(""); const [question, setQuestion] = createSignal(""); const [answer, setAnswer] = createSignal(""); const [busy, setBusy] = createSignal(true); const [asking, setAsking] = createSignal(false); const [err, setErr] = createSignal(""); const authHeaders = () => ({ "X-User-Key": localStorage.getItem("fs-key") || "demo" }); async function load() { setErr(""); setBusy(true); try { setRep(await api.report(params.ticker)); } catch (e) { setErr(String(e)); } finally { setBusy(false); } } onMount(load); async function exportMd() { setMd(await api.reportMd(params.ticker)); } async function ask() { if (!question().trim()) return; setAsking(true); try { const r = await api.interrogate(params.ticker, question()); setAnswer(r.answer); } finally { setAsking(false); } } function dl(url: string, name: string) { const a = document.createElement("a"); a.href = url; a.download = name; a.click(); } return (

Report: {params.ticker}

{err()}

conviction {rep()!.synthesis.conviction}/5 conflict flagged position {rep()!.synthesis.position_pct}%

{rep()!.synthesis.thesis}

Export

{(s) =>

{s.name}

{s.body}

}

Interrogate this report

setQuestion(e.currentTarget.value)} style={{ flex: 1 }} />

{answer()}

{md().slice(0, 2000)}
); }