2023-02-18 16:11:02 +01:00
|
|
|
// Dependencies
|
|
|
|
import dynamic from 'next/dynamic'
|
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
|
|
|
// Components
|
2023-03-27 19:07:48 +02:00
|
|
|
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
|
|
|
|
import { ns as authNs } from 'shared/components/wrappers/auth/index.mjs'
|
|
|
|
import { ns as controlNs } from 'shared/components/account/control.mjs'
|
2023-02-18 16:11:02 +01:00
|
|
|
|
|
|
|
// Translation namespaces used on this page
|
|
|
|
const namespaces = [...new Set([...controlNs, ...authNs, ...pageNs])]
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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-18 16:11:02 +01:00
|
|
|
{ ssr: false }
|
|
|
|
)
|
|
|
|
|
|
|
|
const DynamicControl = dynamic(
|
2023-03-27 19:07:48 +02:00
|
|
|
() => import('shared/components/account/control.mjs').then((mod) => mod.ControlSettings),
|
2023-02-18 16:11:02 +01:00
|
|
|
{ ssr: false }
|
|
|
|
)
|
|
|
|
|
2023-04-28 21:23:06 +02:00
|
|
|
/*
|
|
|
|
* Each page MUST be wrapped in the PageWrapper component.
|
|
|
|
* You also MUST spread props.page into this wrapper component
|
|
|
|
* when path and locale come from static props (as here)
|
|
|
|
* or set them manually.
|
|
|
|
*/
|
|
|
|
const AccountPage = ({ page }) => (
|
|
|
|
<PageWrapper {...page}>
|
|
|
|
<DynamicAuthWrapper>
|
|
|
|
<DynamicControl title />
|
|
|
|
</DynamicAuthWrapper>
|
|
|
|
</PageWrapper>
|
|
|
|
)
|
2023-02-18 16:11:02 +01:00
|
|
|
|
|
|
|
export default AccountPage
|
|
|
|
|
|
|
|
export async function getStaticProps({ locale }) {
|
|
|
|
return {
|
|
|
|
props: {
|
|
|
|
...(await serverSideTranslations(locale, namespaces)),
|
2023-03-27 19:07:48 +02:00
|
|
|
page: {
|
2023-04-28 21:23:06 +02:00
|
|
|
locale,
|
2023-03-27 19:07:48 +02:00
|
|
|
path: ['account', 'control'],
|
|
|
|
},
|
2023-02-18 16:11:02 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|