import React, {useMemo} from 'react'
import MeasurementInput from '../inputs/measurement.js'
import { withBreasts, withoutBreasts } from '@freesewing/models'
import nonHuman from './non-human.js'
import WithBreastsIcon from 'shared/components/icons/with-breasts.js'
import WithoutBreastsIcon from 'shared/components/icons/without-breasts.js'
import { useTranslation } from 'next-i18next'
import Setting from '../menu/core-settings/setting';
import {settings} from '../menu/core-settings/index';
const groups = {
people: {
with: withBreasts,
without: withoutBreasts,
},
dolls: {
with: nonHuman.withBreasts.dolls,
without: nonHuman.withoutBreasts.dolls,
},
giants: {
with: nonHuman.withBreasts.giants,
without: nonHuman.withoutBreasts.giants,
}
}
const icons = {
with: ,
without: ,
}
const WorkbenchMeasurements = ({ app, design, gist, updateGist }) => {
const { t } = useTranslation(['app', 'cfp'])
// Method to handle measurement updates
const updateMeasurements = (value, m=false) => {
if (m === false) {
// Set all measurements
updateGist('measurements', value)
} else {
// Set one measurement
updateGist(['measurements', m], value)
}
}
// Save us some typing
const inputProps = useMemo(() => ({ app, updateMeasurements, gist }), [app, gist])
return (
{design.config.name}:
{t('measurements')}
{t('cfp:preloadMeasurements')}
{Object.keys(groups).map(group => (
{t(group)}
{Object.keys(icons).map(type => (
{t(`${type}Breasts`)}
{Object.keys(groups[group][type]).map((m) => (
-
))}
))}
))}
{t('cfp:enterMeasurements')}
{design.config.measurements && (
<>
{t('requiredMeasurements')}
{design.config.measurements.map(m => (
))}
>
)}
{design.config.optionalMeasurements && (
<>
{t('optionalMeasurements')}
{design.config.optionalMeasurements.map(m => (
))}
>
)}
)
}
export default WorkbenchMeasurements