Skip to content

Commit

Permalink
Set mix and delay max range, fix touchtip copy
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Aug 7, 2024
1 parent 3b310dc commit 69d5d3e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,19 @@ export function Delay(props: DelayProps): JSX.Element {
})
: null

// allow a maximum of 10 digits for delay duration
const durationRange = { min: 1, max: 9999999999 }
const durationError =
delayDuration != null &&
(delayDuration < durationRange.min || delayDuration > durationRange.max)
? t(`value_out_of_range`, {
min: durationRange.min,
max: durationRange.max,
})
: null
let buttonIsDisabled = false
if (currentStep === 2) {
buttonIsDisabled = delayDuration == null
buttonIsDisabled = delayDuration == null || durationError != null
} else if (currentStep === 3) {
buttonIsDisabled = positionError != null || position == null
}
Expand Down Expand Up @@ -199,6 +209,7 @@ export function Delay(props: DelayProps): JSX.Element {
<InputField
type="number"
value={delayDuration}
error={durationError}
title={t('delay_duration_s')}
readOnly
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,21 @@ export function Mix(props: MixProps): JSX.Element {
})
: null

const repititionRange = { min: 1, max: 999 }
const repititionError =
mixReps != null &&
(mixReps < repititionRange.min || mixReps > repititionRange.max)
? t(`value_out_of_range`, {
min: repititionRange.min,
max: repititionRange.max,
})
: null

let buttonIsDisabled = false
if (currentStep === 2) {
buttonIsDisabled = mixVolume == null || volumeError != null
} else if (currentStep === 3) {
buttonIsDisabled = mixReps == null
buttonIsDisabled = mixReps == null || repititionError != null
}

return createPortal(
Expand Down Expand Up @@ -219,6 +229,7 @@ export function Mix(props: MixProps): JSX.Element {
<InputField
type="number"
value={mixReps}
error={repititionError}
title={t('mix_repetitions')}
readOnly
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export function TouchTip(props: TouchTipProps): JSX.Element {
<InputField
type="number"
value={position}
title={t('delay_position_mm')}
title={t('touch_tip_position_mm')}
error={positionError}
readOnly
/>
Expand Down

0 comments on commit 69d5d3e

Please sign in to comment.