1
0
Fork 0

fix(studio,eu): Remove submenus from account measurements sets and patterns. (#354)

Fixes #311 in both the repository studio and in the freesewing.eu site.

(Because I am not able to test the stand-alone studio, I'll submit a separate PR to add the fix there.)

Co-authored-by: Benjamin Fan <ben-git@swinglonga.com>
Reviewed-on: https://codeberg.org/freesewing/freesewing/pulls/354
Reviewed-by: Joost De Cock <joostdecock@noreply.codeberg.org>
Co-authored-by: Benjamin Fan <benjamesben@noreply.codeberg.org>
Co-committed-by: Benjamin Fan <benjamesben@noreply.codeberg.org>
This commit is contained in:
Benjamin Fan 2025-05-18 10:02:47 +00:00 committed by Joost De Cock
parent 64223a141a
commit 094863c993
2 changed files with 39 additions and 0 deletions

View file

@ -25,6 +25,22 @@ function customizeSidebar(items) {
}
}
// Filter out submenus in Your Measurements Sets and Your Patterns
for (const item in items) {
if (items[item].label === 'Account') {
for (const design in items[item].items) {
for (const subpage in items[item].items[design].items) {
if (
items[item].items[design].items[subpage].label === 'Your Measurements Sets' ||
items[item].items[design].items[subpage].label === 'Your Patterns'
) {
items[item].items[design].items[subpage].items = []
}
}
}
}
}
return items
}

View file

@ -2,6 +2,25 @@ import { themes as prismThemes } from 'prism-react-renderer'
import { docusaurusPlugins } from './plugins/index.mjs'
import smartypants from 'remark-smartypants'
function customizeSidebar(items) {
// Filter out submenus in Your Measurements Sets and Your Patterns
for (const item in items) {
if (items[item].label === 'Account') {
for (const design in items[item].items) {
for (const subpage in items[item].items[design].items) {
if (
items[item].items[design].items[subpage].label === 'Your Measurements Sets' ||
items[item].items[design].items[subpage].label === 'Your Patterns'
) {
items[item].items[design].items[subpage].items = []
}
}
}
}
}
return items
}
const config = {
title: 'FreeSewing Studio',
tagline: 'FreeSewing for Designers',
@ -25,6 +44,10 @@ const config = {
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.js',
async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
const sidebarItems = await defaultSidebarItemsGenerator(args)
return customizeSidebar(sidebarItems)
},
remarkPlugins: [[smartypants, { dashes: 'oldschool' }]],
},
theme: {