1
0
Fork 0

fix(org): Set title on patterns page

This commit is contained in:
joostdecock 2023-08-26 09:39:18 +02:00
parent 6ca8a2c51e
commit 018b74aa98

View file

@ -1,13 +1,16 @@
// Dependencies // Dependencies
import dynamic from 'next/dynamic' import dynamic from 'next/dynamic'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { nsMerge } from 'shared/utils.mjs'
// Hooks
import { useTranslation } from 'next-i18next'
// Components // Components
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs' 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 authNs } from 'shared/components/wrappers/auth/index.mjs'
import { ns as setsNs } from 'shared/components/account/sets.mjs' import { ns as setsNs } from 'shared/components/account/sets.mjs'
// Translation namespaces used on this page // Translation namespaces used on this page
const namespaces = [...new Set([...setsNs, ...authNs, ...pageNs])] const ns = nsMerge(setsNs, authNs, pageNs)
/* /*
* Some things should never generated as SSR * Some things should never generated as SSR
@ -29,20 +32,24 @@ const DynamicPatterns = dynamic(
* when path and locale come from static props (as here) * when path and locale come from static props (as here)
* or set them manually. * or set them manually.
*/ */
const AccountSetsPage = ({ page }) => ( const AccountSetsPage = ({ page }) => {
<PageWrapper {...page}> const { t } = useTranslation(ns)
<DynamicAuthWrapper>
<DynamicPatterns /> return (
</DynamicAuthWrapper> <PageWrapper {...page} title={t('patterns')}>
</PageWrapper> <DynamicAuthWrapper>
) <DynamicPatterns />
</DynamicAuthWrapper>
</PageWrapper>
)
}
export default AccountSetsPage export default AccountSetsPage
export async function getStaticProps({ locale }) { export async function getStaticProps({ locale }) {
return { return {
props: { props: {
...(await serverSideTranslations(locale, namespaces)), ...(await serverSideTranslations(locale, ns)),
page: { page: {
locale, locale,
path: ['account', 'patterns'], path: ['account', 'patterns'],