diff --git a/web-ui/src/app/archive/page.tsx b/web-ui/src/app/archive/page.tsx index 06a0e41..d900043 100644 --- a/web-ui/src/app/archive/page.tsx +++ b/web-ui/src/app/archive/page.tsx @@ -168,9 +168,21 @@ export default function ArchivePage() { ]); const [globalFilter, setGlobalFilter] = useState(""); const [typeFilter, setTypeFilter] = useState("all"); + const [yearFilter, setYearFilter] = useState("all"); const rows = useMemo(() => data ?? [], [data]); + // years present in the archive (by archive date) — for the year filter (mockup 05) + const years = useMemo(() => { + const set = new Set(); + for (const c of rows) { + if (!c.archived_at) continue; + const y = new Date(c.archived_at).getFullYear(); + if (!Number.isNaN(y)) set.add(String(y)); + } + return [...set].sort((a, b) => Number(b) - Number(a)); + }, [rows]); + const table = useReactTable({ data: rows, columns, @@ -192,10 +204,16 @@ export default function ArchivePage() { // domain filter applied client-side (subtypeOf collapses בל"מ variants) const filteredRows = useMemo(() => { - const all = table.getFilteredRowModel().rows; - if (typeFilter === "all") return all; - return all.filter((r) => subtypeOf(r.original) === typeFilter); - }, [table, typeFilter, globalFilter, sorting, rows]); + let all = table.getFilteredRowModel().rows; + if (typeFilter !== "all") all = all.filter((r) => subtypeOf(r.original) === typeFilter); + if (yearFilter !== "all") { + all = all.filter((r) => { + const iso = r.original.archived_at; + return iso != null && String(new Date(iso).getFullYear()) === yearFilter; + }); + } + return all; + }, [table, typeFilter, yearFilter, globalFilter, sorting, rows]); const total = rows.length; const shown = filteredRows.length; @@ -242,6 +260,18 @@ export default function ArchivePage() { + {years.length > 0 ? ( + + ) : null} מציג {shown} מתוך {total} @@ -301,7 +331,7 @@ export default function ArchivePage() {
- {globalFilter || typeFilter !== "all" + {globalFilter || typeFilter !== "all" || yearFilter !== "all" ? "אין תיקים תואמים לחיפוש" : "אין תיקים בארכיון"} diff --git a/web-ui/src/app/operations/page.tsx b/web-ui/src/app/operations/page.tsx index f67c5e6..c3f449e 100644 --- a/web-ui/src/app/operations/page.tsx +++ b/web-ui/src/app/operations/page.tsx @@ -264,9 +264,9 @@ function BurstControl({ s }: { s: OpsService }) { onChange={(e) => setUntil(e.target.value)} />
-