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',
|
||||
cset: 'curatedSet',
|
||||
}
|
||||
|
||||
//fallback for bad inputs
|
||||
if (!Object.prototype.hasOwnProperty.call(method, type)) {
|
||||
type = 'cset'
|
||||
id = 1
|
||||
}
|
||||
|
||||
const result = await method[type](id)
|
||||
if (result.success) return result.data[key[type]]
|
||||
else return false
|
||||
|
|
|
@ -4,10 +4,10 @@ import { pluginBundle } from '@freesewing/plugin-bundle'
|
|||
import { pluginFlip } from '@freesewing/plugin-flip'
|
||||
import { pluginGore } from '@freesewing/plugin-gore'
|
||||
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 { Stack } from '../workbench/pattern/stack'
|
||||
import { useState, useEffect } from 'react'
|
||||
// import { useState } from 'react'
|
||||
import yaml from 'js-yaml'
|
||||
|
||||
// Get code from children
|
||||
|
@ -24,13 +24,11 @@ export const asText = (reactEl) => {
|
|||
// The actual example
|
||||
export const Example = ({
|
||||
patternProps,
|
||||
tutorial,
|
||||
paperless,
|
||||
settings,
|
||||
showInfo,
|
||||
xray = false,
|
||||
// settings,
|
||||
// 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)
|
||||
return (
|
||||
|
@ -131,10 +129,10 @@ export const TabbedExample = ({
|
|||
<Tabs tabs="Code, Preview, X-Ray">
|
||||
<Tab key="code">{children}</Tab>
|
||||
<Tab key="preview">
|
||||
<Example {...{ patternProps, tutorial, paperless, settings }} />
|
||||
<Example {...{ patternProps, settings }} />
|
||||
</Tab>
|
||||
<Tab key="xray">
|
||||
<Example {...{ patternProps, tutorial, paperless, settings }} xray={true} />
|
||||
<Example {...{ patternProps, settings }} xray={true} />
|
||||
</Tab>
|
||||
</Tabs>
|
||||
{caption && (
|
||||
|
@ -149,11 +147,11 @@ export const TabbedExample = ({
|
|||
<div className="my-8">
|
||||
<Tabs tabs="Preview, Code, X-Ray">
|
||||
<Tab key="preview">
|
||||
<Example {...{ patternProps, tutorial, paperless, settings }} />
|
||||
<Example {...{ patternProps, settings }} />
|
||||
</Tab>
|
||||
<Tab key="code">{children}</Tab>
|
||||
<Tab key="xray">
|
||||
<Example {...{ patternProps, tutorial, paperless, settings }} xray={true} />
|
||||
<Example {...{ patternProps, settings }} xray={true} />
|
||||
</Tab>
|
||||
</Tabs>
|
||||
{caption && (
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import Link from 'next/link'
|
||||
|
||||
export const Tag = ({
|
||||
className = '',
|
||||
color = 'primary',
|
||||
|
@ -7,12 +9,12 @@ export const Tag = ({
|
|||
onClick = null,
|
||||
}) => {
|
||||
const badge = (
|
||||
<badge
|
||||
<span
|
||||
className={`badge badge-${color} uppercase font-medium mr-1 hover:cursor-pointer hover:badge-${hoverColor} ${className}`}
|
||||
onClick={onClick}
|
||||
>
|
||||
{children}
|
||||
</badge>
|
||||
</span>
|
||||
)
|
||||
|
||||
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 { 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 = {
|
||||
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)
|
||||
|
||||
return (
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
// Dependencies
|
||||
import { forwardRef, useContext } from 'react'
|
||||
import { forwardRef } from 'react'
|
||||
// Hooks
|
||||
import { useTranslation } from 'next-i18next'
|
||||
// Context
|
||||
import { ModalContext } from 'shared/context/modal-context.mjs'
|
||||
// Components
|
||||
import { SizeMe } from 'react-sizeme'
|
||||
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
|
||||
*/
|
||||
export const PanZoomPattern = forwardRef((props, ref) => {
|
||||
const { setModal } = useContext(ModalContext)
|
||||
const { t } = useTranslation(ns)
|
||||
|
||||
const { renderProps = false, components = {}, update, settings, ui } = props
|
||||
const { renderProps = false, components = {} } = props
|
||||
|
||||
if (!renderProps) return null
|
||||
|
||||
const showInfo = (evt, info = null) => {
|
||||
evt.stopPropagation()
|
||||
setModal(
|
||||
<ModalWrapper>
|
||||
<div className="max-w-prose">{info}</div>
|
||||
</ModalWrapper>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<SizeMe refreshRate={64}>
|
||||
{({ size }) => (
|
||||
|
@ -66,3 +55,5 @@ export const PanZoomPattern = forwardRef((props, ref) => {
|
|||
</SizeMe>
|
||||
)
|
||||
})
|
||||
|
||||
PanZoomPattern.displayName = 'PanZoomPattern'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue