// Dependencies import orderBy from 'lodash.orderby' import { measurements } from 'site/prebuild/design-measurements.mjs' // Hooks import { useState, useEffect } from 'react' import { useTranslation } from 'next-i18next' import { useAccount } from 'shared/hooks/use-account.mjs' import { useBackend } from 'shared/hooks/use-backend.mjs' // Components import { SetCandidate, ns as setNs } from 'shared/components/sets/set-candidate.mjs' export const ns = setNs export const SetPicker = ({ design }) => { // Hooks const { account, token } = useAccount() const backend = useBackend(token) const { t } = useTranslation('sets') // State const [sets, setSets] = useState({}) const [list, setList] = useState([]) // Effects useEffect(() => { const getSets = async () => { const result = await backend.getSets() if (result.success) { const all = {} for (const set of result.data.sets) all[set.id] = set setSets(all) } } getSets() }, []) // Need to sort designs by their translated title const translated = {} for (const d of list) translated[t(`${d}.t`)] = d return ( <>

Please choose a set of measurements

FreeSewing generates made-to-measure sewing patterns. You need to pick a measurements set to generate a pattern for.

{Object.keys(sets).length > 0 ? (
{orderBy(sets, ['name'], ['asc']).map((set) => (
))}
) : (

no measies

)} ) }