summaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/app/page.tsx8
-rw-r--r--frontend/components/prism/FilingsPage.tsx18
-rw-r--r--frontend/lib/overview.ts2
3 files changed, 20 insertions, 8 deletions
diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx
index e1f16ee..e7a4401 100644
--- a/frontend/app/page.tsx
+++ b/frontend/app/page.tsx
@@ -6,6 +6,7 @@ import { useRouter, useSearchParams } from "next/navigation";
import { AppShell } from "@/components/prism/AppShell";
import { FinancialsPage } from "@/components/prism/FinancialsPage";
import { InsidersPage } from "@/components/prism/InsidersPage";
+import { FilingsPage } from "@/components/prism/FilingsPage";
import { ValuationPage } from "@/components/prism/ValuationPage";
import { OptionsPage } from "@/components/prism/options/OptionsPage";
import { ChartCard } from "@/components/prism/ChartCard";
@@ -354,6 +355,13 @@ function OverviewClient() {
isSaved={isSaved}
onToggleWatchlist={addOrRemoveCurrentTicker}
/>
+ ) : tab === "filings" ? (
+ <FilingsPage
+ ticker={selectedTicker}
+ overview={overview}
+ isSaved={isSaved}
+ onToggleWatchlist={addOrRemoveCurrentTicker}
+ />
) : (
<>
<TickerHeader overview={overview} onToggleWatchlist={addOrRemoveCurrentTicker} isSaved={isSaved} />
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;
});
diff --git a/frontend/lib/overview.ts b/frontend/lib/overview.ts
index 04f9c64..62995d6 100644
--- a/frontend/lib/overview.ts
+++ b/frontend/lib/overview.ts
@@ -21,7 +21,7 @@ export const OVERVIEW_NAV_ITEMS: NavItem[] = [
{ key: "valuation", label: "Valuation", icon: "dollar" },
{ key: "options", label: "Options", icon: "window" },
{ key: "insiders", label: "Insiders", icon: "pulse" },
- { key: "filings", label: "Filings", icon: "folder", disabled: true },
+ { key: "filings", label: "Filings", icon: "folder" },
{ key: "news", label: "News", icon: "terminal", disabled: true }
];