Skip to content

Commit b9292ed

Browse files
committed
fix: add contentNotTranslated prop to what-is-ethereum
1 parent 82f1de2 commit b9292ed

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

src/pages/what-is-ethereum.tsx

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { GetStaticProps } from "next"
22
import { useRouter } from "next/router"
3-
import { SSRConfig, useTranslation } from "next-i18next"
3+
import { useTranslation } from "next-i18next"
44
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
5-
import { MdInfoOutline } from "react-icons/md"
65
import {
76
Box,
87
type BoxProps,
@@ -11,7 +10,6 @@ import {
1110
type FlexProps,
1211
Heading,
1312
type HeadingProps,
14-
Icon,
1513
ListItem,
1614
UnorderedList,
1715
} from "@chakra-ui/react"
@@ -21,16 +19,10 @@ import {
2119
// defaultFormatter,
2220
// IFetchStat,
2321
// } from "../hooks/useFetchStat" // TODO!
24-
import type { ChildOnlyProp, Lang } from "@/lib/types"
22+
import type { BasePageProps, ChildOnlyProp, Lang } from "@/lib/types"
2523

2624
import AdoptionChart from "@/components/AdoptionChart"
27-
import {
28-
Banner,
29-
BannerBody,
30-
BannerGrid,
31-
BannerGridCell,
32-
BannerImage,
33-
} from "@/components/BannerGrid"
25+
import { Banner, BannerImage } from "@/components/BannerGrid"
3426
import Button from "@/components/Buttons/Button"
3527
import ButtonLink from "@/components/Buttons/ButtonLink"
3628
import Callout from "@/components/Callout"
@@ -44,12 +36,10 @@ import Text from "@/components/OldText"
4436
import PageMetadata from "@/components/PageMetadata"
4537
import { StandaloneQuizWidget } from "@/components/Quiz/QuizWidget"
4638
import Slider, { EmblaSlide } from "@/components/Slider"
47-
import StatErrorMessage from "@/components/StatErrorMessage"
48-
import StatLoadingMessage from "@/components/StatLoadingMessage"
4939
import Tabs from "@/components/Tabs"
50-
import Tooltip from "@/components/Tooltip"
5140
import Translation from "@/components/Translation"
5241

42+
import { existsNamespace } from "@/lib/utils/existsNamespace"
5343
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
5444
import { trackCustomEvent } from "@/lib/utils/matomo"
5545
import {
@@ -194,20 +184,21 @@ const Image400 = ({ src }: Pick<ImageProps, "src">) => (
194184
<Image src={src} alt="" width={400} />
195185
)
196186

197-
export const getStaticProps = (async (context) => {
198-
const { locale } = context
187+
export const getStaticProps = (async ({ locale }) => {
188+
const lastDeployDate = getLastDeployDate()
199189

200-
// load i18n required namespaces for the given page
201190
const requiredNamespaces = getRequiredNamespacesForPage("/what-is-ethereum")
202-
const lastDeployDate = getLastDeployDate()
191+
192+
const contentNotTranslated = !existsNamespace(locale!, requiredNamespaces[1])
203193

204194
return {
205195
props: {
206196
...(await serverSideTranslations(locale!, requiredNamespaces)),
197+
contentNotTranslated,
207198
lastDeployDate,
208199
},
209200
}
210-
}) satisfies GetStaticProps<SSRConfig>
201+
}) satisfies GetStaticProps<BasePageProps>
211202

212203
const WhatIsEthereumPage = () => {
213204
const { t } = useTranslation(["page-what-is-ethereum", "learn-quizzes"])
@@ -663,7 +654,9 @@ const WhatIsEthereumPage = () => {
663654
<Width60>
664655
<H2>{t("page-what-is-ethereum-energy-title")}</H2>
665656
<Text>{t("page-what-is-ethereum-energy-desc-1")}</Text>
666-
<Text><Translation id="page-what-is-ethereum:page-what-is-ethereum-energy-desc-2"/></Text>
657+
<Text>
658+
<Translation id="page-what-is-ethereum:page-what-is-ethereum-energy-desc-2" />
659+
</Text>
667660
<ButtonRow>
668661
<ButtonLink to="/energy-consumption/">
669662
{t("page-what-is-ethereum-more-on-energy-consumption")}

0 commit comments

Comments
 (0)