import { useNavigate } from 'react-router-dom'; import { useForm } from 'react-hook-form'; import { Heading } from 'components/shared/Heading'; import { Input } from 'components/shared/Input'; import { Button } from 'components/shared/Button'; // NOTE: Commented code for redirect domain functionality // import { useEffect, useState } from 'react'; // import { InlineNotification } from 'components/shared/InlineNotification'; // import { Radio } from 'components/shared/Radio'; interface SetupDomainFormValues { domainName: string; isWWW: string; } const SetupDomain = () => { const { register, handleSubmit, formState: { isValid }, // watch, // setValue, } = useForm({ defaultValues: { domainName: '', // isWWW: 'false', }, mode: 'onChange', }); const navigate = useNavigate(); // const [domainStr, setDomainStr] = useState(''); // const isWWWRadioOptions = [ // { label: domainStr, value: 'false' }, // { label: `www.${domainStr}`, value: 'true' }, // ]; // useEffect(() => { // const subscription = watch((value, { name }) => { // if (name === 'domainName' && value.domainName) { // const domainArr = value.domainName.split('www.'); // const cleanedDomain = // domainArr.length > 1 ? domainArr[1] : domainArr[0]; // setDomainStr(cleanedDomain); // setValue( // 'isWWW', // value.domainName.startsWith('www.') ? 'true' : 'false', // ); // } // }); // return () => subscription.unsubscribe(); // }, [watch, setValue]); return (
{ navigate(`config?name=${e.domainName}`) })} className="flex flex-col gap-6 w-full" >
Setup domain name

Add your domain {/* and setup redirects */}

{/* {isValid && (
Primary domain setValue('isWWW', value)} value={watch('isWWW')} />
)} */}
); }; export default SetupDomain;