-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
8,378 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { IconPlane } from "@tabler/icons-react"; | ||
|
||
import { Button } from "@ctrlplane/ui/button"; | ||
|
||
export default function AuthPage({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<div className="h-full"> | ||
<div className="flex items-center gap-2 p-4"> | ||
<IconPlane className="h-10 w-10" /> | ||
<div className="flex-grow" /> | ||
<Button variant="ghost" className="text-muted-foreground"> | ||
Contact | ||
</Button> | ||
<Button variant="outline">Sign up</Button> | ||
</div> | ||
{children} | ||
</div> | ||
); | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
"use client"; | ||
|
||
import { useRouter } from "next/navigation"; | ||
import { z } from "zod"; | ||
|
||
import { | ||
Form, | ||
FormControl, | ||
FormField, | ||
FormItem, | ||
FormLabel, | ||
FormMessage, | ||
useForm, | ||
} from "@ctrlplane/ui/form"; | ||
import { Input } from "@ctrlplane/ui/input"; | ||
|
||
import { api } from "~/trpc/react"; | ||
|
||
const schema = z.object({ | ||
name: z.string().min(1), | ||
email: z.string().email(), | ||
password: z.string().min(8), | ||
}); | ||
|
||
export const SignUpCard: React.FC<{ | ||
isGoogleEnabled: boolean; | ||
isOidcEnabled: boolean; | ||
}> = () => { | ||
const router = useRouter(); | ||
const signUp = api.user.auth.signUp.useMutation(); | ||
const form = useForm({ | ||
schema, | ||
defaultValues: { | ||
name: "", | ||
email: "", | ||
password: "", | ||
}, | ||
}); | ||
|
||
const onSubmit = form.handleSubmit((data) => { | ||
signUp.mutate(data); | ||
router.replace("/login"); | ||
}); | ||
|
||
return ( | ||
<div className="container mx-auto mt-[150px] max-w-[375px]"> | ||
<h1 className="mb-10 text-center text-3xl font-bold"> | ||
Sign up for Ctrlplane | ||
</h1> | ||
<div className="space-y-6"> | ||
<div className="space-y-2"> | ||
<Form {...form}> | ||
<form onSubmit={onSubmit}> | ||
<FormField | ||
control={form.control} | ||
name="name" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Name</FormLabel> | ||
<FormControl> | ||
<Input {...field} /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
|
||
<FormField | ||
control={form.control} | ||
name="email" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Email</FormLabel> | ||
<FormControl> | ||
<Input {...field} /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
|
||
<FormField | ||
control={form.control} | ||
name="password" | ||
render={({ field }) => ( | ||
<FormItem> | ||
<FormLabel>Password</FormLabel> | ||
<FormControl> | ||
<Input {...field} type="password" /> | ||
</FormControl> | ||
<FormMessage /> | ||
</FormItem> | ||
)} | ||
/> | ||
</form> | ||
</Form> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
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
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
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
Oops, something went wrong.