2023-03-26 06:50:59 +02:00
|
|
|
import { prebuildNavigation as pbn } from 'site/prebuild/navigation.mjs'
|
|
|
|
|
2023-03-26 07:38:15 +02:00
|
|
|
/*
|
2023-05-16 10:34:13 +02:00
|
|
|
* prebuildNavvigation[locale] holds the navigation structure based on MDX content.
|
2023-03-26 07:38:15 +02:00
|
|
|
* The entire website only has a few pages that are now MDX-based:
|
|
|
|
* - 404 => no navigation shown
|
|
|
|
* - home page => no navvigation shown
|
|
|
|
* - /contact => Added below
|
2023-03-26 08:32:44 +02:00
|
|
|
*
|
|
|
|
* Note: Set 'h' to truthy to not show a top-level entry as a section
|
2023-05-16 10:34:13 +02:00
|
|
|
* Note: Set 'c' to set the control level to hide things from users
|
2023-03-26 07:38:15 +02:00
|
|
|
*/
|
|
|
|
|
2023-05-19 16:40:15 +02:00
|
|
|
export const ns = ['account', 'sections', 'design', 'tags']
|
2023-05-16 10:34:13 +02:00
|
|
|
|
|
|
|
const sitePages = () => {
|
|
|
|
const pages = {
|
|
|
|
// Top-level pages that are the sections menu
|
2023-05-21 09:41:20 +02:00
|
|
|
api: {
|
|
|
|
t: 'API Documentation',
|
|
|
|
s: 'api',
|
2023-05-16 10:34:13 +02:00
|
|
|
o: 10,
|
|
|
|
},
|
2023-05-21 09:41:20 +02:00
|
|
|
design: {
|
|
|
|
t: 'Design Sewing Patterns',
|
|
|
|
s: 'design',
|
|
|
|
o: 10,
|
2023-05-16 10:34:13 +02:00
|
|
|
},
|
2023-05-21 09:41:20 +02:00
|
|
|
contribute: {
|
|
|
|
t: 'Contribute to FreeSewing',
|
|
|
|
s: 'contribute',
|
|
|
|
o: 20,
|
2023-05-16 10:34:13 +02:00
|
|
|
},
|
2023-05-21 09:41:20 +02:00
|
|
|
i18n: {
|
|
|
|
t: 'Help Translate FreeSewing',
|
|
|
|
s: 'i18n',
|
2023-05-16 10:34:13 +02:00
|
|
|
o: 40,
|
|
|
|
},
|
2023-05-21 09:41:20 +02:00
|
|
|
infra: {
|
2023-05-16 10:34:13 +02:00
|
|
|
t: 'FreeSewing Infrastructure',
|
2023-05-21 09:41:20 +02:00
|
|
|
s: 'infra',
|
2023-05-16 10:34:13 +02:00
|
|
|
o: 50,
|
|
|
|
},
|
|
|
|
about: {
|
|
|
|
t: 'About FreeSewing',
|
|
|
|
s: 'about',
|
2023-05-21 09:41:20 +02:00
|
|
|
o: 60,
|
|
|
|
},
|
|
|
|
support: {
|
|
|
|
t: 'Support FreeSewing',
|
|
|
|
s: 'support',
|
|
|
|
o: 70,
|
|
|
|
},
|
2023-05-22 19:53:24 +02:00
|
|
|
spacer1: {
|
|
|
|
t: 'spacer',
|
|
|
|
o: 100,
|
|
|
|
b: 1,
|
|
|
|
},
|
|
|
|
spacer2: {
|
|
|
|
t: 'spacer',
|
|
|
|
o: 2000,
|
|
|
|
b: 1,
|
|
|
|
},
|
|
|
|
search: {
|
|
|
|
t: 'Search',
|
|
|
|
s: 'search',
|
|
|
|
o: 270,
|
|
|
|
h: 1,
|
|
|
|
},
|
2023-05-21 09:41:20 +02:00
|
|
|
sitemap: {
|
|
|
|
t: 'Sitemap',
|
|
|
|
s: 'sitemap',
|
2023-05-22 19:53:24 +02:00
|
|
|
o: 270,
|
2023-05-21 09:41:20 +02:00
|
|
|
h: 1,
|
2023-05-16 10:34:13 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
return pages
|
|
|
|
}
|
|
|
|
|
2023-05-21 09:41:20 +02:00
|
|
|
export const useNavigation = (params = {}) => {
|
2023-06-10 14:08:07 +02:00
|
|
|
const { locale = 'en' } = params
|
2023-05-16 10:34:13 +02:00
|
|
|
const nav = { ...pbn[locale], ...sitePages() }
|
2023-05-23 11:08:47 +02:00
|
|
|
// Make top-level documentation entries appear in b-list
|
2023-05-16 10:34:13 +02:00
|
|
|
for (const page of ['tutorials', 'guides', 'howtos', 'reference', 'training']) {
|
2023-05-22 19:53:24 +02:00
|
|
|
nav[page].o = 1000
|
|
|
|
nav[page].b = 1
|
2023-05-16 10:34:13 +02:00
|
|
|
}
|
2023-05-23 11:08:47 +02:00
|
|
|
nav.contact.h = 1
|
2023-05-16 10:34:13 +02:00
|
|
|
|
2023-06-09 18:15:35 +02:00
|
|
|
return nav
|
2023-03-26 06:50:59 +02:00
|
|
|
}
|