From 69d5d3efbdd28f998568de02731270ec09d52bbe Mon Sep 17 00:00:00 2001 From: smb2268 Date: Wed, 7 Aug 2024 14:28:46 -0400 Subject: [PATCH] Set mix and delay max range, fix touchtip copy --- .../QuickTransferAdvancedSettings/Delay.tsx | 13 ++++++++++++- .../QuickTransferAdvancedSettings/Mix.tsx | 13 ++++++++++++- .../QuickTransferAdvancedSettings/TouchTip.tsx | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/Delay.tsx b/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/Delay.tsx index 4b8414addbb6..e6e8a5c707be 100644 --- a/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/Delay.tsx +++ b/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/Delay.tsx @@ -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 } @@ -199,6 +209,7 @@ export function Delay(props: DelayProps): JSX.Element { diff --git a/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/Mix.tsx b/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/Mix.tsx index 46727cb1228e..91c75103d6eb 100644 --- a/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/Mix.tsx +++ b/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/Mix.tsx @@ -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( @@ -219,6 +229,7 @@ export function Mix(props: MixProps): JSX.Element { diff --git a/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/TouchTip.tsx b/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/TouchTip.tsx index 5791ac2813cf..180f88311af4 100644 --- a/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/TouchTip.tsx +++ b/app/src/organisms/QuickTransferFlow/QuickTransferAdvancedSettings/TouchTip.tsx @@ -183,7 +183,7 @@ export function TouchTip(props: TouchTipProps): JSX.Element {