Skip to content

Commit

Permalink
Add last card in pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
limdingwen committed Jul 25, 2024
1 parent 6f26831 commit 4a3aff4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions site/src/app/bills/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import HumanFriendlyColumn from "@/app/components/HumanFriendlyColumn";
import StandardStack from "@/app/components/StandardStack";
import type { Metadata } from "next";
import StandardPagination from "@/components/StandardPagination";
import StandardCard from "@/app/components/StandardCard";
import StandardCardTitle from "@/app/components/StandardCardTitle";
import StandardCardDescription from "@/app/components/StandardCardDescription";
import StandardButton from "@/app/components/StandardButton";
import { Group } from "@mantine/core";

export const runtime = "edge";

Expand Down Expand Up @@ -59,6 +64,7 @@ export default async function RecentBills({
const page = parseInt(searchParams.page ?? "1");
const billCount = await getBillCount();
const pageCount = Math.ceil(billCount / itemsPerPage);
const isLastPage = page === pageCount;

return (
<HumanFriendlyColumn>
Expand All @@ -69,6 +75,26 @@ export default async function RecentBills({
<ShortBill key={bill.bill_no} bill={bill} />
))}

{isLastPage && (
<StandardCard>
<StandardCardTitle>View More Bills</StandardCardTitle>
<StandardCardDescription>
You've reached the end of our list of parliament bill summaries.
Due to technical constraints, we can only provide summaries for a
limited number of bills. To see more bills, visit the original
source.
</StandardCardDescription>
<Group mt="md" grow>
<StandardButton
colour="gray"
href="https://www.parliament.gov.sg/parliamentary-business/bills-introduced"
>
Visit original source
</StandardButton>
</Group>
</StandardCard>
)}

<StandardPagination pageCount={pageCount} page={page} />
</StandardStack>
</HumanFriendlyColumn>
Expand Down

0 comments on commit 4a3aff4

Please sign in to comment.