From 6573b47a1e6462a2306e43c666cabe0b64144578 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Wed, 22 May 2024 10:11:04 +0530 Subject: [PATCH] Max consecutive auto reply values are not properly displayed in the UI (#216) * Don't delete a property if it's used buy someother property * Don't show auto reply button while showing retry chat button * WIP: Show numeric stepper input for max consecutive auto reply * Show numeric stepper input for max consecutive auto reply * Show numeric stepper input for max consecutive auto reply * Update error message --- app/src/client/app/BuildPage.tsx | 2 +- .../client/components/DynamicFormBuilder.tsx | 24 +- .../buildPage/UserPropertyHandler.tsx | 2 +- .../form/NumericStepperWithClearButton.tsx | 59 ++++ app/src/client/hooks/useForm.ts | 13 +- .../NumericStepperWithClearButton.test.tsx | 45 +++ app/src/client/tests/buildPageUtils.test.ts | 321 ++++++++++++++++++ app/src/client/utils/buildPageUtils.ts | 45 ++- 8 files changed, 488 insertions(+), 23 deletions(-) create mode 100644 app/src/client/components/form/NumericStepperWithClearButton.tsx create mode 100644 app/src/client/tests/NumericStepperWithClearButton.test.tsx diff --git a/app/src/client/app/BuildPage.tsx b/app/src/client/app/BuildPage.tsx index 96152990..59330cee 100644 --- a/app/src/client/app/BuildPage.tsx +++ b/app/src/client/app/BuildPage.tsx @@ -114,7 +114,7 @@ const BuildPage = ({ user }: BuildPageProps) => { const wrapperClass = document.body.classList.contains('server-error') ? 'h-[calc(100vh-173px)]' - : 'h-[calc(100vh-88px)]'; + : 'h-[calc(100vh-80px)]'; const history = useHistory(); useEffect(() => { diff --git a/app/src/client/components/DynamicFormBuilder.tsx b/app/src/client/components/DynamicFormBuilder.tsx index 65e82856..26a8c261 100644 --- a/app/src/client/components/DynamicFormBuilder.tsx +++ b/app/src/client/components/DynamicFormBuilder.tsx @@ -22,6 +22,7 @@ import { checkForDependency, } from '../utils/buildPageUtils'; import { set } from 'zod'; +import { NumericStepperWithClearButton } from './form/NumericStepperWithClearButton'; interface DynamicFormBuilderProps { allUserProperties: any; @@ -147,12 +148,23 @@ const DynamicFormBuilder: React.FC = ({
{formElementsObject.enum ? ( - handleChange(key, value)} - /> + formElementsObject.type === 'numericStepperWithClearButton' ? ( +
+ handleChange(key, value)} + /> +
+ ) : ( + handleChange(key, value)} + /> + ) ) : key === 'system_message' ? (