-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(saas): Added Organization email
- Loading branch information
1 parent
78b611c
commit a47c218
Showing
5 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ const createOrgFormSchema = z.object({ | |
.trim() | ||
.min(3, "Name must be at least 3 characters long") | ||
.max(50, "Name must be at most 50 characters long"), | ||
email: z.string().email("Invalid email address"), | ||
}); | ||
|
||
export type CreateOrgFormSchema = z.infer<typeof createOrgFormSchema>; | ||
|
@@ -51,11 +52,13 @@ export function CreateOrgForm({ open, setOpen }: CreateOrgFormProps) { | |
resolver: zodResolver(createOrgFormSchema), | ||
defaultValues: { | ||
name: "", | ||
email: "", | ||
}, | ||
}); | ||
|
||
const { mutateAsync, isPending: isMutatePending } = useMutation({ | ||
mutationFn: ({ name }: { name: string }) => createOrgMutation({ name }), | ||
mutationFn: ({ name, email }: { name: string; email: string }) => | ||
createOrgMutation({ name, email }), | ||
}); | ||
|
||
const [isPending, startAwaitableTransition] = useAwaitableTransition(); | ||
|
@@ -91,7 +94,32 @@ export function CreateOrgForm({ open, setOpen }: CreateOrgFormProps) { | |
</DialogDescription> | ||
</DialogHeader> | ||
<Form {...form}> | ||
<form onSubmit={form.handleSubmit(onSubmit)}> | ||
<form | ||
onSubmit={form.handleSubmit(onSubmit)} | ||
className="space-y-3" | ||
> | ||
<FormField | ||
control={form.control} | ||
name="email" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Org Email</FormLabel> | ||
<FormControl> | ||
<Input | ||
placeholder="[email protected]" | ||
{...field} | ||
/> | ||
</FormControl> | ||
<FormDescription> | ||
Enter the email of your organization. | ||
This could be your personal email or a | ||
shared email. | ||
</FormDescription> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
|
||
<FormField | ||
control={form.control} | ||
name="name" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ const createOrgFormSchema = z.object({ | |
.trim() | ||
.min(3, "Name must be at least 3 characters long") | ||
.max(50, "Name must be at most 50 characters long"), | ||
email: z.string().email("Invalid email address"), | ||
}); | ||
|
||
type CreateOrgFormSchema = z.infer<typeof createOrgFormSchema>; | ||
|
@@ -76,11 +77,13 @@ export function NewUserOrgForm({ | |
resolver: zodResolver(createOrgFormSchema), | ||
defaultValues: { | ||
name: "", | ||
email: "", | ||
}, | ||
}); | ||
|
||
const { mutateAsync, isPending: isMutatePending } = useMutation({ | ||
mutationFn: ({ name }: { name: string }) => createOrgMutation({ name }), | ||
mutationFn: ({ name, email }: { name: string; email: string }) => | ||
createOrgMutation({ name, email }), | ||
}); | ||
|
||
const [isPending, startAwaitableTransition] = useAwaitableTransition(); | ||
|
@@ -118,7 +121,28 @@ export function NewUserOrgForm({ | |
Create an organization to get started | ||
</CardDescription> | ||
</CardHeader> | ||
<CardContent className="grid gap-2"> | ||
<CardContent className="grid gap-3"> | ||
<FormField | ||
control={form.control} | ||
name="email" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Org Email</FormLabel> | ||
<FormControl> | ||
<Input | ||
placeholder="[email protected]" | ||
{...field} | ||
/> | ||
</FormControl> | ||
<FormDescription> | ||
Enter the email of your organization. | ||
This could be your personal email or a | ||
shared email. | ||
</FormDescription> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
<FormField | ||
control={form.control} | ||
name="name" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters