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'
|
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
2022-05-28 03:45:05 +00:00
|
|
|
import { LoginContext } from '../contexts/login';
|
|
|
|
import { useDefinedContext } from '../utils/definedContext';
|
2022-06-01 14:58:19 +00:00
|
|
|
import { ActionLoginTelegram } from '../components/ActionLoginTelegram';
|
|
|
|
import { ActionEventList } from '../components/ActionEventList';
|
2022-06-03 02:07:12 +00:00
|
|
|
import { PostcardContext } from '../contexts/postcard';
|
|
|
|
import defaultPostcard from "../public/postcards/adi-goldstein-Hli3R6LKibo-unsplash.jpg"
|
|
|
|
import { useEffect } from 'react';
|
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-03 02:07:12 +00:00
|
|
|
const [login, ] = useDefinedContext(LoginContext)
|
|
|
|
const [, setPostcard] = useDefinedContext(PostcardContext)
|
|
|
|
|
|
|
|
useEffect(
|
|
|
|
() => {
|
|
|
|
setPostcard(defaultPostcard)
|
|
|
|
},
|
|
|
|
[]
|
|
|
|
)
|
2022-05-31 14:35:13 +00:00
|
|
|
|
|
|
|
return (
|
2022-05-29 03:00:48 +00:00
|
|
|
<main id="page-index" className="page">
|
|
|
|
<hgroup className="hero-titles">
|
2022-05-29 02:01:56 +00:00
|
|
|
<h1>
|
|
|
|
{t("siteTitle")}
|
|
|
|
</h1>
|
2022-05-29 03:00:48 +00:00
|
|
|
<h2>
|
|
|
|
{t("siteSubtitle")}
|
|
|
|
</h2>
|
|
|
|
</hgroup>
|
2022-05-31 14:35:13 +00:00
|
|
|
{login ?
|
2022-06-01 14:58:19 +00:00
|
|
|
<ActionEventList
|
2022-06-01 03:04:15 +00:00
|
|
|
className="hero-action"
|
|
|
|
/>
|
2022-05-31 14:35:13 +00:00
|
|
|
:
|
2022-06-01 14:58:19 +00:00
|
|
|
<ActionLoginTelegram
|
2022-05-31 14:35:13 +00:00
|
|
|
className="hero-action"
|
|
|
|
/>
|
2022-05-29 03:00:48 +00:00
|
|
|
}
|
|
|
|
</main>
|
|
|
|
)
|
2022-05-20 11:59:24 +00:00
|
|
|
}
|