import { useTranslation } from 'next-i18next' import { formatMm, formatPercentage } from 'shared/utils.mjs' export const values = { Pct: (props) => { const val = typeof props.gist?.options?.[props.option] === 'undefined' ? props.design.patternConfig.options[props.option].pct / 100 : props.gist.options[props.option] return ( {formatPercentage(val)} {props.design.patternConfig.options[props.option]?.toAbs && props.gist.measurements ? ' | ' + formatMm(props.design.patternConfig.options[props.option]?.toAbs(val, props.gist)) : null} ) }, Bool: (props) => { const { t } = useTranslation(['app']) const dflt = props.design.patternConfig.options[props.option].bool let current = props.gist?.options?.[props.option] current = current === undefined ? dflt : current return ( {current ? t('yes') : t('no')} ) }, Count: (props) => { const dflt = props.design.patternConfig.options[props.option].count const current = props.gist?.options?.[props.option] return dflt == current || typeof current === 'undefined' ? ( {dflt} ) : ( {current} ) }, List: (props) => { const dflt = props.design.patternConfig.options[props.option].dflt const current = props.gist?.options?.[props.option] const prefix = `${props.option}.o.` const translate = props.design.patternConfig.options[props.option]?.doNotTranslate ? (input) => input : (input) => props.t(prefix + input) return dflt == current || typeof current === 'undefined' ? ( {translate(dflt)} ) : ( {translate(current)} ) }, Deg: (props) => { const dflt = props.design.patternConfig.options[props.option].deg const current = props.gist?.options?.[props.option] return dflt == current || typeof current === 'undefined' ? ( {dflt}° ) : ( {current}° ) }, Mm: () => { return

No mm val yet

}, Constant: () => { return

No constant val yet

}, }