2023-05-24 18:11:18 +02:00
|
|
|
// Dependencies
|
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
|
|
|
import { useTranslation } from 'next-i18next'
|
|
|
|
import Head from 'next/head'
|
|
|
|
// Components
|
|
|
|
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
|
|
|
|
import { Popout } from 'shared/components/popout.mjs'
|
|
|
|
import { WebLink } from 'shared/components/web-link.mjs'
|
|
|
|
import { siteConfig } from 'site/site.config.mjs'
|
|
|
|
import { freeSewingConfig } from 'shared/config/freesewing.config.mjs'
|
2023-05-26 10:41:19 +02:00
|
|
|
import { ChoiceLink } from 'shared/components/choice-link.mjs'
|
|
|
|
import { GitHubIcon, CodeIcon } from 'shared/components/icons.mjs'
|
2023-05-24 18:11:18 +02:00
|
|
|
|
2023-05-26 10:41:19 +02:00
|
|
|
const ns = [...pageNs, 'labcode']
|
2023-05-24 18:11:18 +02:00
|
|
|
|
|
|
|
const RepoLink = ({ href = false }) =>
|
|
|
|
href ? (
|
|
|
|
<ul className="list list-inside">
|
|
|
|
<li className="list list-disc pl-2">
|
|
|
|
<WebLink href={href} txt={href.split('://').pop()} />
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
) : null
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 DocsPage = ({ page }) => {
|
2023-05-26 11:38:57 +02:00
|
|
|
const { t } = useTranslation(ns)
|
2023-05-24 18:11:18 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<PageWrapper {...page}>
|
|
|
|
<div className="max-w-prose">
|
2023-05-26 10:41:19 +02:00
|
|
|
<ChoiceLink
|
|
|
|
title={t('labcode:fscode')}
|
|
|
|
href={freeSewingConfig.monorepo}
|
|
|
|
icon={<GitHubIcon className="w-8 h-8" />}
|
|
|
|
>
|
|
|
|
<p>{t('labcode:monorepo')}:</p>
|
|
|
|
<RepoLink href={freeSewingConfig.monorepo} />
|
|
|
|
</ChoiceLink>
|
|
|
|
{true || siteConfig.repo !== freeSewingConfig.monorepo ? (
|
|
|
|
<ChoiceLink
|
|
|
|
title={t('labcode:lab')}
|
|
|
|
href={freeSewingConfig.monorepo}
|
|
|
|
icon={<CodeIcon className="w-8 h-8" />}
|
|
|
|
>
|
|
|
|
<p>{t('labcode:labrepo')}:</p>
|
2023-05-24 18:11:18 +02:00
|
|
|
<RepoLink href={siteConfig.repo} />
|
2023-05-26 10:41:19 +02:00
|
|
|
</ChoiceLink>
|
2023-05-24 18:11:18 +02:00
|
|
|
) : null}
|
|
|
|
</div>
|
|
|
|
</PageWrapper>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default DocsPage
|
|
|
|
|
|
|
|
export async function getStaticProps({ locale }) {
|
|
|
|
return {
|
|
|
|
props: {
|
|
|
|
...(await serverSideTranslations(locale, ns)),
|
|
|
|
page: {
|
|
|
|
locale,
|
|
|
|
path: ['code'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|