diff options
| author | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-06-14 02:45:28 -0700 |
|---|---|---|
| committer | Tyler Hoang <tyler@tylerhoang.xyz> | 2026-06-14 02:45:28 -0700 |
| commit | 570b2ec7c5890ef6f11eab5ac1c56eb3ec90911f (patch) | |
| tree | f7653a3c615b18319fffb417ec6f8b37cc9ff0ab /frontend/components/prism/FilingsPage.tsx | |
| parent | ad4109791cc3fdf8c0bf15969610741281caaa8f (diff) | |
feat: enable Filings tab and route FilingsPage
Diffstat (limited to 'frontend/components/prism/FilingsPage.tsx')
| -rw-r--r-- | frontend/components/prism/FilingsPage.tsx | 18 |
1 files changed, 11 insertions, 7 deletions
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<DateRange, string | null> = { + "6m": CUTOFF_6M, + "1y": CUTOFF_1Y, + "all": null, +}; + function FilingTable({ filings }: { filings: FilingItem[] }) { const [formFilter, setFormFilter] = useState<FormFilter>("all"); const [dateRange, setDateRange] = useState<DateRange>("all"); @@ -433,15 +443,9 @@ function FilingTable({ filings }: { filings: FilingItem[] }) { { key: "all", label: "ALL" }, ]; - const cutoff: Record<DateRange, string | null> = { - "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; }); |
