diff --git a/sites/org/components/layouts/docs.mjs b/sites/org/components/layouts/docs.mjs index 69f0ce18855..7a62a8a3fa4 100644 --- a/sites/org/components/layouts/docs.mjs +++ b/sites/org/components/layouts/docs.mjs @@ -2,13 +2,13 @@ import { useRouter } from 'next/router' // Components import Link from 'next/link' -import { AsideNavigation } from 'shared/components/navigation/aside.mjs' +import { AsideNavigation, ns as navNs } from 'shared/components/navigation/aside.mjs' import { ThemePicker } from 'shared/components/theme-picker/index.mjs' import { Breadcrumbs } from 'shared/components/breadcrumbs.mjs' import { HomeIcon } from 'shared/components/icons.mjs' import { useState, useEffect } from 'react' -export const ns = [] +export const ns = navNs export const DocsLayout = ({ app, children = [], title }) => (
diff --git a/sites/org/components/navigation/aside.mjs b/sites/org/components/navigation/aside.mjs deleted file mode 100644 index 172f57d2a6a..00000000000 --- a/sites/org/components/navigation/aside.mjs +++ /dev/null @@ -1,25 +0,0 @@ -import { PrimaryNavigation } from './primary.mjs' - -export const AsideNavigation = ({ app, slug, mobileOnly = false, before = [], after = [] }) => ( - -) diff --git a/sites/org/components/navigation/primary.mjs b/sites/org/components/navigation/primary.mjs deleted file mode 100644 index 2054cff1f8f..00000000000 --- a/sites/org/components/navigation/primary.mjs +++ /dev/null @@ -1,280 +0,0 @@ -import { useState, useEffect } from 'react' -import Link from 'next/link' -import orderBy from 'lodash.orderby' -import { FreeSewingIcon } from 'shared/components/icons.mjs' -import { TopLevelNavigation as TopLevel } from './top-level.mjs' - -/* helper method to order nav entries */ -const order = (obj) => orderBy(obj, ['__order', '__title'], ['asc', 'asc']) - -// Component for the collapse toggle -// Exported for re-use -export const Chevron = ({ w = 8, m = 2 }) => ( - - - -) - -// Helper method to filter out the real children -const currentChildren = (current) => - Object.values(order(current)).filter((entry) => typeof entry === 'object') - -// Shared classes for links -// Exported for re-use -export const linkClasses = ` - py-1 - text-base-content sm:text-base-content - hover:text-secondary - sm:hover:text-secondary -` - -// Figure out whether a page is on the path to the active page -const isActive = (slug, active) => { - if (slug === active) return true - let result = true - const slugParts = slug.split('/') - const activeParts = active.split('/') - for (const i in slugParts) { - if (slugParts[i] !== activeParts[i]) result = false - } - - return result -} - -// Component that renders a sublevel of navigation -const SubLevel = ({ nodes = {}, active }) => ( - -) - -const LevelHomeButton = ({ setShowLevel, level }) => ( - <> - - -) - -const colors = ['primary', 'secondary', 'accent'] - -const LevelButton = ({ title, level, showLevel, setShowLevel, href = false }) => { - const props = { - className: `h-8 mb-1 flex flex-row p-0 items-center -ml-7 max-w-1/3 ${ - showLevel < level ? 'opacity-50' : '' - }`, - } - const content = ( - <> -
-
- {title} -
-
- - ) - - return href ? ( - - {content} - - ) : ( - - ) -} - -const Navigation = ({ app, active, className = '' }) => { - // Levels - const levels = active.split('/') - - useEffect(() => { - setShowLevel(Math.max(levels.length, 2)) - }, [active]) - const [showLevel, setShowLevel] = useState(Math.max(levels.length, 2)) - if (!app.navigation) return null - if (levels.length < 1) return null - - let navigation = app.navigation - - const shared = { showLevel, setShowLevel } - const levelButtons = [] - if (levels[0]) { - const title = app.navigation[levels[0].__title] || levels[0] - navigation = app.navigation[levels[0]] - levelButtons.push() - levelButtons.push() - } - if (levels[1]) { - const title = app.navigation[levels[0]][levels[1]]?.__title || levels[1] - if (showLevel > 0) navigation = navigation[levels[1]] - levelButtons.push() - } - if (levels[2] && levels.length > 3) { - if (showLevel > 1) navigation = navigation[levels[2]] - levelButtons.push( - - ) - } - - const output = [ -
- {levelButtons} -
, - ] - if (showLevel < 0) output.push() - else output.push() - - return
{output}
-} - -export const PrimaryNavigation = ({ app, active, before = [], after = [] }) => ( - -) diff --git a/sites/org/components/navigation/top-level.mjs b/sites/org/components/navigation/top-level.mjs deleted file mode 100644 index af078490c94..00000000000 --- a/sites/org/components/navigation/top-level.mjs +++ /dev/null @@ -1,3 +0,0 @@ -export const TopLevelNavigation = () => { - return

Top-level menu here

-} diff --git a/sites/org/hooks/use-navigation.mjs b/sites/org/hooks/use-navigation.mjs index 68721633cb7..a27da00ba5b 100644 --- a/sites/org/hooks/use-navigation.mjs +++ b/sites/org/hooks/use-navigation.mjs @@ -15,12 +15,16 @@ import { freeSewingConfig as conf } from 'site/freesewing.config.mjs' * Note: Set 'c' to set the control level to hide things from users */ -const ns = ['account'] +const ns = ['account', 'sections'] const sitePages = (locale, t = false) => { // Handle t not being present if (!t) t = (string) => string const pages = { + account: { + t: t('sections:account'), + s: 'account', + }, profile: { t: t('yourProfile'), s: 'profile', @@ -31,10 +35,6 @@ const sitePages = (locale, t = false) => { s: 'typography', h: 1, }, - account: { - t: t('account'), - s: 'account', - }, } for (const section in conf.account.fields) { for (const field in conf.account.fields[section]) { diff --git a/sites/org/pages/docs/docs.en.yaml b/sites/org/pages/docs/docs.en.yaml new file mode 100644 index 00000000000..e6601d7e4ca --- /dev/null +++ b/sites/org/pages/docs/docs.en.yaml @@ -0,0 +1 @@ +docs: Documentation diff --git a/sites/org/pages/docs/index.mjs b/sites/org/pages/docs/index.mjs index c50daf2b5fa..478de5660f2 100644 --- a/sites/org/pages/docs/index.mjs +++ b/sites/org/pages/docs/index.mjs @@ -1,17 +1,19 @@ // Hooks import { useApp } from 'shared/hooks/use-app.mjs' // Dependencies -import Head from 'next/head' import { mdxLoader } from 'shared/mdx/loader.mjs' +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' // Components -import { PageWrapper } from 'shared/components/wrappers/page.mjs' +import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs' import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs' import { ReadMore } from 'shared/components/mdx/read-more.mjs' import { jargon } from 'site/jargon.mjs' -const DocsPage = ({ title, mdx, bugsnag }) => { - const app = useApp({ bugsnag }) - const fullTitle = title + ' - FreeSewing.org' +// Translation namespaces used on this page +const namespaces = [...new Set(['docs', ...pageNs])] + +const DocsPage = (props) => { + const app = useApp(props) // We don't need all MDX components here, just ReadMore const components = { @@ -19,15 +21,11 @@ const DocsPage = ({ title, mdx, bugsnag }) => { } return ( - - - {fullTitle} - +
) } -// export default DocsPage @@ -43,13 +41,15 @@ export default DocsPage * To learn more, see: https://nextjs.org/docs/basic-features/data-fetching */ export async function getStaticProps({ locale }) { - const { mdx, frontmatter } = await mdxLoader(locale, 'org', ['docs'], jargon[locale]) - const { title = 'FIXME: Please give this page a title' } = frontmatter + const { mdx } = await mdxLoader(locale, 'org', ['docs'], jargon[locale]) return { props: { + ...(await serverSideTranslations(locale, namespaces)), mdx, - title, + page: { + path: ['docs'], + }, }, } } diff --git a/sites/org/pages/index.mjs b/sites/org/pages/index.mjs index 959b3e168c1..f1824928e45 100644 --- a/sites/org/pages/index.mjs +++ b/sites/org/pages/index.mjs @@ -26,6 +26,31 @@ const HomePage = (props) => { Create homepage. Meanwhile check +

