chore(lab): Changes to handle multisets in core
This commit is contained in:
parent
e163ed1782
commit
f882a26408
18 changed files with 413 additions and 212 deletions
|
@ -1,18 +1,24 @@
|
|||
import SvgWrapper from './draft/svg-wrapper'
|
||||
import Error from './draft/error.js'
|
||||
import { svgattrPlugin } from '@freesewing/plugin-svgattr'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
|
||||
const LabSample = ({ gist, draft }) => {
|
||||
const LabSample = ({ gist, draft, updateGist, unsetGist, showInfo, app, feedback }) => {
|
||||
|
||||
const { t } = useTranslation(['workbench'])
|
||||
let svg
|
||||
let title = ''
|
||||
let patternProps
|
||||
const errors = []
|
||||
if (gist.sample) {
|
||||
try {
|
||||
draft.use(svgattrPlugin, {
|
||||
class: 'freesewing pattern max-h-screen'
|
||||
})
|
||||
draft.sample()
|
||||
svg = draft.render()
|
||||
draft = draft.sample()
|
||||
// Render as React
|
||||
patternProps = draft.getRenderProps()
|
||||
for (const logs of patternProps.logs) errors.push(...logs.error)
|
||||
}
|
||||
catch(err) {
|
||||
console.log(err)
|
||||
|
@ -27,6 +33,12 @@ const LabSample = ({ gist, draft }) => {
|
|||
return (
|
||||
<>
|
||||
<h2>{title}</h2>
|
||||
{!patternProps || errors.length > 0 ? (
|
||||
<Error {...{ draft, patternProps, updateGist }} />
|
||||
) : null}
|
||||
<SvgWrapper
|
||||
{...{ draft, patternProps, gist, updateGist, unsetGist, showInfo, app, feedback }}
|
||||
/>
|
||||
<div className="freesewing pattern" dangerouslySetInnerHTML={{__html: svg}} />
|
||||
</>
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue