Skip to content

Commit 29d3526

Browse files
refactor: abstracted pagination
1 parent a2249a1 commit 29d3526

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

app/[locale]/institute/administration/(committees)/board-of-governors/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default async function BoardOfGovernors({
55
searchParams,
66
}: {
77
params: { locale: string };
8-
searchParams: { meetingPage?: string };
8+
searchParams: { page?: string };
99
}) {
1010
return (
1111
<Committee locale={locale} searchParams={searchParams} type="governor" />

app/[locale]/institute/administration/(committees)/building-and-work-committee/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function BuildingAndWorkCommittee({
55
searchParams,
66
}: {
77
params: { locale: string };
8-
searchParams: { meetingPage?: string };
8+
searchParams: { page?: string };
99
}) {
1010
return (
1111
<Committee locale={locale} searchParams={searchParams} type="building" />

app/[locale]/institute/administration/(committees)/committee.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export default async function Committee({
2525
type,
2626
}: {
2727
locale: string;
28-
searchParams: { meetingPage?: string };
28+
searchParams: { page?: string };
2929
type: (typeof committeeMembers.committeeType.enumValues)[number];
3030
}) {
3131
const text = (await getTranslations(locale)).Committee;
3232

33-
const meetingPage = isNaN(Number(searchParams.meetingPage ?? '1'))
33+
const meetingPage = isNaN(Number(searchParams.page ?? '1'))
3434
? 1
35-
: Math.max(Number(searchParams.meetingPage ?? '1'), 1);
35+
: Math.max(Number(searchParams.page ?? '1'), 1);
3636

3737
return (
3838
<section className="container">

app/[locale]/institute/administration/(committees)/financial-committee/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default function FinancialCommittee({
55
searchParams,
66
}: {
77
params: { locale: string };
8-
searchParams: { meetingPage?: string };
8+
searchParams: { page?: string };
99
}) {
1010
return (
1111
<Committee locale={locale} searchParams={searchParams} type="financial" />

app/[locale]/institute/administration/(committees)/senate/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default async function Senate({
77
searchParams,
88
}: {
99
params: { locale: string };
10-
searchParams: { meetingPage?: string };
10+
searchParams: { page?: string };
1111
}) {
1212
return (
1313
<>

components/pagination/pagination.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ export const PaginationWithLogic = async ({
2828
<PaginationItem>
2929
<PaginationPrevious
3030
disabled={currentPage <= 1}
31-
href={{ query: { meetingPage: currentPage - 1 } }}
31+
href={{ query: { page: currentPage - 1 } }}
3232
/>
3333
</PaginationItem>
3434

3535
<PaginationItem>
3636
<PaginationLink
37-
href={{ query: { meetingPage: 1 } }}
37+
href={{ query: { page: 1 } }}
3838
isActive={currentPage == 1}
3939
>
4040
1
@@ -43,7 +43,7 @@ export const PaginationWithLogic = async ({
4343
{noOfPages > 1 && (currentPage < 4 || noOfPages < 6) && (
4444
<PaginationItem>
4545
<PaginationLink
46-
href={{ query: { meetingPage: 2 } }}
46+
href={{ query: { page: 2 } }}
4747
isActive={currentPage == 2}
4848
>
4949
2
@@ -53,7 +53,7 @@ export const PaginationWithLogic = async ({
5353
{noOfPages > 2 && (currentPage < 4 || noOfPages < 6) && (
5454
<PaginationItem>
5555
<PaginationLink
56-
href={{ query: { meetingPage: 3 } }}
56+
href={{ query: { page: 3 } }}
5757
isActive={currentPage == 3}
5858
>
5959
3
@@ -66,7 +66,7 @@ export const PaginationWithLogic = async ({
6666
<>
6767
<PaginationItem>
6868
<PaginationLink
69-
href={{ query: { meetingPage: currentPage } }}
69+
href={{ query: { page: currentPage } }}
7070
isActive={currentPage == currentPage}
7171
>
7272
{currentPage}
@@ -79,7 +79,7 @@ export const PaginationWithLogic = async ({
7979
{noOfPages > 5 && currentPage > noOfPages - 3 && (
8080
<PaginationItem>
8181
<PaginationLink
82-
href={{ query: { meetingPage: noOfPages - 2 } }}
82+
href={{ query: { page: noOfPages - 2 } }}
8383
isActive={currentPage == noOfPages - 2}
8484
>
8585
{noOfPages - 2}
@@ -89,7 +89,7 @@ export const PaginationWithLogic = async ({
8989
{noOfPages > 4 && (currentPage > noOfPages - 3 || noOfPages < 6) && (
9090
<PaginationItem>
9191
<PaginationLink
92-
href={{ query: { meetingPage: noOfPages - 1 } }}
92+
href={{ query: { page: noOfPages - 1 } }}
9393
isActive={currentPage == noOfPages - 1}
9494
>
9595
{noOfPages - 1}
@@ -99,7 +99,7 @@ export const PaginationWithLogic = async ({
9999
{noOfPages > 3 && (
100100
<PaginationItem>
101101
<PaginationLink
102-
href={{ query: { meetingPage: noOfPages } }}
102+
href={{ query: { page: noOfPages } }}
103103
isActive={currentPage == noOfPages}
104104
>
105105
{noOfPages}
@@ -110,7 +110,7 @@ export const PaginationWithLogic = async ({
110110
<PaginationItem>
111111
<PaginationNext
112112
disabled={currentPage >= noOfPages}
113-
href={{ query: { meetingPage: currentPage + 1 } }}
113+
href={{ query: { page: currentPage + 1 } }}
114114
/>
115115
</PaginationItem>
116116
</PaginationContent>

0 commit comments

Comments
 (0)