Skip to content

Commit 4de30af

Browse files
committed
change requests
1 parent 5b3a470 commit 4de30af

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/pages/developers/tutorials.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { useEffect, useMemo, useState } from "react"
2-
import { GetStaticProps } from "next"
2+
import { GetStaticProps, InferGetServerSidePropsType } from "next"
3+
import { SSRConfig } from "next-i18next"
34
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
45
import { useTranslation } from "react-i18next"
5-
import { FaGithub, FaYandexInternational } from "react-icons/fa"
6+
import { FaGithub } from "react-icons/fa"
67
import { Badge, Box, chakra, Flex, forwardRef, Heading, useToken } from "@chakra-ui/react"
78

89
import { Lang } from "@/lib/types"
@@ -19,6 +20,7 @@ import Translation from "@/components/Translation"
1920
import { getSkillTranslationId,Skill } from "@/components/TutorialMetadata"
2021
import TutorialTags from "@/components/TutorialTags"
2122

23+
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
2224
import { trackCustomEvent } from "@/lib/utils/matomo"
2325
import { getTutorialsData } from "@/lib/utils/md"
2426
import { getLocaleTimestamp,INVALID_DATETIME } from "@/lib/utils/time"
@@ -58,21 +60,23 @@ const FilterTag = forwardRef<{ isActive: boolean; name: string }, "button">(
5860
}
5961
)
6062

61-
export const getStaticProps = async (
63+
export const getStaticProps = (async (
6264
context
6365
) => {
6466
const { locale } = context
6567
// load i18n required namespaces for the given page
6668
const requiredNamespaces = getRequiredNamespacesForPage('/developers/tutorials')
69+
const lastDeployDate = getLastDeployDate()
6770

6871
return {
6972
props: {
7073
...(await serverSideTranslations(locale!, requiredNamespaces)),
7174
internalTutorials: getTutorialsData(locale!),
7275
locale,
76+
lastDeployDate
7377
},
7478
}
75-
}
79+
}) satisfies GetStaticProps<SSRConfig>
7680

7781
export interface IExternalTutorial {
7882
url: string
@@ -109,15 +113,15 @@ const published = (locale: string, published: string) => {
109113
) : null
110114
}
111115

112-
const TutorialPage = ({ internalTutorials, locale }: InferGetServerSidePropsType<typeof getServerSideProps>) => {
116+
const TutorialPage = ({ internalTutorials, locale }: InferGetServerSidePropsType<typeof getStaticProps>) => {
113117
const tableBoxShadow = useToken("colors", "tableBoxShadow")
114118
const cardBoxShadow = useToken("colors", "cardBoxShadow")
115119
const filteredTutorialsByLang = useMemo(
116120
() =>
117121
filterTutorialsByLang(
118122
internalTutorials,
119123
externalTutorials,
120-
locale
124+
locale as Lang
121125
),
122126
[internalTutorials, locale]
123127
)
@@ -438,22 +442,22 @@ const TutorialPage = ({ internalTutorials, locale }: InferGetServerSidePropsType
438442
<Text color="text200" fontSize="sm" textTransform="uppercase">
439443
<Emoji text=":writing_hand:" fontSize="sm" mr={2} />
440444
{tutorial.author}
441-
{published(locale, tutorial.published ?? "")}
445+
{published(locale!, tutorial.published ?? "")}
442446
{tutorial.timeToRead && (
443447
<>
444448
{" "}
445449
446450
<Emoji text=":stopwatch:" fontSize="sm" ml={2} mr={2} />
447451
{tutorial.timeToRead}{" "}
448-
<Translation id="page-tutorial-read-time" />
452+
<Translation id="page-developers-tutorials:page-tutorial-read-time" />
449453
</>
450454
)}
451455
{tutorial.isExternal && (
452456
<>
453457
{" "}
454458
<Emoji text=":link:" fontSize="sm" ml={2} mr={2} />
455459
<Box as="span" color="primary.base" cursor="pointer">
456-
<Translation id="page-tutorial-external-link" />
460+
<Translation id="page-developers-tutorials:page-tutorial-external-link" />
457461
</Box>
458462
</>
459463
)}

0 commit comments

Comments
 (0)