2023-02-11 19:47:35 +01:00
|
|
|
// Dependencies
|
|
|
|
import dynamic from 'next/dynamic'
|
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
2023-08-17 17:05:08 +02:00
|
|
|
// Hooks
|
|
|
|
import { useTranslation } from 'next-i18next'
|
2023-02-11 19:47:35 +01:00
|
|
|
// Components
|
2023-04-16 19:17:49 +02:00
|
|
|
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
|
2023-03-27 19:07:48 +02:00
|
|
|
import { ns as authNs } from 'shared/components/wrappers/auth/index.mjs'
|
2023-02-11 19:47:35 +01:00
|
|
|
|
|
|
|
// Translation namespaces used on this page
|
2023-04-16 19:17:49 +02:00
|
|
|
const ns = [...new Set(['account', ...pageNs, ...authNs])]
|
2023-02-11 19:47:35 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Some things should never generated as SSR
|
|
|
|
* So for these, we run a dynamic import and disable SSR rendering
|
|
|
|
*/
|
|
|
|
const DynamicAuthWrapper = dynamic(
|
2023-03-27 19:07:48 +02:00
|
|
|
() => import('shared/components/wrappers/auth/index.mjs').then((mod) => mod.AuthWrapper),
|
2023-02-11 19:47:35 +01:00
|
|
|
{ ssr: false }
|
|
|
|
)
|
|
|
|
|
|
|
|
const DynamicAccountOverview = dynamic(
|
2023-03-27 19:07:48 +02:00
|
|
|
() => import('shared/components/account/overview.mjs').then((mod) => mod.AccountOverview),
|
2023-02-11 19:47:35 +01:00
|
|
|
{ ssr: false }
|
|
|
|
)
|
|
|
|
|
2023-08-17 17:05:08 +02:00
|
|
|
const AccountIndexPage = ({ page }) => {
|
|
|
|
const { t } = useTranslation(ns)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<PageWrapper {...page} title={t('yourAccount')}>
|
|
|
|
<DynamicAuthWrapper>
|
|
|
|
<DynamicAccountOverview />
|
|
|
|
</DynamicAuthWrapper>
|
|
|
|
</PageWrapper>
|
|
|
|
)
|
|
|
|
}
|
2023-02-11 19:47:35 +01:00
|
|
|
|
2023-04-28 21:23:06 +02:00
|
|
|
export default AccountIndexPage
|
2023-02-11 19:47:35 +01:00
|
|
|
|
|
|
|
export async function getStaticProps({ locale }) {
|
|
|
|
return {
|
|
|
|
props: {
|
2023-04-16 17:13:18 +02:00
|
|
|
...(await serverSideTranslations(locale, ns)),
|
2023-03-27 18:49:09 +02:00
|
|
|
page: {
|
2023-04-28 21:23:06 +02:00
|
|
|
locale,
|
2023-03-27 18:49:09 +02:00
|
|
|
path: ['account'],
|
|
|
|
},
|
2023-02-11 19:47:35 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|