import { formatMm, formatPercentage } from 'shared/utils.mjs' export const PctOptionValue = ({ name, config, current, settings }) => { const val = typeof current === 'undefined' ? config.pct / 100 : current return ( {formatPercentage(val)} {config?.toAbs && settings.measurements ? ` | ${formatMm(config.toAbs(val, settings))}` : null} ) } export const BoolOptionValue = ({ name, config, current, t }) => { const dflt = config.bool current = current === undefined ? dflt : current return ( {current ? t('yes') : t('no')} ) } export const CountOptionValue = ({ name, config, current }) => config.count == current || typeof current === 'undefined' ? ( {config.count} ) : ( {current} ) export const ListOptionValue = ({ name, config, current, t }) => { const translate = config.doNotTranslate ? (input) => input : (input) => t(`${option}.o.${input}`) return config.dflt == current || typeof current === 'undefined' ? ( {translate(config.dflt)} ) : ( {translate(current)} ) } export const DegOptionValue = ({ name, config, current }) => config.deg == current || typeof current === 'undefined' ? ( {config.deg}° ) : ( {current}° ) export const MmOptionValue = () => ( FIXME: No MmOptionvalue implemented ) export const ConstantOptionValue = () => ( FIXME: No ConstantOptionvalue implemented )