{/* Name is always shown */}
val && val.length > 0}
/>
{/* img: Control level determines whether or not to show this */}
{account.control >= controlConfig.account.sets.img ? (
val.length > 0}
/>
) : null}
{/* public: Control level determines whether or not to show this */}
{account.control >= controlConfig.account.sets.public ? (
Public measurements set
),
desc: 'Others are allowed to use these measurements to generate or test patterns',
},
{
val: false,
label: (
Private measurements set
),
desc: 'These measurements cannot be used by other users or visitors',
},
]}
current={isPublic}
/>
) : null}
{/* units: Control level determines whether or not to show this */}
{account.control >= controlConfig.account.sets.units ? (
<>
Metric units (cm)cm
),
desc: 'Pick this if you prefer cm over inches',
},
{
val: true,
label: (
Imperial units (inch)″
),
desc: 'Pick this if you prefer inches over cm',
},
]}
current={imperial}
/>
Note: You must save after changing Units to have the change take effect on this page.
>
) : null}
{/* notes: Control level determines whether or not to show this */}
{account.control >= controlConfig.account.sets.notes ? (
) : null}
)
}
/*
* A (helper) component to display a measurements value
*
* @component
* @param {object} props - All React props
* @param {string} val - The value
* @param {string} m - The measurement name
* @param {bool} imperial - True for imperial measurements, or metric by default
*/
const MeasurementValue = ({ val, m, imperial = false }) =>
isDegreeMeasurement(m) ? (
{val}°
) : (
)
/*
* React component to suggest a measurements set for curation
*
* @component
* @param {object} props - All React props
* @param {string} mset - The measurements set
*/
const SuggestCset = ({ mset, Link }) => {
// State
const [height, setHeight] = useState('')
const [img, setImg] = useState('')
const [name, setName] = useState('')
const [notes, setNotes] = useState('')
const [submission, setSubmission] = useState(false)
// Context
const { setLoadingStatus } = useContext(LoadingStatusContext)
// Hooks
const backend = useBackend()
// Method to submit the form
const suggestSet = async () => {
setLoadingStatus([true, 'Contacting backend'])
const result = await backend.suggestCset({ set: mset.id, height, img, name, notes })
if (result.success && result.data.submission) {
setSubmission(result.data.submission)
setLoadingStatus([true, 'Nailed it', true, true])
} else setLoadingStatus([true, 'An unexpected error occured. Please report this.', true, false])
}
const missing = []
for (const m of measurements) {
if (typeof mset.measies[m] === 'undefined') missing.push(m)
}
if (submission) {
const url = `/curate/sets/suggested/${submission.id}`
return (
<>
Thank you
Your submission has been registered and will be processed by one of our curators.
It is available at: {url}
>
)
}
return (
<>
Suggest a measurements set for curation
{missing.length > 0 ? : }
Measurements
{missing.length > 0 ? (
<>
To ensure curated measurements sets work for all designs, you need to provide a full set
of measurements.
Your measurements set is missing the following measurements:
{missing.map((m) => (
{m}
))}
>
) : (
All measurements are available.
)}
{name.length > 1 ? : }
Name
Each curated set has a name. You can suggest your own name or a pseudonym.
val.length > 1} />
{height.length > 1 ? : }
Height
To allow organizing and presenting our curated sets in a structured way, we organize them by
height.
val.length > 1}
/>
{img.length > 0 ? : }
Image
Finally, we need a picture. Please refer to the documentation to see what makes a good
picture for a curated measurements set.
Documentation
val.length > 1}
/>
Notes
If you would like to add any notes, you can do so here.
This field supports markdown
true} />
>
)
}
/*
* React component to render a preview of a measurement set using the bonny pattern
*
* @component
* @param {object} props - All React props
* @param {string} mset - The measurements set
*/
const RenderedCset = ({ mset, imperial }) => {
const [previewVisible, setPreviewVisible] = useState(false)
const missing = []
for (const m of measurements) {
if (typeof mset.measies[m] === 'undefined') missing.push(m)
}
if (missing.length > 0)
return (
<>
Validation messages
To validate and preview a measurement set, all measurements need to be entered.
Your measurements set is missing the following measurements:
This feature creates a visual preview of your body based on your measurements.
It’s meant to help you spot possible mistakes and better understand how the software
sees your measurements, but keep in mind:
The preview is a simple line drawing, but it does include features like chest shape
and crotch placement. If that feels uncomfortable, you may prefer to skip using this
tool.
This preview is an approximation, not an exact representation. Bodies
have many variations that can't be captured with just a few measurements. We are
missing some information, like how weight is distributed or your posture.
If something looks off, it{' '}
doesn’t necessarily mean your measurements are wrong, but it might be
worth double-checking. Sometimes, differences come from how the preview is generated
rather than an error in measuring.
Just like this preview, some sewing patterns may need to assume certain body
proportions. If this preview looks different from what you expect, some patterns may
also need adjustment, to get a perfect fit.
>
)}
>
)
}
/**
* A component to create a new measurements set.
*
* @component
* @returns {JSX.Element}
*/
export const NewSet = () => {
// Hooks
const backend = useBackend()
const { account } = useAccount()
const { setLoadingStatus } = useContext(LoadingStatusContext)
// State
const [name, setName] = useState('')
// Use account setting for imperial
const imperial = account.imperial
// Helper method to create a new set
const createSet = async () => {
setLoadingStatus([true, 'Storing new measurements set'])
const [status, body] = await backend.createSet({ name, imperial })
if (status === 201 && body.result === 'created') {
setLoadingStatus([true, 'Nailed it', true, true])
window.location = `/account/data/sets/set?id=${body.set.id}`
} else
setLoadingStatus([
true,
'Failed to save the measurments set. Please report this.',
true,
false,
])
}
return (
Name
Give this set of measurements a name. That will help tell them apart.
val && val.length > 0}
placeholder={'Georg Cantor'}
/>