diff --git a/web/components/account/sign-in-forms/unique-code.tsx b/web/components/account/sign-in-forms/unique-code.tsx index 71ed93f0c..0091819f8 100644 --- a/web/components/account/sign-in-forms/unique-code.tsx +++ b/web/components/account/sign-in-forms/unique-code.tsx @@ -196,7 +196,7 @@ export const UniqueCodeForm: React.FC = (props) => { value={value} onChange={onChange} hasError={Boolean(errors.token)} - placeholder="gets-sets-fays" + placeholder="gets-sets-flys" className="w-full h-[46px] placeholder:text-onboarding-text-400 border border-onboarding-border-100 pr-12" /> )} diff --git a/web/components/onboarding/join-workspaces.tsx b/web/components/onboarding/join-workspaces.tsx index 214f3b709..66f88fb49 100644 --- a/web/components/onboarding/join-workspaces.tsx +++ b/web/components/onboarding/join-workspaces.tsx @@ -24,7 +24,7 @@ export const JoinWorkspaces: React.FC = ({ stepChange, setTryDiffAccount } = useForm({ defaultValues: { name: "", - slug: `${window.location.host}/`, + slug: "", }, mode: "onChange", }); diff --git a/web/components/onboarding/workspace.tsx b/web/components/onboarding/workspace.tsx index cb126adfd..e14356e5a 100644 --- a/web/components/onboarding/workspace.tsx +++ b/web/components/onboarding/workspace.tsx @@ -40,8 +40,6 @@ export const Workspace: React.FC = (props) => { const handleCreateWorkspace = async (formData: IWorkspace) => { if (isSubmitting) return; - const slug = formData.slug.split("/"); - formData.slug = slug[slug.length - 1]; await workspaceService .workspaceSlugCheck(formData.slug) @@ -118,11 +116,7 @@ export const Workspace: React.FC = (props) => { onChange={(event) => { onChange(event.target.value); setValue("name", event.target.value); - if (window && window.location.host) { - const host = window.location.host; - const slug = event.currentTarget.value.split("/"); - setValue("slug", `${host}/${slug[slug.length - 1].toLocaleLowerCase().trim().replace(/ /g, "-")}`); - } + setValue("slug", event.target.value.toLocaleLowerCase().trim().replace(/ /g, "-")); }} placeholder="Enter workspace name..." ref={ref} @@ -137,26 +131,25 @@ export const Workspace: React.FC = (props) => { ( -
+ render={({ field: { value, ref, onChange } }) => ( +
+ {window && window.location.host}/ { - const host = window.location.host; - const slug = e.currentTarget.value.split("/"); - if (slug.length > 1) { - /^[a-zA-Z0-9_-]+$/.test(slug[slug.length - 1]) ? setInvalidSlug(false) : setInvalidSlug(true); - setValue("slug", `${host}/${slug[slug.length - 1].toLocaleLowerCase().trim().replace(/ /g, "-")}`); - } else { - setValue("slug", `${host}/`); - } + /^[a-zA-Z0-9_-]+$/.test(e.target.value) ? setInvalidSlug(false) : setInvalidSlug(true); + onChange(e.target.value.toLowerCase()); }} ref={ref} hasError={Boolean(errors.slug)} - className="w-full h-[46px] border-onboarding-border-100" + className="w-full h-[46px] !px-0 border-none" />
)}