What is FreeSewing?

+ (by ChatGPT) +

+ Freesewing is an open-source pattern making software that allows users to generate + custom sewing patterns based on their own measurements. It is designed to be flexible + and customizable, and can be used to create a wide range of garments, from simple + t-shirts and skirts to more complex dresses and jackets. +

+

+ Freesewing is available for free, and users can access a wide range of pre-made patterns + or create their own from scratch. The software is designed to be easy to use, with an + intuitive interface that guides users through the process of creating a pattern + step-by-step. +

+

+ In addition to the pattern making software, freesewing also has an active online + community of sewists and pattern makers who share tips, techniques, and advice on all + aspects of sewing. The community also collaborates on creating new patterns and + improving existing ones, and users can contribute their own patterns to the project as + well. +

+

+ Overall, freesewing is a powerful tool for anyone interested in sewing and pattern + making, whether they are seasoned professionals or beginners just starting out. +

diff --git a/sites/org/pages/typography.mjs b/sites/org/pages/typography.mjs index 404751a58e1..478b1cd5b07 100644 --- a/sites/org/pages/typography.mjs +++ b/sites/org/pages/typography.mjs @@ -25,15 +25,15 @@ const TypographyPage = (props) => {

This typography page shows an overview of different elements and how they are styled.

It's a good starting point for theme development.

Headings (this is h2)

- {p} + {p} {p}

This is h3

- {p} + {p} {p}

This is h4

- {p} + {p} {p}
This is h5
- {p} + {p} {p}
This is h6
- {p} + {p} {p}

Links and buttons

A regular link looks like this, whereas buttons look like this: diff --git a/sites/shared/components/navigation/aside.mjs b/sites/shared/components/navigation/aside.mjs index 47b7923556e..a1b36929764 100644 --- a/sites/shared/components/navigation/aside.mjs +++ b/sites/shared/components/navigation/aside.mjs @@ -1,6 +1,8 @@ -import { MainSections, ActiveSection } from './primary.mjs' +import { MainSections, ActiveSection, ns as navNs } from './primary.mjs' import Link from 'next/link' +export const ns = navNs + export const AsideNavigation = ({ app, mobileOnly = false, before = [], after = [] }) => (