-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathpage.tsx
More file actions
55 lines (47 loc) · 1.45 KB
/
page.tsx
File metadata and controls
55 lines (47 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { BecomeSponsorPopup } from "@/components/become-sponsor-popup";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import MoreContent from "@/components/more-content";
import type { DocCountResult } from "@/sanity/types";
import { sanityFetch } from "@/sanity/lib/live";
import PaginateList from "@/components/paginate-list";
import { docCount } from "@/sanity/lib/queries";
const LIMIT = 10;
type Params = Promise<{ num: string }>;
export default async function Page({ params }: { params: Params }) {
const [count] = (
await Promise.all([
sanityFetch({
query: docCount,
params: {
type: "sponsor",
},
}),
])
).map((res) => res.data) as [DocCountResult];
const { num } = await params;
const pageNumber = Number(num);
const offset = (pageNumber - 1) * LIMIT;
const limit = offset + LIMIT;
return (
<div className="container px-5 mx-auto mb-32">
<div className="flex flex-col items-center my-8">
<h2 className="text-2xl font-bold">Want to see your name here?</h2>
<p className="text-lg text-muted-foreground">
Become a sponsor and support our content.
</p>
<Button asChild className="mt-4">
<Link href="/sponsorships">Become a Sponsor</Link>
</Button>
</div>
<MoreContent type="sponsor" limit={limit} offset={offset} showHeader />
<PaginateList
base="sponsors"
num={Number(num)}
limit={LIMIT}
count={count}
/>
<BecomeSponsorPopup />
</div>
);
}