2023-04-22 15:02:11 +02:00
|
|
|
// Dependencies
|
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
2023-04-30 20:31:28 +02:00
|
|
|
// Hooks
|
|
|
|
import { useTranslation } from 'next-i18next'
|
|
|
|
import { useAccount } from 'shared/hooks/use-account.mjs'
|
2023-04-22 15:02:11 +02:00
|
|
|
// Components
|
|
|
|
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
|
2023-04-30 20:31:28 +02:00
|
|
|
import { ChoiceLink } from 'shared/components/choice-link.mjs'
|
2023-06-15 20:14:11 +02:00
|
|
|
import { KeyIcon, MeasieIcon, DesignIcon, PageIcon, PluginIcon } from 'shared/components/icons.mjs'
|
2023-04-22 15:02:11 +02:00
|
|
|
|
|
|
|
// Translation namespaces used on this page
|
|
|
|
// Note that we include the account namespace here for the 'new' keyword
|
|
|
|
const namespaces = [...pageNs, 'account']
|
|
|
|
|
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.
|
|
|
|
*/
|
2023-04-30 20:31:28 +02:00
|
|
|
const NewIndexPage = ({ page }) => {
|
|
|
|
const { t } = useTranslation(['account'])
|
|
|
|
const { account } = useAccount()
|
|
|
|
|
|
|
|
const control = account.control ? account.control : 99
|
|
|
|
|
|
|
|
return (
|
|
|
|
<PageWrapper {...page}>
|
|
|
|
<div className="max-w-lg">
|
2023-04-30 21:24:35 +02:00
|
|
|
<h2>{t('newBasic')}</h2>
|
|
|
|
|
|
|
|
<ChoiceLink
|
|
|
|
title={t('patternNew')}
|
|
|
|
icon={<PageIcon className="w-10 h-10 text-secondary" />}
|
|
|
|
href="/new/pattern"
|
|
|
|
>
|
|
|
|
{t('patternNewInfo')}
|
|
|
|
</ChoiceLink>
|
|
|
|
|
|
|
|
<ChoiceLink
|
|
|
|
title={t('newSet')}
|
2023-06-15 20:14:11 +02:00
|
|
|
icon={<MeasieIcon className="w-10 h-10 text-secondary" />}
|
2023-04-30 21:24:35 +02:00
|
|
|
href="/new/set"
|
|
|
|
>
|
2023-04-30 20:31:28 +02:00
|
|
|
{t('setNewInfo')}
|
|
|
|
</ChoiceLink>
|
2023-04-30 21:24:35 +02:00
|
|
|
|
|
|
|
{control > 3 ? (
|
|
|
|
<>
|
|
|
|
<h2>{t('newAdvanced')}</h2>
|
|
|
|
|
|
|
|
<ChoiceLink
|
|
|
|
title={t('newApikey')}
|
|
|
|
icon={<KeyIcon className="w-10 h-10 text-secondary" stroke={1.7} />}
|
|
|
|
href="/new/apikey"
|
|
|
|
>
|
|
|
|
{t('keyNewInfo')}
|
|
|
|
</ChoiceLink>
|
|
|
|
|
|
|
|
<ChoiceLink
|
|
|
|
title={t('designNew')}
|
|
|
|
icon={<DesignIcon className="w-10 h-10 text-secondary" />}
|
|
|
|
href="https://freesewing.dev/tutorials/pattern-design"
|
|
|
|
>
|
|
|
|
{t('designNewInfo')}
|
|
|
|
</ChoiceLink>
|
|
|
|
|
|
|
|
<ChoiceLink
|
|
|
|
title={t('pluginNew')}
|
|
|
|
icon={<PluginIcon className="w-10 h-10 text-secondary" stroke={1.7} />}
|
|
|
|
href="https://freesewing.dev/guides/plugins"
|
|
|
|
>
|
|
|
|
{t('pluginNewInfo')}
|
|
|
|
</ChoiceLink>
|
|
|
|
</>
|
|
|
|
) : null}
|
2023-04-30 20:31:28 +02:00
|
|
|
</div>
|
|
|
|
</PageWrapper>
|
|
|
|
)
|
|
|
|
}
|
2023-04-22 15:02:11 +02:00
|
|
|
|
2023-04-28 21:23:06 +02:00
|
|
|
export default NewIndexPage
|
2023-04-22 15:02:11 +02:00
|
|
|
|
|
|
|
export async function getStaticProps({ locale }) {
|
|
|
|
return {
|
|
|
|
props: {
|
|
|
|
...(await serverSideTranslations(locale, namespaces)),
|
|
|
|
page: {
|
2023-04-28 21:23:06 +02:00
|
|
|
locale,
|
2023-04-22 15:02:11 +02:00
|
|
|
path: ['new'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|