lint fixes
This commit is contained in:
parent
9109f631d3
commit
6f28c36c59
6 changed files with 37 additions and 29 deletions
|
@ -25,6 +25,13 @@ const loadMeasurements = async ({ type, id, backend }) => {
|
||||||
set: 'set',
|
set: 'set',
|
||||||
cset: 'curatedSet',
|
cset: 'curatedSet',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//fallback for bad inputs
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(method, type)) {
|
||||||
|
type = 'cset'
|
||||||
|
id = 1
|
||||||
|
}
|
||||||
|
|
||||||
const result = await method[type](id)
|
const result = await method[type](id)
|
||||||
if (result.success) return result.data[key[type]]
|
if (result.success) return result.data[key[type]]
|
||||||
else return false
|
else return false
|
||||||
|
|
|
@ -4,10 +4,10 @@ import { pluginBundle } from '@freesewing/plugin-bundle'
|
||||||
import { pluginFlip } from '@freesewing/plugin-flip'
|
import { pluginFlip } from '@freesewing/plugin-flip'
|
||||||
import { pluginGore } from '@freesewing/plugin-gore'
|
import { pluginGore } from '@freesewing/plugin-gore'
|
||||||
import { Design } from '@freesewing/core'
|
import { Design } from '@freesewing/core'
|
||||||
import { Svg } from 'pkgs/react-components/src/index.mjs'
|
// import { Svg } from 'pkgs/react-components/src/index.mjs'
|
||||||
//import { Defs } from '../workbench/pattern/defs'
|
//import { Defs } from '../workbench/pattern/defs'
|
||||||
//import { Stack } from '../workbench/pattern/stack'
|
//import { Stack } from '../workbench/pattern/stack'
|
||||||
import { useState, useEffect } from 'react'
|
// import { useState } from 'react'
|
||||||
import yaml from 'js-yaml'
|
import yaml from 'js-yaml'
|
||||||
|
|
||||||
// Get code from children
|
// Get code from children
|
||||||
|
@ -24,13 +24,11 @@ export const asText = (reactEl) => {
|
||||||
// The actual example
|
// The actual example
|
||||||
export const Example = ({
|
export const Example = ({
|
||||||
patternProps,
|
patternProps,
|
||||||
tutorial,
|
// settings,
|
||||||
paperless,
|
// showInfo,
|
||||||
settings,
|
// xray = false,
|
||||||
showInfo,
|
|
||||||
xray = false,
|
|
||||||
}) => {
|
}) => {
|
||||||
const [ui, setUi] = useState({ renderer: 'react', xray: { enabled: xray } })
|
// const [ui, setUi] = useState({ renderer: 'react', xray: { enabled: xray } })
|
||||||
|
|
||||||
if (patternProps.logs.pattern.error.length > 0 || patternProps.logs.sets[0].error.length > 0)
|
if (patternProps.logs.pattern.error.length > 0 || patternProps.logs.sets[0].error.length > 0)
|
||||||
return (
|
return (
|
||||||
|
@ -131,10 +129,10 @@ export const TabbedExample = ({
|
||||||
<Tabs tabs="Code, Preview, X-Ray">
|
<Tabs tabs="Code, Preview, X-Ray">
|
||||||
<Tab key="code">{children}</Tab>
|
<Tab key="code">{children}</Tab>
|
||||||
<Tab key="preview">
|
<Tab key="preview">
|
||||||
<Example {...{ patternProps, tutorial, paperless, settings }} />
|
<Example {...{ patternProps, settings }} />
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab key="xray">
|
<Tab key="xray">
|
||||||
<Example {...{ patternProps, tutorial, paperless, settings }} xray={true} />
|
<Example {...{ patternProps, settings }} xray={true} />
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
{caption && (
|
{caption && (
|
||||||
|
@ -149,11 +147,11 @@ export const TabbedExample = ({
|
||||||
<div className="my-8">
|
<div className="my-8">
|
||||||
<Tabs tabs="Preview, Code, X-Ray">
|
<Tabs tabs="Preview, Code, X-Ray">
|
||||||
<Tab key="preview">
|
<Tab key="preview">
|
||||||
<Example {...{ patternProps, tutorial, paperless, settings }} />
|
<Example {...{ patternProps, settings }} />
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab key="code">{children}</Tab>
|
<Tab key="code">{children}</Tab>
|
||||||
<Tab key="xray">
|
<Tab key="xray">
|
||||||
<Example {...{ patternProps, tutorial, paperless, settings }} xray={true} />
|
<Example {...{ patternProps, settings }} xray={true} />
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
{caption && (
|
{caption && (
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import Link from 'next/link'
|
||||||
|
|
||||||
export const Tag = ({
|
export const Tag = ({
|
||||||
className = '',
|
className = '',
|
||||||
color = 'primary',
|
color = 'primary',
|
||||||
|
@ -7,12 +9,12 @@ export const Tag = ({
|
||||||
onClick = null,
|
onClick = null,
|
||||||
}) => {
|
}) => {
|
||||||
const badge = (
|
const badge = (
|
||||||
<badge
|
<span
|
||||||
className={`badge badge-${color} uppercase font-medium mr-1 hover:cursor-pointer hover:badge-${hoverColor} ${className}`}
|
className={`badge badge-${color} uppercase font-medium mr-1 hover:cursor-pointer hover:badge-${hoverColor} ${className}`}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</badge>
|
</span>
|
||||||
)
|
)
|
||||||
|
|
||||||
return href ? <Link href={href}>{badge}</Link> : badge
|
return href ? <Link href={href}>{badge}</Link> : badge
|
||||||
|
|
|
@ -20,7 +20,17 @@ import { EditView, ns as editNs } from './views/edit/index.mjs'
|
||||||
import { TestView, ns as testNs } from 'shared/components/workbench/views/test/index.mjs'
|
import { TestView, ns as testNs } from 'shared/components/workbench/views/test/index.mjs'
|
||||||
import { ExportView, ns as exportNs } from 'shared/components/workbench/views/exporting/index.mjs'
|
import { ExportView, ns as exportNs } from 'shared/components/workbench/views/exporting/index.mjs'
|
||||||
|
|
||||||
export const ns = ['account', 'workbench', ...draftNs, ...saveNs, ...printNs, ...cutNs, ...testNs]
|
export const ns = [
|
||||||
|
'account',
|
||||||
|
'workbench',
|
||||||
|
...draftNs,
|
||||||
|
...saveNs,
|
||||||
|
...printNs,
|
||||||
|
...cutNs,
|
||||||
|
...editNs,
|
||||||
|
...testNs,
|
||||||
|
...exportNs,
|
||||||
|
]
|
||||||
|
|
||||||
const defaultUi = {
|
const defaultUi = {
|
||||||
renderer: 'react',
|
renderer: 'react',
|
||||||
|
|
|
@ -18,7 +18,7 @@ const UiSetting = ({ name, control, ...rest }) => (
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
export const UiSettings = ({ design, update, settings, ui, control, language, DynamicDocs }) => {
|
export const UiSettings = ({ update, ui, control, language, DynamicDocs }) => {
|
||||||
const settingsConfig = loadSettingsConfig(ui)
|
const settingsConfig = loadSettingsConfig(ui)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
// Dependencies
|
// Dependencies
|
||||||
import { forwardRef, useContext } from 'react'
|
import { forwardRef } from 'react'
|
||||||
// Hooks
|
// Hooks
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
// Context
|
// Context
|
||||||
import { ModalContext } from 'shared/context/modal-context.mjs'
|
|
||||||
// Components
|
// Components
|
||||||
import { SizeMe } from 'react-sizeme'
|
import { SizeMe } from 'react-sizeme'
|
||||||
import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch'
|
import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch'
|
||||||
|
@ -32,22 +31,12 @@ export const ns = ['workbench']
|
||||||
* Also still to see how this will work with SSR
|
* Also still to see how this will work with SSR
|
||||||
*/
|
*/
|
||||||
export const PanZoomPattern = forwardRef((props, ref) => {
|
export const PanZoomPattern = forwardRef((props, ref) => {
|
||||||
const { setModal } = useContext(ModalContext)
|
|
||||||
const { t } = useTranslation(ns)
|
const { t } = useTranslation(ns)
|
||||||
|
|
||||||
const { renderProps = false, components = {}, update, settings, ui } = props
|
const { renderProps = false, components = {} } = props
|
||||||
|
|
||||||
if (!renderProps) return null
|
if (!renderProps) return null
|
||||||
|
|
||||||
const showInfo = (evt, info = null) => {
|
|
||||||
evt.stopPropagation()
|
|
||||||
setModal(
|
|
||||||
<ModalWrapper>
|
|
||||||
<div className="max-w-prose">{info}</div>
|
|
||||||
</ModalWrapper>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SizeMe refreshRate={64}>
|
<SizeMe refreshRate={64}>
|
||||||
{({ size }) => (
|
{({ size }) => (
|
||||||
|
@ -66,3 +55,5 @@ export const PanZoomPattern = forwardRef((props, ref) => {
|
||||||
</SizeMe>
|
</SizeMe>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
PanZoomPattern.displayName = 'PanZoomPattern'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue