Skip to content

Commit 11cdc3e

Browse files
committed
fix: add contentNotTranslated prop to layer-2
1 parent 52fff8d commit 11cdc3e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/pages/layer-2.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { merge } from "lodash"
22
import { GetStaticProps } from "next"
3-
import { SSRConfig, useTranslation } from "next-i18next"
3+
import { useTranslation } from "next-i18next"
44
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
55
import {
66
Badge,
@@ -15,7 +15,11 @@ import {
1515
UnorderedList,
1616
} from "@chakra-ui/react"
1717

18-
import type { CommonHeroProps, TranslationKey } from "@/lib/types"
18+
import type {
19+
BasePageProps,
20+
CommonHeroProps,
21+
TranslationKey,
22+
} from "@/lib/types"
1923

2024
import { ButtonLink } from "@/components/Buttons"
2125
import Card from "@/components/Card"
@@ -33,6 +37,7 @@ import PageMetadata from "@/components/PageMetadata"
3337
import { StandaloneQuizWidget } from "@/components/Quiz/QuizWidget"
3438
import Translation from "@/components/Translation"
3539

40+
import { existsNamespace } from "@/lib/utils/existsNamespace"
3641
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
3742
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
3843

@@ -104,23 +109,21 @@ const Layer2CardGrid = (props) => (
104109
/>
105110
)
106111

107-
type Props = SSRConfig & {
108-
lastDeployDate: string
109-
}
112+
export const getStaticProps = (async ({ locale }) => {
113+
const lastDeployDate = getLastDeployDate()
110114

111-
export const getStaticProps = (async (context) => {
112-
const { locale } = context
113-
// load i18n required namespaces for the given page
114115
const requiredNamespaces = getRequiredNamespacesForPage("/layer-2")
115-
const lastDeployDate = getLastDeployDate()
116+
117+
const contentNotTranslated = !existsNamespace(locale!, requiredNamespaces[2])
116118

117119
return {
118120
props: {
119121
...(await serverSideTranslations(locale!, requiredNamespaces)),
122+
contentNotTranslated,
120123
lastDeployDate,
121124
},
122125
}
123-
}) satisfies GetStaticProps<Props>
126+
}) satisfies GetStaticProps<BasePageProps>
124127

125128
const Layer2Page = () => {
126129
const { t } = useTranslation("page-layer-2")

0 commit comments

Comments
 (0)