diff --git a/client/src/components/Settings/Dns/Access/Form.tsx b/client/src/components/Settings/Dns/Access/Form.tsx
index add6ee7b..6b2cc7a1 100644
--- a/client/src/components/Settings/Dns/Access/Form.tsx
+++ b/client/src/components/Settings/Dns/Access/Form.tsx
@@ -1,47 +1,67 @@
-import React from 'react';
+import React, { ReactNode } from 'react';
import { Controller, useForm } from 'react-hook-form';
import { Trans, useTranslation } from 'react-i18next';
+import i18next from 'i18next';
import { CLIENT_ID_LINK } from '../../../../helpers/constants';
import { removeEmptyLines, trimMultilineString } from '../../../../helpers/helpers';
import { Textarea } from '../../../ui/Controls/Textarea';
-const fields = [
+type FormData = {
+ allowed_clients: string;
+ disallowed_clients: string;
+ blocked_hosts: string;
+};
+
+const fields: {
+ id: keyof FormData;
+ title: string;
+ subtitle: ReactNode;
+ normalizeOnBlur: (value: string) => string;
+}[] = [
{
id: 'allowed_clients',
- title: 'access_allowed_title',
- subtitle: 'access_allowed_desc',
+ title: i18next.t('access_allowed_title'),
+ subtitle: (
+ ,
+ }}>
+ access_allowed_desc
+
+ ),
normalizeOnBlur: removeEmptyLines,
},
{
id: 'disallowed_clients',
- title: 'access_disallowed_title',
- subtitle: 'access_disallowed_desc',
+ title: i18next.t('access_disallowed_title'),
+ subtitle: (
+ ,
+ }}>
+ access_disallowed_desc
+
+ ),
normalizeOnBlur: trimMultilineString,
},
{
id: 'blocked_hosts',
- title: 'access_blocked_title',
- subtitle: 'access_blocked_desc',
+ title: i18next.t('access_blocked_title'),
+ subtitle: i18next.t('access_blocked_desc'),
normalizeOnBlur: removeEmptyLines,
},
];
-interface FormProps {
+type FormProps = {
initialValues?: {
allowed_clients?: string;
disallowed_clients?: string;
blocked_hosts?: string;
};
- onSubmit: (data: any) => void;
+ onSubmit: (data: FormData) => void;
processingSet: boolean;
-}
-
-interface FormData {
- allowed_clients: string;
- disallowed_clients: string;
- blocked_hosts: string;
-}
+};
const Form = ({ initialValues, onSubmit, processingSet }: FormProps) => {
const { t } = useTranslation();
@@ -70,7 +90,7 @@ const Form = ({ initialValues, onSubmit, processingSet }: FormProps) => {
}: {
id: keyof FormData;
title: string;
- subtitle: string;
+ subtitle: ReactNode;
normalizeOnBlur: (value: string) => string;
}) => {
const disabled = allowedClients && id === 'disallowed_clients';
@@ -78,22 +98,11 @@ const Form = ({ initialValues, onSubmit, processingSet }: FormProps) => {
return (
-
- ,
- }}>
- {subtitle}
-
-
+
{subtitle}
{