-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.tsx
119 lines (104 loc) · 3.09 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import {GetStaticProps} from 'next'
import {useTranslation} from 'next-i18next'
import {serverSideTranslations} from 'next-i18next/serverSideTranslations'
import {NextSeo, SocialProfileJsonLd} from 'next-seo'
import {FC} from 'react'
import {getStars} from '@/api/github-stars'
import {getUnsplashViews} from '@/api/unsplash-views'
import {getYouTubeViews} from '@/api/youtube-views'
import {Footer} from '@/components/Footer'
import {Header} from '@/components/Home/Header'
import {Statistics} from '@/components/Home/Statistics'
import {Timeline} from '@/components/Home/Timeline'
import {Navigation} from '@/components/Navigation'
interface Props {
locale: string
githubStars: number
unsplashViews: number
youTubeViews: number
lastUpdated: string
}
// TODO latest posts on home page
// TODO favs (music, songs, creators, videos, applications, ...)
const Home: FC<Props> = props => {
const {t} = useTranslation()
const title = 'Florian Ludewig'
const description = t('home:tagline')
const url = `https://flolu.de/${props.locale}`
return (
<>
<NextSeo
title={title}
description={description}
canonical={url}
openGraph={{
url,
title,
description,
locale: props.locale,
type: 'profile',
profile: {firstName: 'Florian', lastName: 'Ludewig', username: 'flolu', gender: 'Male'},
images: [
{
url: 'https://flolu.de/avatar.webp',
width: 512,
height: 512,
alt: 'Florian Ludewig Profile Photo',
},
],
}}
languageAlternates={[
{hrefLang: 'en', href: 'https://flolu.de/en'},
{hrefLang: 'de', href: 'https://flolu.de/de'},
]}
/>
<SocialProfileJsonLd
type="Person"
name="Flo"
url={url}
sameAs={[
'https://www.instagram.com/flo.ludewig',
'https://www.youtube.com/@flolu',
'https://github.com/flolu',
'https://stackoverflow.com/users/8586803',
'https://unsplash.com/@flolu',
'https://t.me/flolu',
]}
/>
<Navigation />
<Header />
<main className="mb-8 space-y-24 sm:mb-16 sm:space-y-32">
<Timeline />
<Statistics
githubStars={props.githubStars}
unsplashViews={props.unsplashViews}
youTubeViews={props.youTubeViews}
locale={props.locale}
/>
</main>
<Footer />
</>
)
}
export const getStaticProps: GetStaticProps<Props> = async context => {
const namespaces = ['header', 'footer', 'home', 'timeline', 'common']
const locale = context.locale || 'en'
const [translations, githubStars, unsplashViews, youTubeViews] = await Promise.all([
serverSideTranslations(locale, namespaces),
getStars(),
getUnsplashViews(),
getYouTubeViews(),
])
return {
props: {
...translations,
githubStars,
unsplashViews,
youTubeViews,
lastUpdated: new Date().toISOString(),
locale,
},
revalidate: 60 * 60 * 1,
}
}
export default Home