diff --git a/client/src/components/Filters/Check/index.tsx b/client/src/components/Filters/Check/index.tsx index 32024397..996d6b75 100644 --- a/client/src/components/Filters/Check/index.tsx +++ b/client/src/components/Filters/Check/index.tsx @@ -48,6 +48,7 @@ const Check = ({ onSubmit }: Props) => { { diff --git a/client/src/components/Filters/FiltersList.tsx b/client/src/components/Filters/FiltersList.tsx index fb9bedb7..ca0d1fbb 100644 --- a/client/src/components/Filters/FiltersList.tsx +++ b/client/src/components/Filters/FiltersList.tsx @@ -74,7 +74,12 @@ export const FiltersList = ({ categories, filters, selectedSources }: Props) => name={id} control={control} render={({ field }) => ( - + )} /> {renderIcons(iconsData)} diff --git a/client/src/components/Filters/Form.tsx b/client/src/components/Filters/Form.tsx index 82a61df9..9641cfd4 100644 --- a/client/src/components/Filters/Form.tsx +++ b/client/src/components/Filters/Form.tsx @@ -15,13 +15,13 @@ type FormValues = { }; type Props = { - closeModal: (...args: unknown[]) => void; + closeModal: () => void; onSubmit: (values: FormValues) => void; processingAddFilter: boolean; processingConfigFilter: boolean; whitelist?: boolean; modalType: string; - toggleFilteringModal: (...args: unknown[]) => void; + toggleFilteringModal: ({ type }: { type?: keyof typeof MODAL_TYPE }) => void; selectedSources?: Record; initialValues?: FormValues; }; @@ -42,14 +42,14 @@ export const Form = ({ const methods = useForm({ defaultValues: initialValues }); const { handleSubmit, control } = methods; - const openModal = (modalType: any, timeout = MODAL_OPEN_TIMEOUT) => { - toggleFilteringModal(); + const openModal = (modalType: keyof typeof MODAL_TYPE, timeout = MODAL_OPEN_TIMEOUT) => { + toggleFilteringModal(undefined); setTimeout(() => toggleFilteringModal({ type: modalType }), timeout); }; - const openFilteringListModal = () => openModal(MODAL_TYPE.CHOOSE_FILTERING_LIST); + const openFilteringListModal = () => openModal('CHOOSE_FILTERING_LIST'); - const openAddFiltersModal = () => openModal(MODAL_TYPE.ADD_FILTERS); + const openAddFiltersModal = () => openModal('ADD_FILTERS'); return ( @@ -81,8 +81,15 @@ export const Form = ({ ( - + render={({ field, fieldState }) => ( + )} /> @@ -92,11 +99,13 @@ export const Form = ({ name="url" control={control} rules={{ validate: { validateRequiredValue, validatePath } }} - render={({ field }) => ( + render={({ field, fieldState }) => ( )} @@ -118,6 +127,7 @@ export const Form = ({ {modalType !== MODAL_TYPE.SELECT_MODAL_TYPE && (