From b538096ab07755764a9eaeb130aefcd3288698cb Mon Sep 17 00:00:00 2001 From: dmitrii Date: Tue, 24 Dec 2024 14:37:52 +0300 Subject: [PATCH] update components to use react-hook-form --- .../components/Settings/Dns/Config/Form.tsx | 3 +- .../components/Settings/Dns/Upstream/Form.tsx | 44 +++++++++++++------ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/client/src/components/Settings/Dns/Config/Form.tsx b/client/src/components/Settings/Dns/Config/Form.tsx index 0ad28950..42417c95 100644 --- a/client/src/components/Settings/Dns/Config/Form.tsx +++ b/client/src/components/Settings/Dns/Config/Form.tsx @@ -45,7 +45,7 @@ type FormData = { ratelimit_whitelist: string; edns_cs_enabled: boolean; edns_cs_use_custom: boolean; - edns_cs_custom_ip?: string; + edns_cs_custom_ip?: boolean; dnssec_enabled: boolean; disable_ipv6: boolean; blocking_mode: string; @@ -67,7 +67,6 @@ const Form = ({ processing, initialValues, onSubmit }: Props) => { register, handleSubmit, watch, - control, formState: { errors, isSubmitting, isDirty }, } = useForm({ mode: 'onChange', diff --git a/client/src/components/Settings/Dns/Upstream/Form.tsx b/client/src/components/Settings/Dns/Upstream/Form.tsx index c15b99b0..7254b7f5 100644 --- a/client/src/components/Settings/Dns/Upstream/Form.tsx +++ b/client/src/components/Settings/Dns/Upstream/Form.tsx @@ -1,7 +1,7 @@ import classnames from 'classnames'; import React, { useRef } from 'react'; import { Controller, useForm } from 'react-hook-form'; -import { useTranslation } from 'react-i18next'; +import { Trans, useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { testUpstreamWithFormValues } from '../../../../actions'; @@ -96,19 +96,37 @@ const Form = ({ initialValues, onSubmit }: FormProps) => { return (
-
-