Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

chore: onboarding workspace name valdiation error indicator added (#3808)

Anmol Singh Bhatiac858b7605440
diff --git a/web/components/onboarding/user-details.tsx b/web/components/onboarding/user-details.tsx
index cd129c74c5..a29df3c942 100644
--- a/web/components/onboarding/user-details.tsx
+++ b/web/components/onboarding/user-details.tsx
@@ -62,6 +62,7 @@ export const UserDetails: React.FC<Props> = observer((props) => {
formState: { errors, isSubmitting, isValid },
} = useForm<IUser>({
defaultValues,
+ mode: "onChange",
});
const onSubmit = async (formData: IUser) => {
@@ -164,36 +165,38 @@ export const UserDetails: React.FC<Props> = observer((props) => {
)}
</button>
- <div className="my-2 mr-10 flex w-full rounded-md bg-onboarding-background-200 text-sm">
- <Controller
- control={control}
- name="first_name"
- rules={{
- required: "First name is required",
- maxLength: {
- value: 24,
- message: "First name cannot exceed the limit of 24 characters",
- },
- }}
- render={({ field: { value, onChange, ref } }) => (
- <Input
- id="first_name"
- name="first_name"
- type="text"
- value={value}
- autoFocus={true}
- onChange={(event) => {
- setUserName(event.target.value);
- onChange(event);
- }}
- ref={ref}
- hasError={Boolean(errors.first_name)}
- placeholder="Enter your full name..."
- className="w-full border-onboarding-border-100 focus:border-custom-primary-100"
- maxLength={24}
- />
- )}
- />
+ <div className="flex flex-col gap-1">
+ <div className="my-2 mr-10 flex w-full rounded-md bg-onboarding-background-200 text-sm">
+ <Controller
+ control={control}
+ name="first_name"
+ rules={{
+ required: "Name is required",
+ maxLength: {
+ value: 24,
+ message: "Name must be within 24 characters.",
+ },
+ }}
+ render={({ field: { value, onChange, ref } }) => (
+ <Input
+ id="first_name"
+ name="first_name"
+ type="text"
+ value={value}
+ autoFocus={true}
+ onChange={(event) => {
+ setUserName(event.target.value);
+ onChange(event);
+ }}
+ ref={ref}
+ hasError={Boolean(errors.first_name)}
+ placeholder="Enter your full name..."
+ className="w-full border-onboarding-border-100 focus:border-custom-primary-100"
+ />
+ )}
+ />
+ </div>
+ {errors.first_name && <span className="text-sm text-red-500">{errors.first_name.message}</span>}
</div>
</div>
<div className="mb-10 mt-14">