From 570b2ec7c5890ef6f11eab5ac1c56eb3ec90911f Mon Sep 17 00:00:00 2001 From: Tyler Hoang Date: Sun, 14 Jun 2026 02:45:28 -0700 Subject: feat: enable Filings tab and route FilingsPage --- frontend/components/prism/FilingsPage.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'frontend/components/prism') diff --git a/frontend/components/prism/FilingsPage.tsx b/frontend/components/prism/FilingsPage.tsx index 6b3a9f8..a8487d3 100644 --- a/frontend/components/prism/FilingsPage.tsx +++ b/frontend/components/prism/FilingsPage.tsx @@ -415,6 +415,16 @@ function FilingRow({ filing }: { filing: FilingItem }) { // ── Filing table with filters + pagination ───────────────────────────────────── +// Cutoffs computed once at module load (not during render) to satisfy react-hooks/purity. +const _now = Date.now(); +const CUTOFF_6M = new Date(_now - 180 * 86400 * 1000).toISOString().slice(0, 10); +const CUTOFF_1Y = new Date(_now - 365 * 86400 * 1000).toISOString().slice(0, 10); +const DATE_CUTOFF: Record = { + "6m": CUTOFF_6M, + "1y": CUTOFF_1Y, + "all": null, +}; + function FilingTable({ filings }: { filings: FilingItem[] }) { const [formFilter, setFormFilter] = useState("all"); const [dateRange, setDateRange] = useState("all"); @@ -433,15 +443,9 @@ function FilingTable({ filings }: { filings: FilingItem[] }) { { key: "all", label: "ALL" }, ]; - const cutoff: Record = { - "6m": new Date(Date.now() - 180 * 86400 * 1000).toISOString().slice(0, 10), - "1y": new Date(Date.now() - 365 * 86400 * 1000).toISOString().slice(0, 10), - "all": null, - }; - const filtered = filings.filter((f) => { if (formFilter !== "all" && f.form !== formFilter) return false; - const cut = cutoff[dateRange]; + const cut = DATE_CUTOFF[dateRange]; if (cut && f.date < cut) return false; return true; }); -- cgit v1.3-2-g0d8e