diff --git a/sites/backend/src/models/apikey.mjs b/sites/backend/src/models/apikey.mjs index 1983c57afe8..c81199e0c63 100644 --- a/sites/backend/src/models/apikey.mjs +++ b/sites/backend/src/models/apikey.mjs @@ -42,7 +42,8 @@ ApikeyModel.prototype.sendResponse = async function (res) { ApikeyModel.prototype.verify = async function (key, secret) { await this.unguardedRead({ id: key }) - const [valid] = await verifyPassword(secret, this.record.secret) + const verify = await verifyPassword(secret, this.record.secret) + const [valid] = verify this.verified = valid return this diff --git a/sites/backend/src/models/set.mjs b/sites/backend/src/models/set.mjs index 211e8bf0256..e79813f871d 100644 --- a/sites/backend/src/models/set.mjs +++ b/sites/backend/src/models/set.mjs @@ -313,7 +313,7 @@ SetModel.prototype.userSets = async function (uid) { log.warn(`Failed to search sets for user ${uid}: ${err}`) } const list = [] - for (const set of sets) list.push(await this.revealSet(set)) + for (const set of sets) list.push(this.revealSet(set)) return list } diff --git a/sites/backend/src/utils/crypto.mjs b/sites/backend/src/utils/crypto.mjs index 21486765bd0..55cadd19109 100644 --- a/sites/backend/src/utils/crypto.mjs +++ b/sites/backend/src/utils/crypto.mjs @@ -53,7 +53,8 @@ export function encryption(stringKey, salt = 'FreeSewing') { try { data = asJson(data) } catch (err) { - throw ('Could not parse input to encrypt() call', err) + console.log(err) + throw 'Could not parse input to encrypt() call' } /* @@ -84,7 +85,8 @@ export function encryption(stringKey, salt = 'FreeSewing') { try { data = JSON.parse(data) } catch (err) { - throw ('Could not parse encrypted data in decrypt() call', err) + console.log(err) + throw 'Could not parse encrypted data in decrypt() call' } if (!data.iv || typeof data.ct === 'undefined') { throw 'Encrypted data passed to decrypt() was malformed' diff --git a/sites/backend/src/utils/sanity.mjs b/sites/backend/src/utils/sanity.mjs index bc531373750..104c42fff75 100644 --- a/sites/backend/src/utils/sanity.mjs +++ b/sites/backend/src/utils/sanity.mjs @@ -37,7 +37,7 @@ export const setPatternAvatar = async (id, data) => setAvatar('pattern', id, dat export async function setAvatar(type, id, data) { // Step 1: Upload the image as asset const [contentType, binary] = b64ToBinaryWithType(data) - if (contentType && binary) { + if (contentType) { const img = await axios.post(`${config.api}/assets/images/${config.dataset}`, binary, { headers: { ...headers, diff --git a/sites/backend/tests/index.mjs b/sites/backend/tests/index.mjs index a85cca5f368..a2e3f1bff98 100644 --- a/sites/backend/tests/index.mjs +++ b/sites/backend/tests/index.mjs @@ -8,13 +8,13 @@ import { patternTests } from './pattern.mjs' import { setup } from './shared.mjs' const runTests = async (...params) => { - //await userTests(...params) - //await mfaTests(...params) - //await apikeyTests(...params) - //await accountTests(...params) - //await setTests(...params) + await userTests(...params) + await mfaTests(...params) + await apikeyTests(...params) + await accountTests(...params) + await setTests(...params) await curatedSetTests(...params) - //await patternTests(...params) + await patternTests(...params) } // Load initial data required for tests diff --git a/sites/shared/components/account/control.mjs b/sites/shared/components/account/control.mjs index 2f9ff4b3711..13bcdbda03f 100644 --- a/sites/shared/components/account/control.mjs +++ b/sites/shared/components/account/control.mjs @@ -15,7 +15,7 @@ export const ns = ['account', 'toast'] export const ControlSettings = ({ title = false, welcome = false }) => { // Context - const { loading, startLoading, stopLoading } = useContext(LoadingContext) + const { startLoading, stopLoading } = useContext(LoadingContext) // Hooks const { account, setAccount, token } = useAccount() diff --git a/sites/shared/components/account/sets.mjs b/sites/shared/components/account/sets.mjs index 084801c5b74..babe65ef29c 100644 --- a/sites/shared/components/account/sets.mjs +++ b/sites/shared/components/account/sets.mjs @@ -1,8 +1,6 @@ // Dependencies import { useState, useEffect, useContext, useCallback } from 'react' import { useTranslation } from 'next-i18next' -import { DateTime } from 'luxon' -import { CopyToClipboard } from 'react-copy-to-clipboard' import orderBy from 'lodash.orderby' import { measurements, isDegreeMeasurement } from 'config/measurements.mjs' import { measurementAsMm, formatMm } from 'shared/utils.mjs' @@ -30,10 +28,7 @@ import { PlusIcon, OkIcon, NoIcon, - DownIcon, - CopyIcon, TrashIcon, - LeftIcon, EditIcon, } from 'shared/components/icons.mjs' import { ModalWrapper } from 'shared/components/wrappers/modal.mjs' @@ -41,8 +36,6 @@ import Markdown from 'react-markdown' import { Tab } from './bio.mjs' import Timeago from 'react-timeago' import { Spinner } from 'shared/components/spinner.mjs' -import Link from 'next/link' -import { SaveSettingsButton } from 'shared/components/buttons/save-settings-button.mjs' export const ns = ['account', 'patterns', 'toast'] @@ -70,7 +63,7 @@ export const NewSet = ({ standalone = false, }) => { // Context - const { loading, startLoading, stopLoading } = useContext(LoadingContext) + const { startLoading, stopLoading } = useContext(LoadingContext) // Hooks const router = useRouter() @@ -97,11 +90,6 @@ export const NewSet = ({ stopLoading() } - // Helper method to clear inputs - const clear = () => { - setMset(false) - } - return (
{title ?

{t('newSet')}

: null} @@ -145,8 +133,6 @@ const EditField = (props) => { return

FIXME: No edit component for this field

} -const noop = () => null - export const EditRow = (props) => ( { const MeasieInput = ({ m, mset, backend, toast, refresh }) => { const { t } = useTranslation(['measurements']) - const title = t(`measurements:${m}`) - const { loading, startLoading, stopLoading } = useContext(LoadingContext) + //const title = t(`measurements:${m}`) + const { startLoading, stopLoading } = useContext(LoadingContext) const isDegree = isDegreeMeasurement(m) const factor = isDegree ? 1 : mset.imperial ? 25.4 : 10 @@ -230,6 +216,7 @@ const MeasieInput = ({ m, mset, backend, toast, refresh }) => { setValid(isValid(useVal)) } + /* const save = async () => { startLoading() const measies = {} @@ -241,6 +228,7 @@ const MeasieInput = ({ m, mset, backend, toast, refresh }) => { } else toast.for.backendError() stopLoading() } + */ const fraction = (i, base) => update({ target: { value: Math.floor(val) + i / base } }) @@ -554,7 +542,7 @@ const EditNotes = ({ t, mset, account, backend, toast, refresh }) => { const EditUnits = ({ t, mset, account, backend, toast, refresh }) => { const [selection, setSelection] = useState(mset?.imperial === true ? 'imperial' : 'metric') - const { loading, startLoading, stopLoading } = useContext(LoadingContext) + const { startLoading, stopLoading } = useContext(LoadingContext) const update = async (val) => { setSelection(val) @@ -776,7 +764,7 @@ const EditMeasurementsSet = (props) => { const MeasurementsSet = ({ mset, t, account, backend, refresh }) => { // Context - const { loading, startLoading, stopLoading } = useContext(LoadingContext) + const { startLoading, stopLoading } = useContext(LoadingContext) const { setModal } = useContext(ModalContext) // Hooks @@ -864,9 +852,6 @@ const MeasurementsSet = ({ mset, t, account, backend, refresh }) => { // Component for the account/sets page export const Sets = ({ title = true }) => { - // Context - const { loading, startLoading, stopLoading } = useContext(LoadingContext) - // Hooks const { account, token } = useAccount() const backend = useBackend(token) diff --git a/sites/shared/components/collapse.mjs b/sites/shared/components/collapse.mjs index b0a88818d7e..23de721edfb 100644 --- a/sites/shared/components/collapse.mjs +++ b/sites/shared/components/collapse.mjs @@ -1,8 +1,9 @@ import { useState } from 'react' -import { CloseIcon, DownIcon } from 'shared/components/icons.mjs' +import { CloseIcon } from 'shared/components/icons.mjs' const OpenTitleButton = ({ title, toggle, color = 'primary', openButtons = [] }) => ( -
- + ) export const Collapse = ({ diff --git a/sites/shared/components/designs/design-list.mjs b/sites/shared/components/designs/design-list.mjs index d36b936c865..99a202efc5d 100644 --- a/sites/shared/components/designs/design-list.mjs +++ b/sites/shared/components/designs/design-list.mjs @@ -1,4 +1,3 @@ -import { useState } from 'react' import { designList, designs } from 'shared/config/designs.mjs' import { Design, ns as designNs } from 'shared/components/designs/design.mjs' @@ -11,7 +10,7 @@ export const DesignList = ({ tag = false }) => { return (
{list.map((name) => ( - + ))}
) diff --git a/sites/shared/components/designs/design-picker.mjs b/sites/shared/components/designs/design-picker.mjs index 4b39530258e..1e3b505578d 100644 --- a/sites/shared/components/designs/design-picker.mjs +++ b/sites/shared/components/designs/design-picker.mjs @@ -18,7 +18,7 @@ export const DesignPicker = () => { {Object.keys(translated) .sort() .map((d) => ( - + ))} ) diff --git a/sites/shared/components/dynamic-docs/core-settings.mjs b/sites/shared/components/dynamic-docs/core-settings.mjs deleted file mode 100644 index d5b4e7eecae..00000000000 --- a/sites/shared/components/dynamic-docs/core-settings.mjs +++ /dev/null @@ -1,60 +0,0 @@ -import dynamic from 'next/dynamic' -import { MDXProvider } from '@mdx-js/react' -import { useState } from 'react' -import { Spinner } from 'shared/components/spinner.mjs' -import { PageLink } from 'shared/components/page-link.mjs' -import { useTranslation } from 'next-i18next' -import { components } from 'shared/components/mdx/index.mjs' -import { MdxWrapper, ns as wrapperNs } from './wrapper.mjs' - -export const ns = wrapperNs - -/* - * Webpack will check on disk for all possible files matching this - * dynamic import. So unless we divide it up a bit your computer - * will melt when running this in development mode - * - * This will return a language-specific component - */ -const dynamicDocsFactory = (lang) => { - return function ({ setting = false }) { - const [frontmatter, setFrontmatter] = useState({}) - const mdx = dynamic( - () => - import( - `orgmarkdown/docs/site/draft/core-settings/${setting ? setting + '/' : ''}${lang}.md` - ).then((mod) => { - setFrontmatter(mod.frontmatter) - return mod - }), - { ssr: false } - ) - const MDX = mdx ? mdx : - - return ( - - - - ) - } -} - -/* - * Instantiate language-specific components - */ -const CoreSettingsDocsEn = dynamicDocsFactory('en') -const CoreSettingsDocsDe = dynamicDocsFactory('de') -const CoreSettingsDocsFr = dynamicDocsFactory('fr') -const CoreSettingsDocsEs = dynamicDocsFactory('es') -const CoreSettingsDocsNl = dynamicDocsFactory('nl') - -/* - * Return language-specific component - */ -export const DynamicCoreSettingsDocs = ({ setting = false, language = 'en' }) => { - if (language === 'en') return - if (language === 'de') return - if (language === 'es') return - if (language === 'fr') return - if (language === 'nl') return -} diff --git a/sites/shared/components/mdx/index.mjs b/sites/shared/components/mdx/index.mjs index e49a7673974..5cb3ed480ca 100644 --- a/sites/shared/components/mdx/index.mjs +++ b/sites/shared/components/mdx/index.mjs @@ -1,7 +1,7 @@ import { Popout } from 'shared/components/popout.mjs' import { Highlight } from './highlight.mjs' import { YouTube } from './youtube.mjs' -import { Figure } from './figure.mjs' +//import { Figure } from './figure.mjs' import { ReadMore } from './read-more.mjs' import { Tab, Tabs } from './tabs.mjs' import { TabbedExample as Example } from './tabbed-example.mjs' diff --git a/sites/shared/components/mdx/prev-next.mjs b/sites/shared/components/mdx/prev-next.mjs index cdb5461c3c8..029cd6767ba 100644 --- a/sites/shared/components/mdx/prev-next.mjs +++ b/sites/shared/components/mdx/prev-next.mjs @@ -2,7 +2,6 @@ import get from 'lodash.get' import orderBy from 'lodash.orderby' import Link from 'next/link' import { LeftIcon, RightIcon } from 'shared/components/icons.mjs' -import { Popout } from 'shared/components/popout.mjs' // helper method to order nav entries const order = (obj) => orderBy(obj, ['o', 't'], ['asc', 'asc']) diff --git a/sites/shared/components/modal/design-picker.mjs b/sites/shared/components/modal/design-picker.mjs index 3379ae66475..8e682e6562e 100644 --- a/sites/shared/components/modal/design-picker.mjs +++ b/sites/shared/components/modal/design-picker.mjs @@ -1,26 +1,10 @@ // Dependencies -import { useRouter } from 'next/router' import { useTranslation } from 'next-i18next' -import Link from 'next/link' // Components import { ModalWrapper } from 'shared/components/wrappers/modal.mjs' export const ns = ['designs'] -const btnClasses = { - dflt: - 'btn w-full mt-2 btn-secondary ' + - 'flex flex-row flex-nowrap items-center gap-4 py-4 h-auto ' + - 'border border-secondary justify-start text-left bg-opacity-30', - active: - 'btn-ghost bg-secondary hover:bg-secondary ' + 'hover:bg-opacity-30 hover:border-secondary', - inactive: - 'hover:bg-opacity-20 hover:bg-secondary btn-ghost ' + - 'border border-secondary hover:border hover:border-secondary', -} -const spanClasses = - 'p-2 w-8 h-8 shrink-0 rounded-full text-center p-0 py-2 bg-secondary text-secondary-content' - export const ModalDesignPicker = ({ modalWrapperProps = {}, designs = [], @@ -41,6 +25,7 @@ export const ModalDesignPicker = ({
{designs.map((d) => (
{filter.map((tag) => ( - removeFilter(tag)} color="success" hoverColor="error"> + removeFilter(tag)} color="success" hoverColor="error" key={tag}> {tag} ))}
{orderBy(list, ['name'], ['asc']).map((set) => ( -
+
{ export const UserSetPicker = ({ design, t, language }) => { // Hooks - const { account, token } = useAccount() + const { token } = useAccount() const backend = useBackend(token) // State @@ -160,7 +157,7 @@ export const UserSetPicker = ({ design, t, language }) => { <>
{orderBy(sets, ['name'], ['asc']).map((set) => ( -
+
))} diff --git a/sites/shared/components/sets/set.mjs b/sites/shared/components/sets/set.mjs index c5428c60e93..12a7ec7872f 100644 --- a/sites/shared/components/sets/set.mjs +++ b/sites/shared/components/sets/set.mjs @@ -10,6 +10,7 @@ export const Set = ({ name }) => { const { t } = useTranslation(ns) return

fixme

+ /* return ( {
) + */ } diff --git a/sites/shared/components/social/icons.mjs b/sites/shared/components/social/icons.mjs index 9f8c0fcfc0b..f21c13755b5 100644 --- a/sites/shared/components/social/icons.mjs +++ b/sites/shared/components/social/icons.mjs @@ -9,7 +9,6 @@ import { RedditIcon, TwitterIcon, OpenSourceIcon, - CcByIcon, YouTubeIcon, } from 'shared/components/icons.mjs' import { colors } from 'shared/components/wordmark.mjs' diff --git a/sites/shared/components/workbench/header.mjs b/sites/shared/components/workbench/header.mjs index fc019af9c5a..d5370844461 100644 --- a/sites/shared/components/workbench/header.mjs +++ b/sites/shared/components/workbench/header.mjs @@ -1,5 +1,5 @@ // Hooks -import { useState, useEffect, useContext } from 'react' +import { useState, useContext } from 'react' import { useTranslation } from 'next-i18next' // Context import { ModalContext } from 'shared/context/modal-context.mjs' @@ -15,9 +15,7 @@ import { MenuIcon, OptionsIcon, PrintIcon, - SettingsIcon, UploadIcon, - WrenchIcon, } from 'shared/components/icons.mjs' import { Ribbon } from 'shared/components/ribbon.mjs' import Link from 'next/link' @@ -71,7 +69,6 @@ export const colors = [ 'violet', 'purple', ] -const views = ['menu', 'draft', 'test', 'print', 'cut', 'save', 'export', 'edit', 'clear', 'help'] const NavIcons = ({ setModal, setView, view }) => { const { t } = useTranslation(['header']) diff --git a/sites/shared/components/workbench/index.mjs b/sites/shared/components/workbench/index.mjs index 27e7e741505..001bb76da14 100644 --- a/sites/shared/components/workbench/index.mjs +++ b/sites/shared/components/workbench/index.mjs @@ -3,25 +3,10 @@ import { useEffect, useState } from 'react' import { useTranslation } from 'next-i18next' import { useView } from 'shared/hooks/use-view.mjs' import { useAccount } from 'shared/hooks/use-account.mjs' -import { useBackend } from 'shared/hooks/use-backend.mjs' // Dependencies import { pluginTheme } from '@freesewing/plugin-theme' import { pluginI18n } from '@freesewing/plugin-i18n' import { objUpdate } from 'shared/utils.mjs' -//import { preloaders } from 'shared/components/workbench/preloaders.mjs' -// Components -//import { DraftError } from 'shared/components/workbench/pattern/error.mjs' -import { Modal } from 'shared/components/modal/modal.mjs' -import { ErrorBoundary } from 'shared/components/error/error-boundary.mjs' -// Views -//import { LabSample } from 'shared/components/workbench/sample.mjs' -//import { ExportDraft } from 'shared/components/workbench/exporting/index.mjs' -//import { GistAsJson, GistAsYaml } from 'shared/components/workbench/gist.mjs' -//import { DraftLogs } from 'shared/components/workbench/logs.mjs' -//import { CutLayout } from 'shared/components/workbench/layout/cut/index.mjs' -//import { PrintLayout } from 'shared/components/workbench/layout/print/index.mjs' -//import { EditYaml } from 'shared/components/workbench/edit/index.mjs' - // Components import { WorkbenchHeader } from './header.mjs' import { ErrorView } from 'shared/components/error/view.mjs' @@ -47,7 +32,6 @@ export const Workbench = ({ design, Design, set = false, DynamicDocs = false }) const { t, i18n } = useTranslation(ns) const { language } = i18n const { account, token } = useAccount() - const { backend } = useBackend(token) const defaultSettings = loadDefaultSettings({ units: account.imperial ? 'imperial' : 'metric', @@ -128,171 +112,3 @@ export const Workbench = ({ design, Design, set = false, DynamicDocs = false }) ) } -/* -const views = { - measurements: WorkbenchMeasurements, - //draft: LabDraft, - test: LabSample, - printingLayout: PrintLayout, - cuttingLayout: CutLayout, - export: ExportDraft, - logs: DraftLogs, - yaml: GistAsYaml, - json: GistAsJson, - edit: EditYaml, - welcome: () =>

TODO

, -} - -const hasRequiredMeasurementsMethod = (design, gist) => { - if (design.patternConfig?.measurements?.length > 0 && !gist.measurements) return false - - for (const m of design.patternConfig?.measurements || []) { - if (!gist.measurements[m]) return false - } - - return true -} - -const doPreload = async (preload, from, design, gist, setGist, setPreloaded) => { - const g = await preloaders[from](preload, design) - setPreloaded(preload) - setGist({ ...gist, ...g.settings }) -} - -/* - * This component wraps the workbench and is in charge of - * keeping the gist state, which will trickle down - * to all workbench subcomponents -export const WorkbenchWrapper = ({ - app, - design, - preload = false, - from = false, - layout = false, -}) => { - // State for gist - const { gist, setGist, unsetGist, updateGist, gistReady, undoGist, resetGist } = useGist( - design.designConfig?.data?.name, - app.locale - ) - const [messages, setMessages] = useState([]) - const [popup, setPopup] = useState(false) - const [preloaded, setPreloaded] = useState(false) - // we'll only use this if the renderer is svg, but we can't call hooks conditionally - const { t } = useTranslation(['plugin']) - - // We'll use this in more than one location - const hasRequiredMeasurements = hasRequiredMeasurementsMethod(design, gist) - - // If we don't have the required measurements, - // force view to measurements - useEffect(() => { - if (!gistReady) return - if (!['measurements', 'edit'].includes(gist._state?.view) && !hasRequiredMeasurements) - updateGist(['_state', 'view'], 'measurements') - }, [gistReady, gist._state?.view, hasRequiredMeasurements, updateGist]) - - // If we need to preload the gist, do so - useEffect(() => { - if (preload && preload !== preloaded && from && preloaders[from]) { - doPreload(preload, from, design, gist, setGist, setPreloaded) - } - }, [preload, preloaded, from, design, gist, setGist]) - - // Helper methods to manage the gist state - const updateWBGist = useMemo( - () => - (path, value, closeNav = false, addToHistory = true) => { - updateGist(path, value, addToHistory) - // Force close of menu on mobile if it is open - if (closeNav && app.primaryMenu) app.setPrimaryMenu(false) - }, - [app, updateGist] - ) - - // Helper methods to handle messages - const feedback = { - add: (msg) => { - const newMsgs = [...messages] - if (Array.isArray(msg)) newMsgs.push(...msg) - else newMsgs.push(msg) - setMessages(newMsgs) - }, - set: setMessages, - clear: () => setMessages([]), - } - - // don't do anything until the gist is ready - if (!gistReady) { - return null - } - - // Generate the draft here so we can pass it down to both the view and the options menu - let draft = false - if (['draft', 'logs', 'test', 'printingLayout'].indexOf(gist._state?.view) !== -1) { - gist.embed = true - // get the appropriate layout for the view - const layout = gist.layouts?.[gist._state.view] || gist.layout || true - // hand it separately to the design - draft = new design({ ...gist, layout }) - //draft.__init() - - // add theme to svg renderer - if (gist.renderer === 'svg') { - draft.use(pluginI18n, { t }) - draft.use(pluginTheme, { skipGrid: ['pages'] }) - } - - // draft it for draft and event views. Other views may add plugins, etc and we don't want to draft twice - try { - if (['draft', 'logs'].indexOf(gist._state.view) > -1) draft.draft() - } catch (error) { - return - } - } - - // Props to pass down - const componentProps = { - app, - design, - gist, - updateGist: updateWBGist, - unsetGist, - setGist, - feedback, - gistReady, - showInfo: setPopup, - hasRequiredMeasurements, - draft, - } - // Required props for layout - const layoutProps = { - app: app, - noSearch: true, - workbench: true, - AltMenu: , - showInfo: setPopup, - } - - const errorProps = { - undoGist, - resetGist, - gist, - } - - // Layout to use - const LayoutComponent = layout - - const Component = views[gist._state?.view] ? views[gist._state.view] : views.welcome - - return ( - - {messages} - - - {popup && setPopup(false)}>{popup}} - - - ) -} - */ diff --git a/sites/shared/components/workbench/menus/core-settings/index.mjs b/sites/shared/components/workbench/menus/core-settings/index.mjs index 6018f0c03fd..c7f0752a987 100644 --- a/sites/shared/components/workbench/menus/core-settings/index.mjs +++ b/sites/shared/components/workbench/menus/core-settings/index.mjs @@ -9,18 +9,6 @@ import { loadSettingsConfig } from './config.mjs' import { ModalWrapper } from 'shared/components/wrappers/modal.mjs' import { SettingsIcon, ClearIcon, HelpIcon } from 'shared/components/icons.mjs' import Link from 'next/link' -import { - Li, - Ul, - SumButton, - SumDiv, - Summary, - Deg, - SecText, - Details, - TopSummary, - TopSumTitle, -} from '../index.mjs' import { Collapse } from 'shared/components/collapse.mjs' import { CompleteSettingInput, diff --git a/sites/shared/components/workbench/menus/core-settings/inputs.mjs b/sites/shared/components/workbench/menus/core-settings/inputs.mjs index d59c58aa12c..d224d74042e 100644 --- a/sites/shared/components/workbench/menus/core-settings/inputs.mjs +++ b/sites/shared/components/workbench/menus/core-settings/inputs.mjs @@ -1,6 +1,4 @@ import { useState } from 'react' -import { useTranslation } from 'next-i18next' -import { SecText, SumButton, Li, SumDiv, Deg } from 'shared/components/workbench/menus/index.mjs' import { formatMm } from 'shared/utils.mjs' import { ClearIcon } from 'shared/components/icons.mjs' import { ChoiceButton } from 'shared/components/choice-button.mjs' @@ -202,10 +200,6 @@ export const SaMmSettingInput = ({ name, config, current, update, t, units }) => [['sa'], newCurrent], ]) } - const reset = () => { - update.settings([[['samm']], [['sa'], config.dflt]]) - setValue(config.dflt) - } return ( <> @@ -238,7 +232,6 @@ export const SaBoolSettingInput = ({ config, current, update, t, samm, changed } if (typeof current === 'undefined') current = config.dflt const handleChange = (newCurrent) => { - const newSa = newCurrent ? samm : 0 if (newCurrent === config.dflt) reset() else { update.settings([[['sabool'], newCurrent], [['sa']]]) diff --git a/sites/shared/components/workbench/menus/core-settings/values.mjs b/sites/shared/components/workbench/menus/core-settings/values.mjs index 1bb012621cf..fbe948ec427 100644 --- a/sites/shared/components/workbench/menus/core-settings/values.mjs +++ b/sites/shared/components/workbench/menus/core-settings/values.mjs @@ -1,5 +1,4 @@ import { formatMm } from 'shared/utils.mjs' -import { SecText, AccentText, PrimaryText } from 'shared/components/workbench/menus/index.mjs' const ListValue = ({ current, t, config, changed }) => changed diff --git a/sites/shared/components/workbench/menus/design-options/index.mjs b/sites/shared/components/workbench/menus/design-options/index.mjs index a89d95e5bed..5ff641bfe05 100644 --- a/sites/shared/components/workbench/menus/design-options/index.mjs +++ b/sites/shared/components/workbench/menus/design-options/index.mjs @@ -8,17 +8,6 @@ import { ModalWrapper } from 'shared/components/wrappers/modal.mjs' import { Collapse } from 'shared/components/collapse.mjs' import { OptionsIcon, ClearIcon, HelpIcon, EditIcon, CloseIcon } from 'shared/components/icons.mjs' import { Chevron } from 'shared/components/navigation/primary.mjs' -import { - Li, - Ul, - Details, - Summary, - SumDiv, - SumButton, - Deg, - TopSummary, - TopSumTitle, -} from 'shared/components/workbench/menus/index.mjs' import { optionsMenuStructure } from 'shared/utils.mjs' import { optionType } from 'shared/utils.mjs' import { diff --git a/sites/shared/components/workbench/menus/index.mjs b/sites/shared/components/workbench/menus/index.mjs deleted file mode 100644 index 600a4c973d2..00000000000 --- a/sites/shared/components/workbench/menus/index.mjs +++ /dev/null @@ -1,152 +0,0 @@ -import { DesignOptions } from './design-options/index.mjs' -import { CoreSettings, ns as coreSettingsNs } from './core-settings/index.mjs' -import { XrayMenu } from './xray/index.mjs' -import { TestDesignOptions } from './test-design-options/index.mjs' -import { BulletIcon } from 'shared/components/icons.mjs' - -export const linkClasses = ` - text-base text-base-content sm:text-base-content - hover:text-secondary - sm:hover:text-secondary -` - -export const ns = coreSettingsNs -export const Ul = (props) =>
    {props.children}
-export const Li = (props) => ( -
  • - {props.children} -
  • -) -export const Details = (props) => ( -
    - {props.children} -
    -) -export const Deg = ({ changed }) => ( - -) - -export const NoSumDiv = (props) => ( -
    - {props.children} -
    -) -export const SumDiv = (props) => ( -
    - {props.children} -
    -) -export const Summary = (props) => ( - - {props.children} - -) -export const TopSummary = (props) => ( - - {props.icon || null} - {props.children} - -) -export const SumButton = (props) => ( - -) -export const TopSumTitle = (props) => ( - - {props.children} - -) -export const SecText = (props) => - props.raw ? ( - - ) : ( - {props.children} - ) - -export const AccentText = (props) => - props.raw ? ( - - ) : ( - {props.children} - ) - -export const PrimaryText = (props) => - props.raw ? ( - - ) : ( - {props.children} - ) - -export const DraftMenu = (props) => { - const { design, patternConfig, settings, ui, update, Option = false } = props - - return ( - - ) -} - -export const TestMenu = (props) => { - return ( - - ) -} diff --git a/sites/shared/components/workbench/menus/xray/attributes.mjs b/sites/shared/components/workbench/menus/xray/attributes.mjs index c7494ba6f40..994d801edff 100644 --- a/sites/shared/components/workbench/menus/xray/attributes.mjs +++ b/sites/shared/components/workbench/menus/xray/attributes.mjs @@ -1,15 +1,9 @@ import { Chevron } from 'shared/components/navigation/primary' -import { - Ul, - Li, - Details, - Summary, - SumDiv, - NoSumDiv, - Deg, -} from 'shared/components/workbench/menus/index.mjs' export const XrayAttributes = ({ attr = false, t }) => { + return null + // FIXME + /* if (!attr || !attr.list || Object.keys(attr.list).length < 1) return null return ( @@ -50,4 +44,5 @@ export const XrayAttributes = ({ attr = false, t }) => { ) + */ } diff --git a/sites/shared/components/workbench/menus/xray/index.mjs b/sites/shared/components/workbench/menus/xray/index.mjs index e73d2a4afa2..a9b72e3dc73 100644 --- a/sites/shared/components/workbench/menus/xray/index.mjs +++ b/sites/shared/components/workbench/menus/xray/index.mjs @@ -3,7 +3,6 @@ import { linkClasses, Chevron } from 'shared/components/navigation/primary.mjs' import { ConsoleLog } from './log.mjs' import { XrayReset } from './reset.mjs' import { XrayList } from './list.mjs' -import { Ul, Details, TopSummary } from 'shared/components/workbench/menus/index.mjs' import { useTranslation } from 'next-i18next' import { Collapse } from 'shared/components/collapse.mjs' import { ChoiceButton } from 'shared/components/choice-button.mjs' diff --git a/sites/shared/components/workbench/menus/xray/list.mjs b/sites/shared/components/workbench/menus/xray/list.mjs index 8a87a93f980..db215b28fdd 100644 --- a/sites/shared/components/workbench/menus/xray/list.mjs +++ b/sites/shared/components/workbench/menus/xray/list.mjs @@ -1,6 +1,5 @@ import { Chevron } from 'shared/components/navigation/primary.mjs' import { ClearIcon, FilterIcon, SearchIcon } from 'shared/components/icons.mjs' -import { Ul, Li, Details, Summary, SumDiv, Deg } from 'shared/components/workbench/menus/index.mjs' import { XrayPath } from './path.mjs' import { XrayPoint } from './point.mjs' import { useTranslation } from 'next-i18next' @@ -12,6 +11,9 @@ const types = { export const XrayList = (props) => { const { t } = useTranslation(['app', 'parts']) + return null + // FIXME + /* const title = t(`parts:${props.partName}`) + ` (${props.partName})` @@ -159,4 +161,5 @@ export const XrayList = (props) => { ) + */ } diff --git a/sites/shared/components/workbench/menus/xray/log.mjs b/sites/shared/components/workbench/menus/xray/log.mjs index 123eda8a98a..eb86a4861ea 100644 --- a/sites/shared/components/workbench/menus/xray/log.mjs +++ b/sites/shared/components/workbench/menus/xray/log.mjs @@ -1,15 +1,9 @@ import { Chevron } from 'shared/components/navigation/primary.mjs' -import { - Ul, - Li, - Details, - Summary, - SumButton, - SumDiv, - Deg, -} from 'shared/components/workbench/menus/index.mjs' -export const ConsoleLog = (props) => ( +export const ConsoleLog = (props) => null +// FIXME +/* + (
  • @@ -41,3 +35,4 @@ export const ConsoleLog = (props) => (
  • ) +*/ diff --git a/sites/shared/components/workbench/menus/xray/path-ops.mjs b/sites/shared/components/workbench/menus/xray/path-ops.mjs index 1939fe68a11..63116c0255d 100644 --- a/sites/shared/components/workbench/menus/xray/path-ops.mjs +++ b/sites/shared/components/workbench/menus/xray/path-ops.mjs @@ -1,17 +1,9 @@ import { Chevron } from 'shared/components/navigation/primary' -import { - Ul, - Li, - Details, - Summary, - SumDiv, - NoSumDiv, - Deg, -} from 'shared/components/workbench/menus/index.mjs' import { XrayPoint } from './point' const MoveLine = ({ op }) => -const Curve = ({ op }) => +const Curve = ({ op }) => null +/* ['cp1', 'cp2', 'to'].map((pnt) => (
  • @@ -26,8 +18,10 @@ const Curve = ({ op }) =>
  • )) - -const XrayPathOp = ({ op }) => ( +*/ +const XrayPathOp = ({ op }) => null +/* + * (
  • {op.type === 'close' ? ( @@ -49,8 +43,10 @@ const XrayPathOp = ({ op }) => ( )}
  • ) - -export const XrayPathOps = ({ ops = false }) => { +*/ +export const XrayPathOps = ({ ops = false }) => null +/* + * { if (!ops || ops.length < 1) return null return ( @@ -72,3 +68,4 @@ export const XrayPathOps = ({ ops = false }) => { ) } +*/ diff --git a/sites/shared/components/workbench/menus/xray/path.mjs b/sites/shared/components/workbench/menus/xray/path.mjs index f0b837ef052..18c8f44421b 100644 --- a/sites/shared/components/workbench/menus/xray/path.mjs +++ b/sites/shared/components/workbench/menus/xray/path.mjs @@ -1,9 +1,9 @@ -import { Ul, Li, NoSumDiv, Deg } from 'shared/components/workbench/menus/index.mjs' import { formatMm } from 'shared/utils.mjs' import { XrayAttributes } from './attributes.mjs' import { XrayPathOps } from './path-ops.mjs' -export const XrayPath = ({ pathName, partName, draft, units }) => { +export const XrayPath = ({ pathName, partName, draft, units }) => null +/*{ const path = draft?.parts?.[partName]?.paths?.[pathName] if (!path) return null @@ -32,3 +32,4 @@ export const XrayPath = ({ pathName, partName, draft, units }) => { ) } +*/ diff --git a/sites/shared/components/workbench/menus/xray/point.mjs b/sites/shared/components/workbench/menus/xray/point.mjs index 50b76cd6722..7278524cf62 100644 --- a/sites/shared/components/workbench/menus/xray/point.mjs +++ b/sites/shared/components/workbench/menus/xray/point.mjs @@ -1,8 +1,8 @@ -import { Ul, Li, NoSumDiv, Deg } from 'shared/components/workbench/menus/index.mjs' import { round } from 'shared/utils' import { XrayAttributes } from './attributes' -export const XrayPoint = ({ pointName, partName, draft, t }) => { +export const XrayPoint = ({ pointName, partName, draft, t }) => null +/*{ const point = draft?.parts?.[partName]?.points?.[pointName] return point ? ( @@ -20,3 +20,4 @@ export const XrayPoint = ({ pointName, partName, draft, t }) => { ) : null } +*/ diff --git a/sites/shared/components/workbench/menus/xray/reset.mjs b/sites/shared/components/workbench/menus/xray/reset.mjs index c0971e13b81..1b3440d0559 100644 --- a/sites/shared/components/workbench/menus/xray/reset.mjs +++ b/sites/shared/components/workbench/menus/xray/reset.mjs @@ -1,7 +1,7 @@ -import { Li, SumButton, SumDiv, Deg } from 'shared/components/workbench/menus/index.mjs' import { useTranslation } from 'next-i18next' -export const XrayReset = (props) => { +export const XrayReset = (props) => null +/*{ const { t } = useTranslation(['app']) return ( @@ -15,3 +15,4 @@ export const XrayReset = (props) => { ) } +*/