1
0
Fork 0

fix lab build errors after mjs transition

This commit is contained in:
Enoch Riese 2023-02-09 21:39:19 -06:00
parent 6d5d13e9b5
commit dd4aabc557
17 changed files with 42 additions and 44 deletions

View file

@ -6,7 +6,7 @@ import Head from 'next/head'
import Link from 'next/link'
import { PageWrapper } from 'site/components/wrappers/page.mjs'
import { BareLayout } from 'site/components/layouts/bare.mjs'
import { PageTitle } from 'shared/components/layouts/default.mjs'
import { PageTitle } from 'shared/components/workbench/layout/default.mjs'
const DesignLinks = ({ list, prefix = '' }) => {
const { t } = useTranslation(['patterns'])

View file

@ -1,7 +1,7 @@
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import PageTemplate from 'site/page-templates/design-list.js'
import { PatternListPageTemplate } from 'site/page-templates/design-list.mjs'
const Page = () => <PageTemplate section="accessories" />
const Page = () => <PatternListPageTemplate section="accessories" />
export default Page

View file

@ -1,7 +1,7 @@
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import PageTemplate from 'site/page-templates/design-list.js'
import { PatternListPageTemplate } from 'site/page-templates/design-list.mjs'
const Page = () => <PageTemplate section="blocks" />
const Page = () => <PatternListPageTemplate section="blocks" />
export default Page

View file

@ -1,7 +1,7 @@
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import PageTemplate from 'site/page-templates/design-list.js'
import { PatternListPageTemplate } from 'site/page-templates/design-list.mjs'
const Page = () => <PageTemplate section="garments" />
const Page = () => <PatternListPageTemplate section="garments" />
export default Page

View file

@ -1,7 +1,7 @@
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import PageTemplate from 'site/page-templates/design-list.js'
import { PatternListPageTemplate } from 'site/page-templates/design-list.mjs'
const Page = () => <PageTemplate section="utilities" />
const Page = () => <PatternListPageTemplate section="utilities" />
export default Page

View file

@ -1,6 +1,6 @@
import { ErrorView } from 'shared/components/error/view.mjs'
export const Error = (props) => {
export const DraftError = (props) => {
const errors = {
pattern: 0,
sets: 0,

View file

@ -1,5 +1,5 @@
import { SvgWrapper } from './svg.mjs'
import { Error } from './error.mjs'
import { DraftError } from './error.mjs'
export const LabDraft = (props) => {
const { app, draft, gist, updateGist, unsetGist, showInfo, feedback, hasRequiredMeasurements } =
@ -14,7 +14,7 @@ export const LabDraft = (props) => {
svg = draft.render()
} catch (error) {
console.log('Failed to render design', error)
return <Error error={error} {...props} />
return <DraftError error={error} {...props} />
}
return <div dangerouslySetInnerHTML={{ __html: svg }} />
}
@ -26,7 +26,7 @@ export const LabDraft = (props) => {
} catch (error) {
console.log('Failed to get render props for design', error)
return (
<Error
<DraftError
error={error}
patternLogs={patternProps.store.logs}
setLogs={patternProps.setStores[0].logs}
@ -44,7 +44,7 @@ export const LabDraft = (props) => {
return (
<>
{errors.length > 0 ? (
<Error
<DraftError
{...{
draft,
patternProps,

View file

@ -104,7 +104,7 @@ const StoreLogs = ({ logs, units }) => (
</div>
)
const Logs = (props) => {
export const DraftLogs = (props) => {
return (
<Tabs
tabs={[
@ -121,4 +121,4 @@ const Logs = (props) => {
)
}
export default Logs
export default DraftLogs

View file

@ -1,15 +1,15 @@
import { DesignOptionPctDeg } from 'shared/components/workbench/inputs/design-option-pct-deg.mjs'
import { CountOption } from 'shared/components/workbench/inputs/design-option-count.mjs'
import { ListOption } from 'shared/components/workbench/inputs/design-option-list.mjs'
import { DesignOptionCount } from 'shared/components/workbench/inputs/design-option-count.mjs'
import { DesignOptionList } from 'shared/components/workbench/inputs/design-option-list.mjs'
import { Popout } from 'shared/components/popout.mjs'
export const Tmp = () => <p>not yet</p>
export const inputs = {
Pct: DesignOptionPctDeg,
Count: CountOption,
Count: DesignOptionCount,
Deg: (props) => <DesignOptionPctDeg {...props} type="deg" />,
List: ListOption,
List: DesignOptionList,
Mm: () => (
<Popout fixme compact>
Mm options are deprecated. Please report this

View file

@ -1,7 +1,7 @@
import { OptionsIcon } from 'shared/components/icons.mjs'
import { Chevron } from 'shared/components/navigation/primary.mjs'
import OptionGroup from '../design-options/option-group.mjs'
import Option from './option.mjs'
import { OptionGroup } from '../design-options/option-group.mjs'
import { Option } from './option.mjs'
import { Ul, Details, TopSummary, TopSumTitle } from 'shared/components/workbench/menu/index.mjs'
import { useTranslation } from 'next-i18next'
import { optionsMenuStructure } from 'shared/utils.mjs'

View file

@ -1,6 +1,6 @@
import { Li, SumButton, SumDiv } from 'shared/components/workbench/menu/index.mjs'
const Option = (props) => {
export const Option = (props) => {
const active = props.sampleSettings?.type === 'option' && props.active === props.option
const setSampleSettings = () => {
@ -32,5 +32,3 @@ const Option = (props) => {
</Li>
)
}
export default Option

View file

@ -1,13 +1,13 @@
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/menu/index.mjs'
import Path from './path.mjs'
import Point from './point.mjs'
import { XrayPath } from './path.mjs'
import { XrayPoint } from './point.mjs'
import { useTranslation } from 'next-i18next'
const types = {
paths: Path,
points: Point,
paths: XrayPath,
points: XrayPoint,
}
export const XrayList = (props) => {
@ -131,7 +131,7 @@ export const XrayList = (props) => {
<Chevron />
</Summary>
{type === 'paths' && (
<Path
<XrayPath
pathName={id}
partName={props.partName}
draft={props.draft}
@ -140,7 +140,7 @@ export const XrayList = (props) => {
/>
)}
{type === 'points' && (
<Point
<XrayPoint
pointName={id}
partName={props.partName}
draft={props.draft}

View file

@ -1,8 +1,8 @@
import { Chevron } from 'shared/components/navigation/primary'
import { Ul, Li, Details, Summary, SumDiv, NoSumDiv, Deg } from 'shared/components/workbench/menu'
import Point from './point'
import { XrayPoint } from './point'
const MoveLine = ({ op }) => <Point point={op.to} />
const MoveLine = ({ op }) => <XrayPoint point={op.to} />
const Curve = ({ op }) =>
['cp1', 'cp2', 'to'].map((pnt) => (
<Li key={pnt}>
@ -14,7 +14,7 @@ const Curve = ({ op }) =>
</SumDiv>
<Chevron />
</Summary>
<Point point={op[pnt]} />
<XrayPoint point={op[pnt]} />
</Details>
</Li>
))

View file

@ -1,7 +1,7 @@
import { Ul, Li, NoSumDiv, Deg } from 'shared/components/workbench/menu/index.mjs'
import { formatMm } from 'shared/utils.mjs'
import Attributes from './attributes.mjs'
import Ops from './path-ops.mjs'
import { XrayAttributes } from './attributes.mjs'
import { XrayPathOps } from './path-ops.mjs'
export const XrayPath = ({ pathName, partName, draft, units }) => {
const path = draft?.parts?.[partName]?.paths?.[pathName]
@ -9,7 +9,7 @@ export const XrayPath = ({ pathName, partName, draft, units }) => {
if (!path) return null
return (
<Ul>
<Attributes attr={path.attributes} />
<XrayAttributes attr={path.attributes} />
<Li>
<NoSumDiv>
<Deg />
@ -28,7 +28,7 @@ export const XrayPath = ({ pathName, partName, draft, units }) => {
/>
</NoSumDiv>
</Li>
<Ops ops={path.ops} />
<XrayPathOps ops={path.ops} />
</Ul>
)
}

View file

@ -1,6 +1,6 @@
import { Ul, Li, NoSumDiv, Deg } from 'shared/components/workbench/menu'
import { round } from 'shared/utils'
import Attributes from './attributes'
import { XrayAttributes } from './attributes'
export const XrayPoint = ({ pointName, partName, draft, t }) => {
const point = draft?.parts?.[partName]?.points?.[pointName]
@ -16,7 +16,7 @@ export const XrayPoint = ({ pointName, partName, draft, t }) => {
</NoSumDiv>
</Li>
))}
<Attributes attr={point.attributes} t={t} />
<XrayAttributes attr={point.attributes} t={t} />
</Ul>
) : null
}

View file

@ -1,7 +1,7 @@
import { useTranslation } from 'next-i18next'
import { svgattrPlugin } from '@freesewing/plugin-svgattr'
import { SvgWrapper } from './draft/svg.mjs'
import { Error } from './draft/error.mjs'
import { DraftError } from './draft/error.mjs'
export const LabSample = ({ gist, draft, updateGist, unsetGist, showInfo, app, feedback }) => {
const { t } = useTranslation(['workbench'])
@ -32,7 +32,7 @@ export const LabSample = ({ gist, draft, updateGist, unsetGist, showInfo, app, f
<>
<h2>{title}</h2>
{!patternProps || errors.length > 0 ? (
<Error {...{ draft, patternProps, updateGist, errors }} />
<DraftError {...{ draft, patternProps, updateGist, errors }} />
) : null}
<SvgWrapper
{...{ draft, patternProps, gist, updateGist, unsetGist, showInfo, app, feedback }}

View file

@ -17,13 +17,13 @@ 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 { PrintingLayout } from 'shared/components/workbench/layout/print/index.mjs'
import { PrintLayout } from 'shared/components/workbench/layout/print/index.mjs'
const views = {
measurements: WorkbenchMeasurements,
draft: LabDraft,
test: LabSample,
printingLayout: PrintingLayout,
printingLayout: PrintLayout,
cuttingLayout: CutLayout,
export: ExportDraft,
logs: DraftLogs,