From 7c796a689efc33a8036e14bd75afb374b24a9202 Mon Sep 17 00:00:00 2001 From: Benjamin Fan Date: Sun, 18 May 2025 10:04:20 +0000 Subject: [PATCH] fix(studio): Remove submenus from account measurements sets and patterns. (#355) Reviewed-on: https://codeberg.org/freesewing/freesewing/pulls/355 Reviewed-by: Joost De Cock Co-authored-by: Benjamin Fan Co-committed-by: Benjamin Fan --- .../studio/template/docusaurus.config.mjs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/studio/template/docusaurus.config.mjs b/packages/studio/template/docusaurus.config.mjs index da43c448fba..dbc5eeeb1be 100644 --- a/packages/studio/template/docusaurus.config.mjs +++ b/packages/studio/template/docusaurus.config.mjs @@ -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', @@ -28,6 +47,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: {