1
0
Fork 0

fix(lab): Keep docs view out of the lab

This commit is contained in:
Joost De Cock 2023-10-03 08:44:50 +02:00
parent 78aed4e207
commit 71e1d2b42d
8 changed files with 78 additions and 42 deletions

View file

@ -0,0 +1,2 @@
// Lab does not support this
export const examples = false

View file

@ -22,9 +22,13 @@ const DesignsPage = ({ page }) => {
return (
<PageWrapper {...page} layout={BareLayout}>
<div className="py-4 m-auto">
<div className="px-4 m-auto">
<h1 className="text-center">FreeSewing {t('account:designs')}</h1>
<DesignPicker hrefBuilder={(design) => `/designs/${design}`} />
<DesignPicker
hrefBuilder={(design) => `/designs/${design}`}
linkTo="docs"
altLinkTo="new"
/>
</div>
</PageWrapper>
)

View file

@ -4,4 +4,5 @@ export const siteConfig = {
},
languages: ['en', 'es', 'de', 'fr', 'nl'],
repo: 'https://github.com/freesewing/freesewing',
site: 'lab',
}

View file

@ -0,0 +1,3 @@
import { examples } from 'site/prebuild/design-examples.mjs'
export { examples }

View file

@ -0,0 +1,3 @@
// __SDEFILE__ - This file is a dependency for the stand-alone environment
// SDE does not support this
export const examples = false

View file

@ -7,7 +7,7 @@ import {
cloudflareImageUrl,
} from 'shared/utils.mjs'
import { designs } from 'shared/config/designs.mjs'
import { examples } from 'site/prebuild/design-examples.mjs'
import { examples } from 'site/components/design-examples.mjs'
// Hooks
import { useTranslation } from 'next-i18next'
import { useDesign } from 'site/hooks/use-design.mjs'
@ -141,7 +141,7 @@ export const DesignInfo = ({ design, docs = false, workbench = false }) => {
format={(t) => t.split(':').pop().trim()}
/>
</AnchorLink>
<AnchorLink id="examples" txt={t('acount:examples')} />
{examples && <AnchorLink id="examples" txt={t('acount:examples')} />}
{['needs', 'fabric'].map((page) => (
<AnchorLink id={page} key={page}>
<DocsTitle
@ -172,6 +172,8 @@ export const DesignInfo = ({ design, docs = false, workbench = false }) => {
</>
)}
{docs ? docsContent : null}
{examples ? (
<>
<h2 id="examples">{t('account:examples')}</h2>
{examples[design] ? (
<div className="grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-3">
@ -180,7 +182,11 @@ export const DesignInfo = ({ design, docs = false, workbench = false }) => {
key={ex}
onClick={() =>
setModal(
<ModalWrapper flex="col" justify="top lg:justify-center" slideFrom="right">
<ModalWrapper
flex="col"
justify="top lg:justify-center"
slideFrom="right"
>
<img
className="w-full shadow rounded-lg"
src={cloudflareImageUrl({ id: `showcase-${ex}`, variant: 'public' })}
@ -210,6 +216,8 @@ export const DesignInfo = ({ design, docs = false, workbench = false }) => {
</p>
</Popout>
)}
</>
) : null}
{docs
? null
: ['needs', 'fabric'].map((page) => (

View file

@ -66,6 +66,8 @@ measurements.d: Test the effect of a measurement on the way this pattern looks
menu: Menu
name: Name
noDesignFound: We could not find this design. This shouldn't happen, so we'd really appreciate you reporting it.
noInlineDocs: Documention is not included in this build
noInlineDocsDesc: Please visit FreeSewing.org to access our documentation
notes: Notes
pages: pages
part: Pattern part

View file

@ -5,6 +5,7 @@ import { useTranslation } from 'next-i18next'
import { DesignInfo } from 'shared/components/designs/info.mjs'
import { Popout } from 'shared/components/popout/index.mjs'
import { PageLink } from 'shared/components/link.mjs'
import { siteConfig } from 'site/site.config.mjs'
export const ns = ['workbench', 'designs']
@ -12,6 +13,18 @@ export const DocsView = ({ design }) => {
// Hooks
const { t } = useTranslation(ns)
if (siteConfig.site !== 'FreeSewing.org')
return (
<div className="max-w-2xl m-auto">
<Popout note>
<h5>{t('workbench:noInlineDocs')}</h5>
<p>
<PageLink txt={t('workbench:noInlineDocsDesc')} href="https://freesewing.org/" />
</p>
</Popout>
</div>
)
return (
<div className="m-auto mt-8 max-w-7xl px-4 mb-8">
<Popout tip compact>