diff --git a/web/src/lib/components/ui/Pagination.svelte b/web/src/lib/components/ui/Pagination.svelte index ea955b17..e8f3eef8 100644 --- a/web/src/lib/components/ui/Pagination.svelte +++ b/web/src/lib/components/ui/Pagination.svelte @@ -31,16 +31,10 @@ const range = (from: number, to: number): number[] => Array.from({ length: Math.max(to - from + 1, 0) }, (_, i) => from + i); - // both ends, the current page and its two neighbours, and the two gaps const SLOTS = 7; - // the row is always SLOTS long once a gap is needed, so both gaps are permanent - // residents. that is what lets the plate be placed from an index rather than - // measured, and why paging the middle of a long range moves the numbers, not the row export function paginate(page: number, count: number): PaginationItem[] { if (count <= SLOTS) return range(1, count); - // near either end a gap would hide fewer pages than the slots it costs, so the - // window opens flush against that end and only the far gap is drawn if (page < 4) return [...range(1, 5), "gap-end", count]; if (page > count - 3) return [1, "gap-start", ...range(count - 4, count)]; return [1, "gap-start", ...range(page - 1, page + 1), "gap-end", count];