diff --git a/packages/freesewing.lab/components/pattern-picker.js b/packages/freesewing.lab/components/pattern-picker.js
index f253efa8a29..05e2d4a3c16 100644
--- a/packages/freesewing.lab/components/pattern-picker.js
+++ b/packages/freesewing.lab/components/pattern-picker.js
@@ -20,7 +20,7 @@ const PatternPicker = ({ app }) => {
{t('designs')}
- {Object.keys(app.patterns).map(section => (
+ {Object.keys(app.navigation).map(section => (
- {
`}>
{t(app.navigation[section].__title)}
- {app.patterns[section].map(pattern => (
+ {Object.keys(app.navigation[section]).filter((p)=>!p.startsWith('__')).map(pattern => {
+ return (
-
-
+
- ))}
+ )})}
))}
diff --git a/packages/freesewing.lab/hooks/useApp.js b/packages/freesewing.lab/hooks/useApp.js
index 515aae61ccf..0f8459a40e6 100644
--- a/packages/freesewing.lab/hooks/useApp.js
+++ b/packages/freesewing.lab/hooks/useApp.js
@@ -6,6 +6,7 @@ import patterns from 'shared/config/designs.json'
// Locale and translation
import { useTranslation } from 'next-i18next'
import { capitalize } from 'shared/utils'
+import { formatVersionUri } from '../components/version-picker.js'
import useVersion from 'site/hooks/useVersion.js'
// Initial navigation
@@ -42,7 +43,7 @@ const initialNavigation = (t, version) => {
__title: capitalize(design),
__order: design,
__linktitle: capitalize(design),
- __slug: `v/${version}/${design}`
+ __slug: formatVersionUri(version,design)
}
}
}
diff --git a/packages/freesewing.lab/page-templates/pattern-list.js b/packages/freesewing.lab/page-templates/pattern-list.js
index f2f606e9871..f24a92b6db5 100644
--- a/packages/freesewing.lab/page-templates/pattern-list.js
+++ b/packages/freesewing.lab/page-templates/pattern-list.js
@@ -20,17 +20,17 @@ const links = (section, list, version) => list.map(design => (
))
-const icons = {
+export const default_icons = {
accessories: (className='') => ,
blocks: (className='') => ,
garments: (className='') => ,
utilities: (className='') => ,
}
-const Section = ({ section, version, patterns }) => {
+const Section = ({ section, version, patterns, icons }) => {
const { t } = useTranslation(['patterns'])
return patterns.map(design => (
-
+
{
`}>
- {t(`patterns:${design}.t`)}
+ {design.__title}
- {icons[section]("w-12 h-12 md:h-20 md:w-20 xl:w-32 xl:h-32 shrink-0")}
+ {icons[section] && icons[section]("w-12 h-12 md:h-20 md:w-20 xl:w-32 xl:h-32 shrink-0")}
- {t(`patterns:${design}.d`)}
+ {t(`patterns:${design.__order}.d`)}
))
}
-const PatternListPageTemplate = ({ section=false, version=false }) => {
+const PatternListPageTemplate = ({ section=false, version=false, icons=default_icons }) => {
const app = useApp()
const { t } = useTranslation(['app'])
@@ -61,6 +61,8 @@ const PatternListPageTemplate = ({ section=false, version=false }) => {
? app.navigation[section].__title
: t('designs')
+ const sectionPatterns = section ? Object.values(app.navigation[section]).filter((o)=> typeof o == 'object') : [];
+
return (
@@ -78,18 +80,18 @@ const PatternListPageTemplate = ({ section=false, version=false }) => {
-
- {section
+
+ { section
? (
-
+
)
: Object.keys(app.patterns).map(section => (
{app.navigation[section].__title}
-
+
))
diff --git a/packages/freesewing.shared/components/navigation/primary.js b/packages/freesewing.shared/components/navigation/primary.js
index 8babc926ce5..7a5beffca1c 100644
--- a/packages/freesewing.shared/components/navigation/primary.js
+++ b/packages/freesewing.shared/components/navigation/primary.js
@@ -8,12 +8,9 @@ import DocsIcon from 'shared/components/icons/docs.js'
import DesignIcon from 'shared/components/icons/design.js'
import BoxIcon from 'shared/components/icons/box.js'
import CogIcon from 'shared/components/icons/cog.js'
-import UserIcon from 'shared/components/icons/user.js'
-import CommunityIcon from 'shared/components/icons/community.js'
-import ShowcaseIcon from 'shared/components/icons/camera.js'
// Don't show children for blog and showcase posts
-const keepClosed = ['blog', 'showcase' ]
+const keepClosed = ['blog', 'showcase', ]
// TODO: For now we force tailwind to pickup these styles
// At some point this should 'just work' though, but let's not worry about it now
@@ -24,19 +21,14 @@ const force = [
// List of icons matched to top-level slug
const icons = {
- accessories: (className='') => ,
- account: (className='') => ,
- blocks: (className='') => ,
blog: (className='') => ,
- community: (className='') => ,
- designs: (className='') => ,
- docs: (className='') => ,
- garments: (className='') => ,
+ tutorials: (className='') => ,
guides: (className='') => ,
howtos: (className='') => ,
reference: (className='') => ,
- showcase: (className='') => ,
- tutorials: (className='') => ,
+ accessories: (className='') => ,
+ blocks: (className='') => ,
+ garments: (className='') => ,
utilities: (className='') => ,
}
@@ -94,7 +86,7 @@ const SubLevel = ({ nodes={}, active }) => (
hover:cursor-row-resize
items-center
`}>
-
+
(
) : (
-
+
{icon}
-
+
{
if (!app.navigation) return null
const output = []
for (const page of order(app.navigation)) {
output.push(
-
-
+
+
{icons[page.__slug]
? icons[page.__slug]('w-14 h-14')
: