chore(lab): Changes for pattern data
This commit is contained in:
parent
d6cc541da3
commit
13e32d9ed9
10 changed files with 18 additions and 18 deletions
|
@ -57,8 +57,8 @@ const TextSpans = ({ point, className='', style={}, onClick=null }) => {
|
||||||
let text = []
|
let text = []
|
||||||
// Handle translation
|
// Handle translation
|
||||||
let translated = ''
|
let translated = ''
|
||||||
for (let string of point.attributes.getAsArray('data-text')) {
|
for (const string of point.attributes.getAsArray('data-text')) {
|
||||||
translated += t(string.toString()).replace(/"/g, '"') + ' '
|
if (string) translated += t(string.toString()).replace(/"/g, '"') + ' '
|
||||||
}
|
}
|
||||||
// Handle muti-line text
|
// Handle muti-line text
|
||||||
if (translated.indexOf('\n') !== -1) {
|
if (translated.indexOf('\n') !== -1) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import ClearIcon from 'shared/components/icons/clear.js'
|
||||||
import { useTranslation } from 'next-i18next'
|
import { useTranslation } from 'next-i18next'
|
||||||
|
|
||||||
const DesignOptionList = props => {
|
const DesignOptionList = props => {
|
||||||
const { t } = useTranslation([`o_${props.design.config.name}`])
|
const { t } = useTranslation([`o_${props.design.config.data.name}`])
|
||||||
const { dflt, list, doNotTranslate=false } = props.design.config.options[props.option]
|
const { dflt, list, doNotTranslate=false } = props.design.config.options[props.option]
|
||||||
const val = (typeof props.gist?.options?.[props.option] === 'undefined')
|
const val = (typeof props.gist?.options?.[props.option] === 'undefined')
|
||||||
? dflt
|
? dflt
|
||||||
|
@ -48,7 +48,7 @@ const DesignOptionList = props => {
|
||||||
</span>
|
</span>
|
||||||
{doNotTranslate
|
{doNotTranslate
|
||||||
? choice
|
? choice
|
||||||
: props.ot(`o_${props.design.config.name}:${props.option}.o.${choice}`)
|
: props.ot(`o_${props.design.config.data.name}:${props.option}.o.${choice}`)
|
||||||
}
|
}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
|
|
|
@ -8,7 +8,7 @@ const CutLayout = props => {
|
||||||
<div>
|
<div>
|
||||||
<h2 className="capitalize">
|
<h2 className="capitalize">
|
||||||
{
|
{
|
||||||
t('layoutThing', { thing: props.design.config.name })
|
t('layoutThing', { thing: props.design.config.data.name })
|
||||||
+ ': '
|
+ ': '
|
||||||
+ t('forCutting')
|
+ t('forCutting')
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ const PrintLayout = props => {
|
||||||
<div>
|
<div>
|
||||||
<h2 className="capitalize">
|
<h2 className="capitalize">
|
||||||
{
|
{
|
||||||
t('layoutThing', { thing: props.design.config.name })
|
t('layoutThing', { thing: props.design.config.data.name })
|
||||||
+ ': '
|
+ ': '
|
||||||
+ t('forPrinting')
|
+ t('forPrinting')
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ const WorkbenchMeasurements = ({ app, design, gist, updateGist, gistReady }) =>
|
||||||
<div className="m-auto max-w-2xl">
|
<div className="m-auto max-w-2xl">
|
||||||
<h1>
|
<h1>
|
||||||
<span className='capitalize mr-4 opacity-70'>
|
<span className='capitalize mr-4 opacity-70'>
|
||||||
{design.config.name}:
|
{design.config.data.name}:
|
||||||
</span> {t('measurements')}
|
</span> {t('measurements')}
|
||||||
</h1>
|
</h1>
|
||||||
<h2>{t('cfp:preloadMeasurements')}</h2>
|
<h2>{t('cfp:preloadMeasurements')}</h2>
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {values} from 'shared/components/workbench/menu/design-options/option-val
|
||||||
import {inputs} from 'shared/components/workbench/menu/design-options/option-input'
|
import {inputs} from 'shared/components/workbench/menu/design-options/option-input'
|
||||||
|
|
||||||
const Option = props => {
|
const Option = props => {
|
||||||
const { t } = useTranslation([`o_${props.design.config.name}`])
|
const { t } = useTranslation([`o_${props.design.config.data.name}`])
|
||||||
const opt = props.design.config.options[props.option];
|
const opt = props.design.config.options[props.option];
|
||||||
const type = optionType(opt)
|
const type = optionType(opt)
|
||||||
const Input = inputs[type]
|
const Input = inputs[type]
|
||||||
|
|
|
@ -29,7 +29,7 @@ const SumDiv = (props) => (
|
||||||
)
|
)
|
||||||
|
|
||||||
const Option = props => {
|
const Option = props => {
|
||||||
const { t } = useTranslation([`o_${props.design.config.name}`, 'workbench'])
|
const { t } = useTranslation([`o_${props.design.config.data.name}`, 'workbench'])
|
||||||
const active = (
|
const active = (
|
||||||
props.gist.sample?.type === 'option' &&
|
props.gist.sample?.type === 'option' &&
|
||||||
props.gist.sample?.option === props.option
|
props.gist.sample?.option === props.option
|
||||||
|
@ -56,7 +56,7 @@ const Option = props => {
|
||||||
{active ? <span>•</span> : <span>°</span>}
|
{active ? <span>•</span> : <span>°</span>}
|
||||||
</span>
|
</span>
|
||||||
<span className={active ? 'text-secondary font-bold' : ''}>
|
<span className={active ? 'text-secondary font-bold' : ''}>
|
||||||
{t(`o_${props.design.config.name}:${props.option}.t`)}
|
{t(`o_${props.design.config.data.name}:${props.option}.t`)}
|
||||||
</span>
|
</span>
|
||||||
</SumDiv>
|
</SumDiv>
|
||||||
</SumButton>
|
</SumButton>
|
||||||
|
|
|
@ -13,29 +13,29 @@ const View = props => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'draft',
|
name: 'draft',
|
||||||
title: t('draftDesign', { design: props.design.config.name }),
|
title: t('draftDesign', { design: props.design.config.data.name }),
|
||||||
onClick: () => props.updateGist(['_state', 'view'], 'draft', true)
|
onClick: () => props.updateGist(['_state', 'view'], 'draft', true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'test',
|
||||||
title: t('testDesign', { design: props.design.config.name }),
|
title: t('testDesign', { design: props.design.config.data.name }),
|
||||||
onClick: () => props.updateGist(['_state', 'view'], 'test', true)
|
onClick: () => props.updateGist(['_state', 'view'], 'test', true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'printingLayout',
|
name: 'printingLayout',
|
||||||
title: t('layoutThing', { thing: props.design.config.name })
|
title: t('layoutThing', { thing: props.design.config.data.name })
|
||||||
+ ': ' + t('forPrinting'),
|
+ ': ' + t('forPrinting'),
|
||||||
onClick: () => props.updateGist(['_state', 'view'], 'printingLayout', true)
|
onClick: () => props.updateGist(['_state', 'view'], 'printingLayout', true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cuttingLayout',
|
name: 'cuttingLayout',
|
||||||
title: t('layoutThing', { thing: props.design.config.name })
|
title: t('layoutThing', { thing: props.design.config.data.name })
|
||||||
+ ': ' + t('forCutting'),
|
+ ': ' + t('forCutting'),
|
||||||
onClick: () => props.updateGist(['_state', 'view'], 'cuttingLayout', true)
|
onClick: () => props.updateGist(['_state', 'view'], 'cuttingLayout', true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'export',
|
name: 'export',
|
||||||
title: t('exportThing', { thing: props.design.config.name }),
|
title: t('exportThing', { thing: props.design.config.data.name }),
|
||||||
onClick: () => props.updateGist(['_state', 'view'], 'export', true)
|
onClick: () => props.updateGist(['_state', 'view'], 'export', true)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,8 +15,8 @@ const preload = {
|
||||||
if (result.data.files['pattern.yaml'].content) {
|
if (result.data.files['pattern.yaml'].content) {
|
||||||
let g = yaml.load(result.data.files['pattern.yaml'].content)
|
let g = yaml.load(result.data.files['pattern.yaml'].content)
|
||||||
|
|
||||||
if (g.design !== undefined && g.design !== design.config.name) return [
|
if (g.design !== undefined && g.design !== design.config.data.name) return [
|
||||||
false, `You tried loading a configuration for ${g.design} into a ${design.config.name} development environment`
|
false, `You tried loading a configuration for ${g.design} into a ${design.config.data.name} development environment`
|
||||||
]
|
]
|
||||||
|
|
||||||
return g
|
return g
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {useState} from 'react'
|
||||||
// Generates a default design gist to start from
|
// Generates a default design gist to start from
|
||||||
export const defaultGist = (design, locale='en') => {
|
export const defaultGist = (design, locale='en') => {
|
||||||
const gist = {
|
const gist = {
|
||||||
design: design.config.name,
|
design: design.config.data.name,
|
||||||
version: design.config.version,
|
version: design.config.version,
|
||||||
...defaultSettings,
|
...defaultSettings,
|
||||||
_state: {view: 'draft'}
|
_state: {view: 'draft'}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue