1
0
Fork 0

fixing little issues

This commit is contained in:
Enoch Riese 2022-07-05 18:37:29 -05:00
parent 18abd0351a
commit b047cb0e1f
6 changed files with 11 additions and 9 deletions

View file

@ -1,7 +1,7 @@
import designsByType from './designs.json' import designsByType from './designs.json' assert { type: 'json' }
import packages from './packages.json' import packages from './packages.json' assert { type: 'json' }
import plugins from './plugins.json' import plugins from './plugins.json' assert { type: 'json' }
import sites from './sites.json' import sites from './sites.json' assert { type: 'json' }
// Helper method to construct summary objects // Helper method to construct summary objects
const unpack = (obj, folder) => Object.fromEntries( const unpack = (obj, folder) => Object.fromEntries(

View file

@ -38,7 +38,7 @@ const SvgWrapper = props => {
<div style={{ width: size.width+'px', }}> <div style={{ width: size.width+'px', }}>
<Svg {...patternProps} embed={gist.embed}> <Svg {...patternProps} embed={gist.embed}>
<Defs {...patternProps} /> <Defs {...patternProps} />
<style>{`:root { --pattern-scale: ${gist.scale || 1}}`}</style> <style>{`:root { --pattern-scale: ${gist.scale || 1}} ${patternProps.svg.style}`}</style>
<g> <g>
{Object.keys(patternProps.parts).map((name) => ( {Object.keys(patternProps.parts).map((name) => (
<Part {...{ app, gist, updateGist, unsetGist, showInfo }} <Part {...{ app, gist, updateGist, unsetGist, showInfo }}

View file

@ -92,7 +92,7 @@ const DesignOptionPctDeg = props => {
/> />
<div className="flex flex-row justify-between"> <div className="flex flex-row justify-between">
<span className={val===dflt ? 'text-secondary' : 'text-accent'}> <span className={val===dflt ? 'text-secondary' : 'text-accent'}>
{props.design.config.options[props.option]?.toAbs {props.design.config.options[props.option]?.toAbs && props.gist.measurements
? formatMm(props.design.config.options[props.option].toAbs(value/100, props.gist)) ? formatMm(props.design.config.options[props.option].toAbs(value/100, props.gist))
: ' ' : ' '
} }

View file

@ -13,7 +13,7 @@ export const values = {
: 'text-accent' : 'text-accent'
}> }>
{formatPercentage(val)} {formatPercentage(val)}
{props.design.config.options[props.option]?.toAbs {props.design.config.options[props.option]?.toAbs && props.gist.measurements
? ' | ' +formatMm(props.design.config.options[props.option]?.toAbs(val, props.gist)) ? ' | ' +formatMm(props.design.config.options[props.option]?.toAbs(val, props.gist))
: null : null
} }

View file

@ -11,9 +11,9 @@ const Option = props => {
const type = optionType(opt) const type = optionType(opt)
const Input = inputs[type] const Input = inputs[type]
const Value = values[type] const Value = values[type]
const hide = opt.hide && opt.hide(props.draft.settings); const hide = opt.hide && opt.hide(props.draft.settings.options);
if (hide) return <Li></Li> if (hide) return null
if (type === 'bool') { if (type === 'bool') {
const toggleBoolean = () => { const toggleBoolean = () => {

View file

@ -32,6 +32,8 @@ const views = {
} }
const hasRequiredMeasurementsMethod = (design, gist) => { const hasRequiredMeasurementsMethod = (design, gist) => {
if (design.config.measurements.length && !gist.measurements) return false
for (const m of design.config.measurements || []) { for (const m of design.config.measurements || []) {
if (!gist?.measurements?.[m]) return false if (!gist?.measurements?.[m]) return false
} }