diff --git a/packages/freesewing.shared/components/workbench/index.js b/packages/freesewing.shared/components/workbench/index.js deleted file mode 100644 index 3b0045b162e..00000000000 --- a/packages/freesewing.shared/components/workbench/index.js +++ /dev/null @@ -1,192 +0,0 @@ -import Link from 'next/link' -import orderBy from 'lodash.orderby' -import ThemePicker from 'shared/components/theme-picker.js' -import RssIcon from 'shared/components/icons/rss.js' -import TutorialIcon from 'shared/components/icons/tutorial.js' -import GuideIcon from 'shared/components/icons/guide.js' -import HelpIcon from 'shared/components/icons/help.js' -import DocsIcon from 'shared/components/icons/docs.js' - -// Don't show children for blog and showcase posts -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 -const force = [ -

, -

-] - -// List of icons matched to top-level slug -const icons = { - blog: , - tutorials: , - guides: , - howtos: , - reference: -} - -/* helper method to order nav entries */ -const order = obj => orderBy(obj, ['__order', '__title'], ['asc', 'asc']) - -// Component for the collapse toggle -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 -const linkClasses = `text-lg lg:text-xl - py-1 hover:cursor-pointer - text-base-content sm:text-neutral-content - hover:text-secondary - sm:hover:text-secondary-focus -` - -// 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 }) => ( -

-) - -// Component that renders a toplevel of navigation -const TopLevel = ({ icon, title, nav, current, slug, hasChildren=false, active }) => ( -
- - {icon} - - - {title} - - - {hasChildren && } - - {hasChildren && } -
-) - -const Navigation = ({ app, active }) => { - if (!app.navigation) return null - const output = [] - for (const page of order(app.navigation)) output.push(°} - title={page.__title} - slug={page.__slug} - hasChildren={keepClosed.indexOf(page.__slug) === -1} - nav={app.navigation} - current={order(app.navigation[page.__slug])} - active={active} - />) - - return
{output}
-} - -const PrimaryMenu = ({ app, active }) => ( - -) - -export default PrimaryMenu diff --git a/packages/freesewing.shared/components/workbench/measurements.js b/packages/freesewing.shared/components/workbench/measurements/index.js similarity index 97% rename from packages/freesewing.shared/components/workbench/measurements.js rename to packages/freesewing.shared/components/workbench/measurements/index.js index bd21f9e9b9c..2ef2bec50fa 100644 --- a/packages/freesewing.shared/components/workbench/measurements.js +++ b/packages/freesewing.shared/components/workbench/measurements/index.js @@ -1,7 +1,7 @@ import React from 'react' -import MeasurementInput from './input-measurement.js' +import MeasurementInput from './input.js' import { withBreasts, withoutBreasts } from 'pkgs/models/src/index.js' -import nonHuman from './non-human-measurements.js' +import nonHuman from './non-human.js' import WithBreastsIcon from 'shared/components/icons/with-breasts.js' import WithoutBreastsIcon from 'shared/components/icons/without-breasts.js' diff --git a/packages/freesewing.shared/components/workbench/input-measurement.js b/packages/freesewing.shared/components/workbench/measurements/input.js similarity index 100% rename from packages/freesewing.shared/components/workbench/input-measurement.js rename to packages/freesewing.shared/components/workbench/measurements/input.js diff --git a/packages/freesewing.shared/components/workbench/non-human-measurements.js b/packages/freesewing.shared/components/workbench/measurements/non-human.js similarity index 100% rename from packages/freesewing.shared/components/workbench/non-human-measurements.js rename to packages/freesewing.shared/components/workbench/measurements/non-human.js diff --git a/packages/freesewing.shared/components/wrappers/workbench.js b/packages/freesewing.shared/components/wrappers/workbench.js index 998330dc059..7ca841e658e 100644 --- a/packages/freesewing.shared/components/wrappers/workbench.js +++ b/packages/freesewing.shared/components/wrappers/workbench.js @@ -2,7 +2,8 @@ import { useState, useEffect } from 'react' import useLocalStorage from 'shared/hooks/useLocalStorage.js' import Layout from 'shared/components/layouts/default' import Menu from 'shared/components/workbench/menu.js' -import Measurements, { Input } from 'shared/components/workbench/measurements.js' +import Measurements, { Input } from 'shared/components/workbench/measurements/index.js' +import LabDraft from 'shared/components/workbench/draft/index.js' import set from 'lodash.set' // Generates a default pattern gist to start from @@ -78,6 +79,14 @@ const WorkbenchWrapper = ({ app, pattern }) => { updateGist={updateGist} /> )} + {mode === 'draft' && ( + + )}
{JSON.stringify(mode, null, 2)}
{JSON.stringify(gist, null, 2)}