1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-10-16 15:07:27 +00:00
festa/pages/index.tsx

50 lines
1.6 KiB
TypeScript
Raw Normal View History

2022-05-29 02:01:56 +00:00
import { NextPageContext } from 'next'
2022-05-25 14:20:22 +00:00
import { useTranslation } from 'next-i18next'
2022-06-04 03:13:19 +00:00
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
2022-06-08 15:38:30 +00:00
import { LoginContext } from '../components/contexts/login'
2022-06-04 03:13:19 +00:00
import { useDefinedContext } from '../utils/definedContext'
import { ActionLoginTelegram } from '../components/ActionLoginTelegram'
import { ActionEventList } from '../components/ActionEventList'
2022-06-08 02:52:41 +00:00
import { default as Head } from 'next/head'
2022-06-03 02:07:12 +00:00
import defaultPostcard from "../public/postcards/adi-goldstein-Hli3R6LKibo-unsplash.jpg"
2022-06-04 03:13:19 +00:00
import { ViewLanding } from '../components/view/ViewLanding'
2022-06-09 21:43:38 +00:00
import { usePostcardImage } from '../components/postcard/usePostcardImage'
2022-05-29 02:01:56 +00:00
2022-05-25 14:20:22 +00:00
export async function getStaticProps(context: NextPageContext) {
2022-05-28 03:45:05 +00:00
return {
props: {
...(await serverSideTranslations(context.locale ?? "it-IT", ["common"]))
}
}
2022-05-25 14:20:22 +00:00
}
2022-05-20 11:59:24 +00:00
2022-05-29 02:01:56 +00:00
export default function PageIndex() {
2022-06-03 01:55:02 +00:00
const { t } = useTranslation()
2022-06-09 21:43:38 +00:00
const [login,] = useDefinedContext(LoginContext)
usePostcardImage(`url(${defaultPostcard.src})`)
2022-06-03 02:07:12 +00:00
2022-06-04 03:13:19 +00:00
return <>
<Head>
<title key="title">{t("siteTitle")}</title>
</Head>
<ViewLanding
title={t("siteTitle")}
subtitle={t("siteSubtitle")}
actions={
(login ?
<ActionEventList
className="hero-action"
/>
2022-06-09 21:43:38 +00:00
:
2022-06-04 03:13:19 +00:00
<ActionLoginTelegram
className="hero-action"
/>
)
2022-05-29 03:00:48 +00:00
}
2022-06-04 03:13:19 +00:00
/>
</>
2022-05-20 11:59:24 +00:00
}