Skip to content

Commit 2efd969

Browse files
committed
feat: update layouts to use contributors from getStaticProps
1 parent 9700958 commit 2efd969

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,6 @@ robots.txt
5454
.vscode
5555

5656
# Crowdin report output
57-
src/data/crowdin/bucketsAwaitingReviewReport.csv
57+
src/data/crowdin/bucketsAwaitingReviewReport.csv
58+
59+
src/data/commit-history.json

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"version": "8.5.2",
44
"private": true,
55
"scripts": {
6-
"dev": "next dev",
6+
"dev": "yarn clean-commit-history && next dev",
77
"postinstall": "yarn theme",
8-
"build": "next build",
8+
"build": "yarn clean-commit-history && next build",
9+
"clean-commit-history": "touch ./src/data/commit-history.json && rm ./src/data/commit-history.json",
910
"postbuild": "next-sitemap",
1011
"start": "next start",
1112
"lint": "next lint",

src/pages/[...slug].tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import {
5555
UseCasesLayout,
5656
} from "@/layouts"
5757
import { fetchGFIs } from "@/lib/api/fetchGFIs"
58+
import { fetchAndSaveGitHistory } from "@/lib/api/fetchGitHistory"
5859
import rehypeHeadingIds from "@/lib/rehype/rehypeHeadingIds"
5960
import rehypeImg from "@/lib/rehype/rehypeImg"
6061
import remarkInferToc from "@/lib/rehype/remarkInferToc"
@@ -180,6 +181,8 @@ export const getStaticProps = (async (context) => {
180181

181182
const gfissues = await gfIssuesDataFetch()
182183

184+
const contributors = await fetchAndSaveGitHistory(mdDir)
185+
183186
return {
184187
props: {
185188
...(await serverSideTranslations(locale!, requiredNamespaces)),
@@ -194,13 +197,14 @@ export const getStaticProps = (async (context) => {
194197
tocItems,
195198
crowdinContributors,
196199
gfissues,
200+
contributors,
197201
},
198202
}
199203
}) satisfies GetStaticProps<Props, Params>
200204

201205
const ContentPage: NextPageWithLayout<
202206
InferGetStaticPropsType<typeof getStaticProps>
203-
> = ({ mdxSource, layout, gfissues }) => {
207+
> = ({ mdxSource, layout, gfissues, contributorHistory }) => {
204208
// TODO: Address component typing error here (flip `FC` types to prop object types)
205209
// @ts-expect-error
206210
const components: Record<string, React.ReactNode> = {
@@ -229,6 +233,7 @@ ContentPage.getLayout = (page) => {
229233
tocItems,
230234
crowdinContributors,
231235
contentNotTranslated,
236+
contributors,
232237
} = page.props
233238

234239
const layoutProps = {
@@ -239,6 +244,7 @@ ContentPage.getLayout = (page) => {
239244
tocItems,
240245
crowdinContributors,
241246
contentNotTranslated,
247+
contributors,
242248
}
243249
const Layout = layoutMapping[layout]
244250

0 commit comments

Comments
 (0)