1
0
Fork 0

chore (lint)

This commit is contained in:
Enoch Riese 2023-07-26 20:21:18 -06:00
parent 14540a3ad7
commit 05f37dac90
4 changed files with 16 additions and 13 deletions

View file

@ -101,7 +101,6 @@ export const MeasieInput = ({
stopLoading = () => null, stopLoading = () => null,
}) => { }) => {
const isDegree = isDegreeMeasurement(m) const isDegree = isDegreeMeasurement(m)
const factor = isDegree ? 1 : mset.imperial ? 25.4 : 10
const units = mset.imperial ? 'imperial' : 'metric' const units = mset.imperial ? 'imperial' : 'metric'
const [val, setVal] = useState(() => { const [val, setVal] = useState(() => {
const measie = mset.measies?.[m] const measie = mset.measies?.[m]
@ -123,7 +122,7 @@ export const MeasieInput = ({
onUpdate(m, useVal) onUpdate(m, useVal)
} }
}, },
[isDegree, setValid, setVal, onUpdate, units] [isDegree, setValid, setVal, onUpdate, units, m]
) )
const save = async () => { const save = async () => {
@ -139,7 +138,7 @@ export const MeasieInput = ({
stopLoading() stopLoading()
} }
const fraction = (i, base) => update(Math.floor(('' + val).split(/[\s\.]/)[0]) + i / base) const fraction = (i, base) => update(Math.floor(('' + val).split(/[\s.]/)[0]) + i / base)
if (!m) return null if (!m) return null

View file

@ -51,8 +51,6 @@ const DesignOption = ({ config, settings, control, ...rest }) => {
) )
} }
const getDocsPath = (option) =>
`designs/${design}/options${option ? '/' + option.toLowerCase() : ''}`
/** /**
* The design options menu * The design options menu
* @param {String} options.design the name of the design * @param {String} options.design the name of the design
@ -80,6 +78,12 @@ export const DesignOptions = ({
[update] [update]
) )
// FIXME How do we find inherited docs?
const getDocsPath = useCallback(
(option) => `designs/${design}/options${option ? '/' + option.toLowerCase() : ''}`,
[design]
)
return ( return (
<WorkbenchMenu <WorkbenchMenu
{...{ {...{

View file

@ -20,8 +20,8 @@ import debounce from 'lodash.debounce'
/** Regex to validate that an input is a number */ /** Regex to validate that an input is a number */
const numberInputMatchers = { const numberInputMatchers = {
0: /^\-?[0-9]*[.,eE]?[0-9]+$/, // match a single decimal separator 0: /^-?[0-9]*[.,eE]?[0-9]+$/, // match a single decimal separator
1: /^\-?[0-9]*(\s?[0-9]+\/|[.,eE])?[0-9]+$/, // match a single decimal separator or fraction 1: /^-?[0-9]*(\s?[0-9]+\/|[.,eE])?[0-9]+$/, // match a single decimal separator or fraction
} }
/** /**
@ -132,11 +132,12 @@ export const NumberInput = ({
/** A component that shows a number input to edit a value */ /** A component that shows a number input to edit a value */
const EditCount = (props) => { const EditCount = (props) => {
const { handleChange } = props
const onUpdate = useCallback( const onUpdate = useCallback(
(validVal) => { (validVal) => {
if (validVal !== null && validVal !== false) props.handleChange(validVal) if (validVal !== null && validVal !== false) handleChange(validVal)
}, },
[props.handleChange] [handleChange]
) )
return ( return (
@ -422,11 +423,12 @@ export const PctInput = ({ current, changed, updateFunc, config, ...rest }) => {
/** A {@see SliderInput} to handle degree values */ /** A {@see SliderInput} to handle degree values */
export const DegInput = (props) => { export const DegInput = (props) => {
const { updateFunc } = props
const degUpdateFunc = useCallback( const degUpdateFunc = useCallback(
(path, newVal) => { (path, newVal) => {
props.updateFunc(path, newVal === undefined ? undefined : Number(newVal)) updateFunc(path, newVal === undefined ? undefined : Number(newVal))
}, },
[props.updateFunc] [updateFunc]
) )
return <SliderInput {...props} suffix="°" valFormatter={round} updateFunc={degUpdateFunc} /> return <SliderInput {...props} suffix="°" valFormatter={round} updateFunc={degUpdateFunc} />
} }

View file

@ -204,8 +204,6 @@ export const measurementAsMm = (value, units = 'metric') => {
if (isNaN(decimal)) return false if (isNaN(decimal)) return false
return decimal * 24.5 return decimal * 24.5
} }
return false
} }
export const optionsMenuStructure = (options) => { export const optionsMenuStructure = (options) => {