diff --git a/sites/shared/components/account/sets.mjs b/sites/shared/components/account/sets.mjs index babe65ef29c..f0720d9154e 100644 --- a/sites/shared/components/account/sets.mjs +++ b/sites/shared/components/account/sets.mjs @@ -18,13 +18,11 @@ import { ModalContext } from 'shared/context/modal-context.mjs' // Components import { Collapse, useCollapseButton } from 'shared/components/collapse.mjs' import { BackToAccountButton, Choice } from './shared.mjs' -import { WebLink } from 'shared/components/web-link.mjs' import { PageLink } from 'shared/components/page-link.mjs' import { ModalDesignPicker } from 'shared/components/modal/design-picker.mjs' import { FilterIcon, ClearIcon, - CloseIcon, PlusIcon, OkIcon, NoIcon, @@ -116,13 +114,6 @@ export const NewSet = ({ ) } -const Row = ({ title, children }) => ( -
-
{title}
-
{children}
-
-) - const EditField = (props) => { if (props.field === 'name') return if (props.field === 'notes') return @@ -194,7 +185,6 @@ export const MeasieRow = (props) => { const MeasieInput = ({ m, mset, backend, toast, refresh }) => { const { t } = useTranslation(['measurements']) //const title = t(`measurements:${m}`) - const { startLoading, stopLoading } = useContext(LoadingContext) const isDegree = isDegreeMeasurement(m) const factor = isDegree ? 1 : mset.imperial ? 25.4 : 10 @@ -377,7 +367,7 @@ const EditImg = ({ t, mset, account, backend, toast, refresh, curated = false }) }, []) const { getRootProps, getInputProps } = useDropzone({ onDrop }) - const { loading, startLoading, stopLoading } = useContext(LoadingContext) + const { startLoading, stopLoading } = useContext(LoadingContext) const update = async (evt) => { evt.preventDefault() @@ -386,18 +376,6 @@ const EditImg = ({ t, mset, account, backend, toast, refresh, curated = false }) } } - const save = async () => { - startLoading() - const result = curated - ? await backend.updateCuratedSet(mset.id, { img }) - : await backend.updateSet(mset.id, { img }) - if (result.success) { - refresh() - toast.for.settingsSaved() - } else toast.for.backendError() - stopLoading() - } - return (
@@ -592,7 +570,7 @@ const EditUnits = ({ t, mset, account, backend, toast, refresh }) => { const EditPublic = ({ t, mset, account, backend, toast, refresh }) => { const [selection, setSelection] = useState(mset.public) - const { loading, startLoading, stopLoading } = useContext(LoadingContext) + const { startLoading, stopLoading } = useContext(LoadingContext) const update = async (val) => { setSelection(val) @@ -770,13 +748,6 @@ const MeasurementsSet = ({ mset, t, account, backend, refresh }) => { // Hooks const toast = useToast() - const fields = { - id: 'ID', - name: t('name'), - level: t('keyLevel'), - createdAt: t('created'), - } - const remove = async () => { startLoading() const result = await backend.removeSet(mset.id) diff --git a/sites/shared/components/sets/set-picker.mjs b/sites/shared/components/sets/set-picker.mjs index 709fc81e4d3..6ec3cf02b80 100644 --- a/sites/shared/components/sets/set-picker.mjs +++ b/sites/shared/components/sets/set-picker.mjs @@ -85,7 +85,9 @@ export const CuratedSetPicker = ({ design, language }) => { <>

{t('curatedSets')}

{tags.map((tag) => ( - addFilter(tag)}>{tag} + addFilter(tag)} tag={tag}> + {tag} + ))}
diff --git a/sites/shared/components/sets/set.mjs b/sites/shared/components/sets/set.mjs index 12a7ec7872f..96e4a39745d 100644 --- a/sites/shared/components/sets/set.mjs +++ b/sites/shared/components/sets/set.mjs @@ -1,13 +1,13 @@ -import Link from 'next/link' -import { useTranslation } from 'next-i18next' -import { Difficulty } from 'shared/components/designs/difficulty.mjs' -import { designs } from 'shared/config/designs.mjs' -import { DesignTag } from 'shared/components/designs/tag.mjs' +//import Link from 'next/link' +//import { useTranslation } from 'next-i18next' +//import { Difficulty } from 'shared/components/designs/difficulty.mjs' +//import { designs } from 'shared/config/designs.mjs' +//import { DesignTag } from 'shared/components/designs/tag.mjs' export const ns = ['design', 'designs', 'tags'] export const Set = ({ name }) => { - const { t } = useTranslation(ns) + //const { t } = useTranslation(ns) return

fixme

/* diff --git a/sites/shared/components/wrappers/mdx.mjs b/sites/shared/components/wrappers/mdx.mjs index aa688afb312..25dbc7c9e2e 100644 --- a/sites/shared/components/wrappers/mdx.mjs +++ b/sites/shared/components/wrappers/mdx.mjs @@ -3,13 +3,9 @@ import { components as baseComponents } from 'shared/components/mdx/index.mjs' // List of authors import { authors as allAuthors } from 'config/authors.mjs' import { docUpdates } from 'site/prebuild/doc-updates.mjs' -// FreeSewing config -import { freeSewingConfig } from 'shared/config/freesewing.config.mjs' // Components import { PageLink } from 'shared/components/page-link.mjs' -import { WebLink } from 'shared/components/web-link.mjs' import { DateTime, Interval } from 'luxon' -import { DocsIcon } from 'shared/components/icons.mjs' // Context import { useContext } from 'react' import { NavigationContext } from 'shared/context/navigation-context.mjs' @@ -116,8 +112,8 @@ export const MdxWrapper = ({ MDX, frontmatter = {}, components = {} }) => {
diff --git a/sites/shared/components/wrappers/modal.mjs b/sites/shared/components/wrappers/modal.mjs index 738973d41fa..b0d16fdd26e 100644 --- a/sites/shared/components/wrappers/modal.mjs +++ b/sites/shared/components/wrappers/modal.mjs @@ -1,6 +1,5 @@ import { useState, useEffect, useContext } from 'react' import { useSwipeable } from 'react-swipeable' -import { ModalMenu } from 'site/components/navigation/modal-menu.mjs' import { ModalContext } from 'shared/context/modal-context.mjs' const slideClasses = { diff --git a/sites/shared/components/wrappers/page.mjs b/sites/shared/components/wrappers/page.mjs index bdf50c908ec..9c6b9f04ab5 100644 --- a/sites/shared/components/wrappers/page.mjs +++ b/sites/shared/components/wrappers/page.mjs @@ -8,7 +8,6 @@ import { SwipeWrapper } from 'shared/components/wrappers/swipes.mjs' import { LayoutWrapper, ns as layoutNs } from 'site/components/wrappers/layout.mjs' import { DocsLayout, ns as docsNs } from 'site/components/layouts/docs.mjs' import { Feeds } from 'site/components/feeds.mjs' -import { Spinner } from 'shared/components/spinner.mjs' import { ModalContext } from 'shared/context/modal-context.mjs' import { NavigationContext } from 'shared/context/navigation-context.mjs' @@ -43,7 +42,7 @@ export const PageWrapper = (props) => { * Contexts */ const { modalContent } = useContext(ModalContext) - const { title, setNavigation } = useContext(NavigationContext) + const { setNavigation } = useContext(NavigationContext) /* * Update navigation context with title and path diff --git a/sites/shared/components/wrappers/swipes.mjs b/sites/shared/components/wrappers/swipes.mjs index 62139c707b9..d9c00f9376c 100644 --- a/sites/shared/components/wrappers/swipes.mjs +++ b/sites/shared/components/wrappers/swipes.mjs @@ -2,11 +2,10 @@ import React, { useContext } from 'react' import { useSwipeable } from 'react-swipeable' import { useHotkeys } from 'react-hotkeys-hook' import { ModalContext } from 'shared/context/modal-context.mjs' -import { ModalMenu } from 'site/components/navigation/modal-menu.mjs' /* This component should wrap all swipeable content */ export const SwipeWrapper = ({ children, app }) => { - const { setModal, clearModal } = useContext(ModalContext) || {} + const { clearModal } = useContext(ModalContext) || {} /* * Swipe handling for the entire site diff --git a/sites/shared/config/broke.next.mjs b/sites/shared/config/broke.next.mjs deleted file mode 100644 index fd0c75a5028..00000000000 --- a/sites/shared/config/broke.next.mjs +++ /dev/null @@ -1,198 +0,0 @@ -import path from 'path' -import { designs, plugins } from '../../../config/software/index.mjs' -// Remark plugins we want to use -import remarkFrontmatter from 'remark-frontmatter' -import remarkGfm from 'remark-gfm' -import remarkCopyLinkedFiles from 'remark-copy-linked-files' -//import { remarkIntroPlugin } from './remark-intro-plugin.mjs' -//import mdxPluginToc from './mdx-plugin-toc.mjs' -import smartypants from 'remark-smartypants' -// Rehype plugins we want to use -import rehypeHighlight from 'rehype-highlight' -import rehypeAutolinkHeadings from 'rehype-autolink-headings' -import rehypeSlug from 'rehype-slug' -import rehypeJargon from '../../../packages/rehype-jargon/src/index.mjs' -import rehypeHighlightLines from '../../../packages/rehype-highlight-lines/src/index.mjs' -// Webpack MDX loadder for NextJS -import mdxLoader from '@next/mdx' - -const jargonTransform = (term, html) => `
- - ${term} - - - - -
- ${html}
` - -const getMdxConfig = ({ site, jargon }) => ({ - extension: /\.(md|mdx)$/, - options: { - providerImportSource: '@mdx-js/react', - remarkPlugins: [ - remarkFrontmatter, - remarkGfm, - smartypants, - //[ - // remarkCopyLinkedFiles, - // { - // destinationDir: path.resolve(`../${site}/public/mdx`), - // sourceDir: path.resolve(`../../markdown/${site}/${slug}`), - // staticPath: '/mdx/', - // }, - //], - //[remarkIntroPlugin, { intro }], - ], - rehypePlugins: [ - [rehypeJargon, { jargon, transform: jargonTransform }], - [ - rehypeHighlight, - { - plainText: ['dot', 'http'], - aliases: { - javascript: [ - 'design/src/index.mjs', - 'design/src/part.mjs', - 'design/src/bib.mjs', - 'index.mjs', - 'part.mjs', - 'bib.mjs', - ], - json: [ - '200.json', - '201.json', - '204.json', - '400.json', - '401.json', - '403.json', - '404.json', - '500.json', - ], - markdown: ['en.md'], - }, - }, - ], - [ - rehypeHighlightLines, - { - highlightClass: ['highlight-lines', 'border-l-4'], - strikeoutClass: [ - 'strikeout-lines', - 'bg-orange-300', - 'bg-opacity-5', - 'border-l-4', - 'opacity-80', - 'line-through', - 'decoration-orange-500', - ], - }, - ], - rehypeSlug, - [ - rehypeAutolinkHeadings, - { - behavior: 'wrap', - properties: { className: 'heading-autolink' }, - }, - ], - ], - }, -}) - -/* - * This mehthod will return the NextJS configuration - * Parameters: - * - * site: one of 'dev', 'org', or 'lab' - * remarkPlugins: Array of remark plugins to load - * srcPkgs: Array of folders in the monorepo/packages that should be aliased - * so they are loaded from source, rather than from a compiled bundle - */ -const config = (site, jargon = {}) => { - const mdxConfig = getMdxConfig({ site, jargon }) - const withMdx = mdxLoader(mdxConfig) - console.log({ mdxConfig, withMdx }) - - return withMdx({ - experimental: { - externalDir: true, - }, - pageExtensions: ['mjs'], - webpack: (config, options) => { - // Fixes npm packages that depend on node modules - if (!options.isServer) { - config.resolve.fallback.fs = false - config.resolve.fallback.path = false - config.resolve.fallback.child_process = false - } - - // MDX support - //config.module.rules.push({ - // test: /\.md?$/, - // use: [ - // options.defaultLoaders.babel, - // { - // loader: '@mdx-js/loader', - // //providerImportSource: '@mdx-js/react', - // options: { - // remarkPlugins: [remarkGfm, ...remarkPlugins], - // }, - // }, - // ], - //}) - - // YAML support - config.module.rules.push({ - test: /\.ya?ml$/, - use: 'yaml-loader', - }) - - // Fix for nextjs bug #17806 - config.module.rules.push({ - test: /index.mjs$/, - type: 'javascript/auto', - resolve: { - fullySpecified: false, - }, - }) - - // Suppress warnings about importing version from package.json - // We'll deal with it in v3 of FreeSewing - config.ignoreWarnings = [/only default export is available soon/] - - // Aliases - config.resolve.alias.shared = path.resolve('../shared/') - config.resolve.alias.site = path.resolve(`../${site}/`) - config.resolve.alias.markdown = path.resolve(`../../markdown/${site}/`) - config.resolve.alias.config = path.resolve('../../config/') - config.resolve.alias.designs = path.resolve('../../designs/') - config.resolve.alias.plugins = path.resolve('../../plugins/') - config.resolve.alias.pkgs = path.resolve('../../packages/') - config.resolve.alias.root = path.resolve('../../') - - // Load designs from source, rather than compiled package - for (const design in designs) { - config.resolve.alias[`@freesewing/${design}`] = path.resolve( - `../../designs/${design}/src/index.mjs` - ) - } - // Load plugins from source, rather than compiled package - for (const plugin in plugins) { - config.resolve.alias[`@freesewing/${plugin}`] = path.resolve( - `../../plugins/${plugin}/src/index.mjs` - ) - } - // Load these from source, rather than compiled package - for (const pkg of ['core', 'i18n', 'models', 'snapseries']) { - config.resolve.alias[`@freesewing/${pkg}`] = path.resolve( - `../../packages/${pkg}/src/index.mjs` - ) - } - - return config - }, - }) -} - -export default config diff --git a/sites/shared/config/next.mjs b/sites/shared/config/next.mjs index 361d336037b..1d1206365c8 100644 --- a/sites/shared/config/next.mjs +++ b/sites/shared/config/next.mjs @@ -15,7 +15,7 @@ import rehypeSlug from 'rehype-slug' import rehypeJargon from '../../../packages/rehype-jargon/src/index.mjs' import rehypeHighlightLines from '../../../packages/rehype-highlight-lines/src/index.mjs' // Webpack MDX loadder for NextJS -import mdxLoader from '@next/mdx' +//import mdxLoader from '@next/mdx' const jargonTransform = (term, html) => `
diff --git a/sites/shared/context/modal-context.mjs b/sites/shared/context/modal-context.mjs index 9451cd9c9ca..b2742c711fa 100644 --- a/sites/shared/context/modal-context.mjs +++ b/sites/shared/context/modal-context.mjs @@ -1,4 +1,4 @@ -import React, { useState, useContext } from 'react' +import React, { useState } from 'react' export const ModalContext = React.createContext(null) diff --git a/sites/shared/hooks/use-backend.mjs b/sites/shared/hooks/use-backend.mjs index 01e42dc7039..cfc3fb59f16 100644 --- a/sites/shared/hooks/use-backend.mjs +++ b/sites/shared/hooks/use-backend.mjs @@ -1,5 +1,4 @@ import axios from 'axios' -import process from 'process' import { freeSewingConfig } from 'shared/config/freesewing.config.mjs' /* diff --git a/sites/shared/hooks/use-navigation.mjs b/sites/shared/hooks/use-navigation.mjs deleted file mode 100644 index 7232bd88c00..00000000000 --- a/sites/shared/hooks/use-navigation.mjs +++ /dev/null @@ -1,14 +0,0 @@ -import { useEffect, useContext } from 'react' -import { NavigationContext } from 'shared/context/navigation-context.mjs' - -export const useNavigation = ({ page }) => { - const all = useContext(NavigationContext) - - useEffect(() => {}, [page.path, page.t]) - - return { - title: page.t, - slug: page.s, - order: page.o, - } -} diff --git a/sites/shared/mdx/v3loader.mjs b/sites/shared/mdx/v3loader.mjs index e0a81e0d06e..396a3c33a62 100644 --- a/sites/shared/mdx/v3loader.mjs +++ b/sites/shared/mdx/v3loader.mjs @@ -1,4 +1,4 @@ -// We need fs and path to read from disk +/*// We need fs and path to read from disk import fs from 'fs' import path from 'path' @@ -20,16 +20,6 @@ import rehypeJargon from 'pkgs/rehype-jargon/src/index.mjs' import rehypeHighlightLines from 'pkgs/rehype-highlight-lines/src/index.mjs' // Simple frontmatter extractor import frontmatter from 'front-matter' -/* - * Summary: Loads markdown from disk and compiles it as MDX. - * - * @param (string) language - language to load (eg: 'en') - * @param (string) site - site to load (either 'dev' or 'org') - * @param (string) slug - slug of the page (eg: 'guides/patterns') - * - * @link https://mdxjs.com/guides/mdx-on-demand/ - * - */ const jargonTransform = (term, html) => `
@@ -150,5 +140,5 @@ export const mdxLoader = async (language, site, slug, jargon) => { ) return { mdx, intro, toc, frontmatter: frontmatter(md)?.attributes } - */ } + */ diff --git a/sites/shared/prebuild/git.mjs b/sites/shared/prebuild/git.mjs index f9b53d19cae..9de3452bdee 100644 --- a/sites/shared/prebuild/git.mjs +++ b/sites/shared/prebuild/git.mjs @@ -2,7 +2,6 @@ import execa from 'execa' import { gitToAuthor, authors as authorInfo } from '../../../config/authors.mjs' import path from 'path' import fs from 'fs' -import rdir from 'recursive-readdir' import { getMdxFileList, fileToSlug } from './docs.mjs' const divider = '____' diff --git a/sites/shared/prebuild/index.mjs b/sites/shared/prebuild/index.mjs index e7f0a24efa2..9e2088c631e 100644 --- a/sites/shared/prebuild/index.mjs +++ b/sites/shared/prebuild/index.mjs @@ -14,7 +14,6 @@ const run = async () => { if (linter) return true const SITE = process.env.SITE || 'lab' prebuildDesigns() - let docPages if (['org', 'dev'].includes(SITE)) { await prebuildGitData(SITE) const docPages = await prebuildDocs(SITE) diff --git a/sites/shared/prebuild/lab.mjs b/sites/shared/prebuild/lab.mjs index 533ab2f3bdf..8f5436bf41b 100644 --- a/sites/shared/prebuild/lab.mjs +++ b/sites/shared/prebuild/lab.mjs @@ -1,20 +1,14 @@ -import fs_ from 'fs' -import path from 'path' -import { capitalize } from '../utils.mjs' -import { plugins, designs } from '../../../config/software/index.mjs' -import { header, prebuildOrg } from './org.mjs' +import { prebuildOrg } from './org.mjs' -const fs = fs_.promises - -const copyFromOrg = [ - 'pages/account', - 'pages/confirm', - 'pages/designs', - 'pages/new', - 'pages/signin', - 'pages/signup', - 'pages/welcome', -] +//const copyFromOrg = [ +// 'pages/account', +// 'pages/confirm', +// 'pages/designs', +// 'pages/new', +// 'pages/signin', +// 'pages/signup', +// 'pages/welcome', +//] export const prebuildLab = async () => { await prebuildOrg('lab')