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

52 lines
1.6 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'
// Hooks
import { useTranslation } from 'next-i18next'
2023-05-08 09:31:37 +02:00
// Components
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
import { ns as authNs } from 'shared/components/wrappers/auth/index.mjs'
2023-09-04 17:12:52 +02:00
import { AuthWrapper } from 'shared/components/wrappers/auth/index.mjs'
import { CuratedSetsList } from 'shared/components/curated-sets.mjs'
2023-09-04 17:12:52 +02:00
import { CsetSubmissions } from 'shared/components/submissions/index.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:curateSets')}>
<AuthWrapper requiredRole="curator">
<div className="max-w-6xl">
<h2>{t('curate:suggestedSets')}</h2>
<CsetSubmissions />
<h2>{t('curate:sets')}</h2>
<CuratedSetsList href={(id) => `/curate/sets/${id}`} />
2023-09-04 17:12:52 +02:00
</div>
</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', 'sets'],
},
},
}
}