diff --git a/dashboard/src/pages/NotificationSearchPage.tsx b/dashboard/src/pages/NotificationSearchPage.tsx index b0b5b6f..067b226 100644 --- a/dashboard/src/pages/NotificationSearchPage.tsx +++ b/dashboard/src/pages/NotificationSearchPage.tsx @@ -145,6 +145,28 @@ export function NotificationSearchPage() { const totalPages = response ? response.totalPages : 0; + const getVisiblePages = () => { + if (totalPages <= 1) return []; + + const pages: number[] = []; + const maxVisible = 5; + let startPage = Math.max(1, page - Math.floor(maxVisible / 2)); + let endPage = startPage + maxVisible - 1; + + if (endPage > totalPages) { + endPage = totalPages; + startPage = Math.max(1, endPage - maxVisible + 1); + } + + for (let pageNumber = startPage; pageNumber <= endPage; pageNumber += 1) { + pages.push(pageNumber); + } + + return pages; + }; + + const visiblePages = getVisiblePages(); + return (
@@ -314,6 +336,15 @@ export function NotificationSearchPage() { {totalPages > 1 && ( )}