import { useTranslation } from 'react-i18next'; import { Form, Input, InputNumber, Select, Switch } from 'antd'; import { useFormContext, useWatch } from 'react-hook-form'; import { HeaderMapEditor } from '@/components/form'; import { FormField } from '@/components/form/rhf'; const MASQ = ['streamSettings', 'hysteriaSettings', 'masquerade']; const MASQ_DOT = 'streamSettings.hysteriaSettings.masquerade'; export default function HysteriaForm() { const { t } = useTranslation(); const { control, setValue } = useFormContext(); const masquerade = useWatch({ control, name: MASQ_DOT }) as { type?: string } | undefined; return ( <> setValue( MASQ_DOT, checked ? { type: '', dir: '', url: '', rewriteHost: false, insecure: false, content: '', headers: {}, statusCode: 0, } : undefined, ) } /> {masquerade && ( <> )} {masquerade.type === 'file' && ( )} {masquerade.type === 'string' && ( <> )} )} ); }