From 82576c9703add51a84e8873e90c0f31c008f63be Mon Sep 17 00:00:00 2001 From: Adorian Doran Date: Mon, 16 Feb 2026 01:51:32 +0200 Subject: [PATCH] ui/pager: rewrite the pagination button distribution algorithm to better control the length --- .../src/translations/en/translation.json | 1 - .../src/widgets/collections/Pagination.tsx | 72 +++++++++++++------ 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index e97aba782b..c1dcbf48f2 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -2190,7 +2190,6 @@ "percentage": "%" }, "pagination": { - "page_title": "Page of {{startIndex}} - {{endIndex}}", "total_notes": "{{count}} notes", "prev_page": "Previous page", "next_page": "Next page" diff --git a/apps/client/src/widgets/collections/Pagination.tsx b/apps/client/src/widgets/collections/Pagination.tsx index 282a6b36a5..5704715441 100644 --- a/apps/client/src/widgets/collections/Pagination.tsx +++ b/apps/client/src/widgets/collections/Pagination.tsx @@ -19,28 +19,7 @@ interface PaginationContext { export function Pager({ page, pageSize, setPage, pageCount, totalNotes }: Omit) { if (pageCount < 2) return; - let lastPrinted = false; - let children: ComponentChildren[] = []; - for (let i = 1; i <= pageCount; i++) { - if (pageCount < 20 || i <= 5 || pageCount - i <= 5 || Math.abs(page - i) <= 2) { - lastPrinted = true; - - const startIndex = (i - 1) * pageSize + 1; - const endIndex = Math.min(totalNotes, i * pageSize); - - children.push(( -