Skip to content

Commit 4c2fbaf

Browse files
authored
feat: generate 100 first contributors and events (#390)
1 parent 318122f commit 4c2fbaf

File tree

6 files changed

+27
-15
lines changed

6 files changed

+27
-15
lines changed

pwa/api/con/conferences.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export const getConferenceData = async (
7272
// Use gray-matter to parse the post metadata section
7373
const matterResult = matter(fileContents);
7474

75+
marked.setOptions({ mangle: false, headerIds: false });
76+
7577
const processedContent =
7678
withDescription && (await marked(matterResult.content, { async: true }));
7779

pwa/api/con/speakers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export const getSpeakerData = async (
5757

5858
const { id } = matterResult.data;
5959

60+
marked.setOptions({ mangle: false, headerIds: false });
61+
6062
const processedContent =
6163
withDescription && (await marked(matterResult.content, { async: true }));
6264

pwa/api/events.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ export async function getEventContent(slug: string): Promise<EventWithContent> {
5858

5959
const title = extractHeadingsFromMarkdown(fileContents, 1)?.[0];
6060

61-
const speakers = await Promise.all(
62-
resultMdx.meta.speakers?.map(async (speaker: { github?: string }) =>
63-
speaker.github
64-
? { ...speaker, link: await getSpeakerLink(speaker.github) }
65-
: speaker
66-
)
67-
);
61+
const speakers = resultMdx.meta.speakers
62+
? await Promise.all(
63+
resultMdx.meta.speakers?.map(async (speaker: { github?: string }) =>
64+
speaker.github
65+
? { ...speaker, link: await getSpeakerLink(speaker.github) }
66+
: speaker
67+
)
68+
)
69+
: [];
6870

6971
return {
7072
...resultMdx.meta,

pwa/app/(common)/community/contributors/[slug]/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
getContributorBySlug,
33
getContributorConferencesBySlug,
4+
getContributors,
45
} from "api/contributors";
56
import Heading from "components/common/typography/Heading";
67
import RepoLink from "./components/RepoLink";
@@ -68,7 +69,8 @@ const parseGithubText = (text: string) => {
6869
};
6970

7071
export async function generateStaticParams() {
71-
return [];
72+
const contributors = await getContributors(0, 100);
73+
return contributors.map((c) => ({ slug: c.login }));
7274
}
7375

7476
export default async function Page({

pwa/app/(common)/events/[slug]/page.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getEventContent } from "api/events";
1+
import { getAllEvents, getEventContent } from "api/events";
22
import Heading from "components/common/typography/Heading";
33
import { Calendar, Video } from "components/icons";
44
import Image from "next/image";
@@ -14,6 +14,13 @@ type Props = {
1414
params: { slug: string };
1515
};
1616

17+
export async function generateStaticParams() {
18+
const events = await getAllEvents();
19+
return events.map((event) => ({ slug: event.slug }));
20+
}
21+
22+
export const dynamicParams = false;
23+
1724
export async function generateMetadata({ params }: Props): Promise<Metadata> {
1825
const { slug } = params;
1926
const { title } = await getEventContent(slug);
@@ -36,10 +43,6 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
3643
};
3744
}
3845

39-
export async function generateStaticParams() {
40-
return [];
41-
}
42-
4346
function convertEventDateToString({
4447
date,
4548
time,
@@ -75,7 +78,7 @@ export default async function Page({
7578
) => <p className="mb-8">{props.children}</p>,
7679
};
7780
return (
78-
<>
81+
<div className="bg-gray-100 dark:bg-blue-black">
7982
<ShapeSection
8083
className="bg-blue pb-4 text-white dark:text-blue-black"
8184
effect="right-triangle"
@@ -143,6 +146,6 @@ export default async function Page({
143146
<Mdx components={components} />
144147
</div>
145148
</div>
146-
</>
149+
</div>
147150
);
148151
}

pwa/app/(common)/help/code-of-conduct/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const getCodeOfConductContent = async () => {
88
);
99
const content = await file.text();
1010
const matterResult = matter(content);
11+
marked.setOptions({ mangle: false, headerIds: false });
1112
const processedContent = await marked(matterResult.content, { async: true });
1213
return processedContent?.toString();
1314
};

0 commit comments

Comments
 (0)