@@ -4,7 +4,15 @@ import { SSRConfig } from "next-i18next"
4
4
import { serverSideTranslations } from "next-i18next/serverSideTranslations"
5
5
import { useTranslation } from "react-i18next"
6
6
import { FaGithub } from "react-icons/fa"
7
- import { Badge , Box , chakra , Flex , forwardRef , Heading , useToken } from "@chakra-ui/react"
7
+ import {
8
+ Badge ,
9
+ Box ,
10
+ chakra ,
11
+ Flex ,
12
+ forwardRef ,
13
+ Heading ,
14
+ useToken ,
15
+ } from "@chakra-ui/react"
8
16
9
17
import { Lang } from "@/lib/types"
10
18
@@ -17,15 +25,18 @@ import OldHeading from "@/components/OldHeading"
17
25
import Text from "@/components/OldText"
18
26
import PageMetadata from "@/components/PageMetadata"
19
27
import Translation from "@/components/Translation"
20
- import { getSkillTranslationId , Skill } from "@/components/TutorialMetadata"
28
+ import { getSkillTranslationId , Skill } from "@/components/TutorialMetadata"
21
29
import TutorialTags from "@/components/TutorialTags"
22
30
23
31
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
24
32
import { trackCustomEvent } from "@/lib/utils/matomo"
25
33
import { getTutorialsData } from "@/lib/utils/md"
26
- import { getLocaleTimestamp , INVALID_DATETIME } from "@/lib/utils/time"
34
+ import { getLocaleTimestamp , INVALID_DATETIME } from "@/lib/utils/time"
27
35
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
28
- import { filterTutorialsByLang , getSortedTutorialTagsForLang } from "@/lib/utils/tutorial"
36
+ import {
37
+ filterTutorialsByLang ,
38
+ getSortedTutorialTagsForLang ,
39
+ } from "@/lib/utils/tutorial"
29
40
30
41
import externalTutorials from "@/data/externalTutorials.json"
31
42
@@ -60,23 +71,29 @@ const FilterTag = forwardRef<{ isActive: boolean; name: string }, "button">(
60
71
}
61
72
)
62
73
63
- export const getStaticProps = ( async (
64
- context
65
- ) => {
74
+ type Props = SSRConfig & {
75
+ internalTutorials : ITutorial [ ]
76
+ locale : string | undefined
77
+ lastDeployDate : string
78
+ }
79
+
80
+ export const getStaticProps = ( async ( context ) => {
66
81
const { locale } = context
67
82
// load i18n required namespaces for the given page
68
- const requiredNamespaces = getRequiredNamespacesForPage ( '/developers/tutorials' )
83
+ const requiredNamespaces = getRequiredNamespacesForPage (
84
+ "/developers/tutorials"
85
+ )
69
86
const lastDeployDate = getLastDeployDate ( )
70
87
71
88
return {
72
89
props : {
73
90
...( await serverSideTranslations ( locale ! , requiredNamespaces ) ) ,
74
91
internalTutorials : getTutorialsData ( locale ! ) ,
75
92
locale,
76
- lastDeployDate
93
+ lastDeployDate,
77
94
} ,
78
95
}
79
- } ) satisfies GetStaticProps < SSRConfig >
96
+ } ) satisfies GetStaticProps < Props >
80
97
81
98
export interface IExternalTutorial {
82
99
url : string
@@ -113,7 +130,10 @@ const published = (locale: string, published: string) => {
113
130
) : null
114
131
}
115
132
116
- const TutorialPage = ( { internalTutorials, locale } : InferGetServerSidePropsType < typeof getStaticProps > ) => {
133
+ const TutorialPage = ( {
134
+ internalTutorials,
135
+ locale,
136
+ } : InferGetServerSidePropsType < typeof getStaticProps > ) => {
117
137
const tableBoxShadow = useToken ( "colors" , "tableBoxShadow" )
118
138
const cardBoxShadow = useToken ( "colors" , "cardBoxShadow" )
119
139
const filteredTutorialsByLang = useMemo (
@@ -184,7 +204,9 @@ const TutorialPage = ({ internalTutorials, locale }: InferGetServerSidePropsType
184
204
>
185
205
< PageMetadata
186
206
title = { t ( "page-developers-tutorials:page-tutorials-meta-title" ) }
187
- description = { t ( "page-developers-tutorials:page-tutorials-meta-description" ) }
207
+ description = { t (
208
+ "page-developers-tutorials:page-tutorials-meta-description"
209
+ ) }
188
210
/>
189
211
< Heading
190
212
fontStyle = "normal"
0 commit comments