1
0
Fork 0
freesewing/sites/org/pages/curate/index.mjs

60 lines
1.8 KiB
JavaScript
Raw Normal View History

2023-05-08 09:31:37 +02:00
// Dependencies
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
2023-09-04 17:12:52 +02:00
import { nsMerge } from 'shared/utils.mjs'
2023-05-08 09:31:37 +02:00
// Hooks
import { useTranslation } from 'next-i18next'
// Components
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
2023-09-04 17:12:52 +02:00
import { AuthWrapper } from 'shared/components/wrappers/auth/index.mjs'
import { CsetIcon, OpackIcon } from 'shared/components/icons.mjs'
2023-05-08 09:31:37 +02:00
import { ns as authNs } from 'shared/components/wrappers/auth/index.mjs'
2023-09-04 17:45:03 +02:00
import { CardLink } from 'shared/components/link.mjs'
2023-05-08 09:31:37 +02:00
// Translation namespaces used on this page
2023-09-04 17:12:52 +02:00
const ns = nsMerge('curate', 'sets', pageNs, authNs)
2023-05-08 09:31:37 +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 CuratorPage = ({ page }) => {
2023-09-04 17:12:52 +02:00
const { t } = useTranslation(ns)
2023-05-08 09:31:37 +02:00
return (
2023-09-04 17:12:52 +02:00
<PageWrapper {...page} title={t('curate:curate')}>
<AuthWrapper requiredRole="curator">
<div className="grid grid-cols-1 lg:grid-cols-2 gap-2 max-w-6xl">
<CardLink
title={t('curate:sets')}
icon={<CsetIcon className="w-10 h-10 text-secondary" />}
2023-05-08 09:31:37 +02:00
href="/curate/sets"
2023-09-04 17:12:52 +02:00
text={t('curate:curateSets')}
/>
<CardLink
title={t('curate:packs')}
icon={<OpackIcon className="w-10 h-10 text-secondary" />}
href="/curate/packs"
text={t('curate:curatePacks')}
/>
2023-05-08 09:31:37 +02:00
</div>
2023-09-04 17:12:52 +02:00
</AuthWrapper>
2023-05-08 09:31:37 +02:00
</PageWrapper>
)
}
export default CuratorPage
export async function getStaticProps({ locale }) {
return {
props: {
2023-09-04 17:12:52 +02:00
...(await serverSideTranslations(locale, ns)),
2023-05-08 09:31:37 +02:00
page: {
locale,
path: ['curate'],
},
},
}
}