import React, { useState } from "react"; import Link from "next/link"; import { Controller, useForm } from "react-hook-form"; // ui import { Button, Input } from "@plane/ui"; // helpers import { checkEmailValidity } from "helpers/string.helper"; // constants import { ESignInSteps } from "components/account"; type Props = { email: string; handleStepChange: (step: ESignInSteps) => void; handleSignInRedirection: () => Promise; isOnboarded: boolean; }; export const OptionalSetPasswordForm: React.FC = (props) => { const { email, handleStepChange, handleSignInRedirection, isOnboarded } = props; // states const [isGoingToWorkspace, setIsGoingToWorkspace] = useState(false); // form info const { control, formState: { errors, isValid }, } = useForm({ defaultValues: { email, }, mode: "onChange", reValidateMode: "onChange", }); const handleGoToWorkspace = async () => { setIsGoingToWorkspace(true); await handleSignInRedirection().finally(() => setIsGoingToWorkspace(false)); }; return ( <>

Set a password

If you{"'"}d like to do away with codes, set a password here.

checkEmailValidity(value) || "Email is invalid", }} render={({ field: { value, onChange, ref } }) => ( )} />

When you click{" "} {isOnboarded ? "Go to workspace" : "Set up workspace"} above, you agree with our{" "} terms and conditions of service.

); };