Skip to content

Commit ad16dbd

Browse files
committed
fix: add contentNotTranslated prop to acknowledgements
1 parent b9292ed commit ad16dbd

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/pages/contributing/translation-program/acknowledgements.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useRouter } from "next/router"
22
import { GetStaticProps } from "next/types"
3-
import { SSRConfig, useTranslation } from "next-i18next"
3+
import { useTranslation } from "next-i18next"
44
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
55
import {
66
Box,
@@ -12,6 +12,8 @@ import {
1212
useColorModeValue,
1313
} from "@chakra-ui/react"
1414

15+
import { BasePageProps } from "@/lib/types"
16+
1517
import ActionCard from "@/components/ActionCard"
1618
import Breadcrumbs from "@/components/Breadcrumbs"
1719
import FeedbackCard from "@/components/FeedbackCard"
@@ -22,6 +24,7 @@ import Text from "@/components/OldText"
2224
import PageMetadata from "@/components/PageMetadata"
2325
import TranslationLeaderboard from "@/components/TranslationLeaderboard"
2426

27+
import { existsNamespace } from "@/lib/utils/existsNamespace"
2528
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
2629
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
2730

@@ -40,25 +43,23 @@ const ContentHeading = (props: HeadingProps) => (
4043
<OldHeading lineHeight={1.4} {...props} />
4144
)
4245

43-
type Props = SSRConfig & {
44-
lastDeployDate: string
45-
}
46+
export const getStaticProps = (async ({ locale }) => {
47+
const lastDeployDate = getLastDeployDate()
4648

47-
export const getStaticProps = (async (context) => {
48-
const { locale } = context
49-
// load i18n required namespaces for the given page
5049
const requiredNamespaces = getRequiredNamespacesForPage(
5150
"/contributing/translation-program/acknowledgements"
5251
)
53-
const lastDeployDate = getLastDeployDate()
52+
53+
const contentNotTranslated = !existsNamespace(locale!, requiredNamespaces[1])
5454

5555
return {
5656
props: {
5757
...(await serverSideTranslations(locale!, requiredNamespaces)),
58+
contentNotTranslated,
5859
lastDeployDate,
5960
},
6061
}
61-
}) satisfies GetStaticProps<Props>
62+
}) satisfies GetStaticProps<BasePageProps>
6263

6364
const TranslatorAcknowledgements = () => {
6465
const router = useRouter()

0 commit comments

Comments
 (0)