import { CheckboxField, FormField, FormItem, FormLabel, Switch, } from "@marzneshin/common/components"; import { useFormContext, useWatch } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { SplitHttpModeField } from "./mode"; import { SplitHttpPaddingBytesField } from "./padding-bytes"; import { SplitHttpXmuxFields } from "./xmux"; export const SplitHttpFields = () => { const { t } = useTranslation(); const form = useFormContext(); const split_http = useWatch({ name: "splithttp_settings" }); const isSplitHttpDisabled = split_http === null; const updateFieldValue = (path: string, value: any) => { form.setValue(path, value === "" ? null : value, { shouldDirty: true, shouldValidate: true, }); }; return ( ( {t("split_http")} form.setValue( "splithttp_settings", checked ? { xmux: {} } : null, ) } /> {!isSplitHttpDisabled && ( <>
)}
)} /> ); };