diff --git a/packages/backend/src/service.ts b/packages/backend/src/service.ts index d3807dfc..80e49874 100644 --- a/packages/backend/src/service.ts +++ b/packages/backend/src/service.ts @@ -1243,7 +1243,7 @@ export class Service { data: { name: string }, ): Promise<{ primaryDomain: Domain; - redirectedDomain: Domain; + // redirectedDomain: Domain; }> { const currentProject = await this.db.getProjectById(projectId); @@ -1259,22 +1259,22 @@ export class Service { const savedPrimaryDomain = await this.db.addDomain(primaryDomainDetails); - const domainArr = data.name.split('www.'); + // const domainArr = data.name.split('www.'); - const redirectedDomainDetails = { - name: domainArr.length > 1 ? domainArr[1] : `www.${domainArr[0]}`, - branch: currentProject.prodBranch, - project: currentProject, - redirectTo: savedPrimaryDomain, - }; + // const redirectedDomainDetails = { + // name: domainArr.length > 1 ? domainArr[1] : `www.${domainArr[0]}`, + // branch: currentProject.prodBranch, + // project: currentProject, + // redirectTo: savedPrimaryDomain, + // }; - const savedRedirectedDomain = await this.db.addDomain( - redirectedDomainDetails, - ); + // const savedRedirectedDomain = await this.db.addDomain( + // redirectedDomainDetails, + // ); return { primaryDomain: savedPrimaryDomain, - redirectedDomain: savedRedirectedDomain, + // redirectedDomain: savedRedirectedDomain, }; } diff --git a/packages/frontend/src/components/projects/project/settings/SetupDomain.tsx b/packages/frontend/src/components/projects/project/settings/SetupDomain.tsx index 03c9b331..e1b5acde 100644 --- a/packages/frontend/src/components/projects/project/settings/SetupDomain.tsx +++ b/packages/frontend/src/components/projects/project/settings/SetupDomain.tsx @@ -1,12 +1,12 @@ -import { useEffect, useState } from 'react'; +// import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { useForm } from 'react-hook-form'; import { Heading } from 'components/shared/Heading'; -import { InlineNotification } from 'components/shared/InlineNotification'; +// import { InlineNotification } from 'components/shared/InlineNotification'; import { Input } from 'components/shared/Input'; import { Button } from 'components/shared/Button'; -import { Radio } from 'components/shared/Radio'; +// import { Radio } from 'components/shared/Radio'; interface SetupDomainFormValues { domainName: string; @@ -18,47 +18,45 @@ const SetupDomain = () => { register, handleSubmit, formState: { isValid }, - watch, - setValue, + // watch, + // setValue, } = useForm({ defaultValues: { domainName: '', - isWWW: 'false', + // isWWW: 'false', }, mode: 'onChange', }); - const [domainStr, setDomainStr] = useState(''); + // const [domainStr, setDomainStr] = useState(''); const navigate = useNavigate(); - const isWWWRadioOptions = [ - { label: domainStr, value: 'false' }, - { label: `www.${domainStr}`, value: 'true' }, - ]; + // 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); + // 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', - ); - } - }); + // setValue( + // 'isWWW', + // value.domainName.startsWith('www.') ? 'true' : 'false', + // ); + // } + // }); - return () => subscription.unsubscribe(); - }, [watch, setValue]); + // return () => subscription.unsubscribe(); + // }, [watch, setValue]); return (
{ - watch('isWWW') === 'true' - ? navigate(`config?name=www.${domainStr}`) - : navigate(`config?name=${domainStr}`); + onSubmit={handleSubmit((e) => { + navigate(`config?name=${e.domainName}`) })} className="flex flex-col gap-6 w-full" > @@ -80,7 +78,7 @@ const SetupDomain = () => { label="Domain name" /> - {isValid && ( + {/* {isValid && (
Primary domain @@ -99,7 +97,7 @@ const SetupDomain = () => { }. Redirect preferences can be changed later`} />
- )} + )} */}
+ <> + {domains.length == 0 && ( + + )} + } > {domains.map((domain) => {