import { Fragment } from 'react' import { ns as optionsNs } from './options.mjs' import { ns as measieNs } from './measurements.mjs' import { Accordion } from 'shared/components/accordion.mjs' import { useTranslation } from 'next-i18next' import { nsMerge } from 'shared/utils.mjs' import { OptionsIcon, MeasieIcon, CommunityIcon } from 'shared/components/icons.mjs' import { ListInput } from 'shared/components/inputs.mjs' import { optionsMenuStructure } from 'shared/utils.mjs' import { V3Wip } from 'shared/components/v3-wip.mjs' export const ns = nsMerge('workbench', optionsNs, measieNs) const flattenOptions = (options, list = false, path = []) => { if (list === false) return flattenOptions(optionsMenuStructure(options), new Set()) for (const [key, option] of Object.entries(options)) { if (key !== 'isGroup') { if (!option.isGroup) list.add({ key, option, path }) else list = flattenOptions(option, list, [...path, key]) } } return list } const spacer = / export const TestMenu = ({ design, patternConfig, settings, update, //language, //account, //DynamicDocs, }) => { const { t } = useTranslation(ns) const allOptions = flattenOptions(patternConfig.options) return (
{t('workbench:testOptions')}

{t('workbench:testOptionsDesc')}

, ({ key: i, label: [ ...option.path.map((p) => ( <> {t(`${p}.t`)} {spacer} )), {t(`${design}:${option.key}.t`)}, ], val: option.key, }))} update={(value) => { if (value) update.settings(['sample'], { type: 'option', option: value }) else update.settings(['sample']) }} current={settings?.sample?.option} />, ], [
{t('workbench:testMeasurements')}

{t('workbench:testOptionsDesc')}

, ({ label: t(m), val: m, }))} update={(value) => { if (value) update.settings(['sample'], { type: 'measurement', measurement: value }) else update.settings(['sample']) }} current={settings?.sample?.measurement} />, ], [
{t('workbench:testSets')}

{t('workbench:testSetsDesc')}

, , ], ]} /> ) }