From c4ae545bcb76248b62fbc8d4ea45daeff4c14533 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Tue, 5 Dec 2023 15:52:57 +0800 Subject: [PATCH] extract signup component --- ee/tabby-ui/app/auth/components/signup.tsx | 24 +++++++++++++ .../app/auth/components/user-auth-form.tsx | 36 +++++++++++++------ ee/tabby-ui/app/auth/page.tsx | 16 ++------- 3 files changed, 51 insertions(+), 25 deletions(-) create mode 100644 ee/tabby-ui/app/auth/components/signup.tsx diff --git a/ee/tabby-ui/app/auth/components/signup.tsx b/ee/tabby-ui/app/auth/components/signup.tsx new file mode 100644 index 0000000..0528fd7 --- /dev/null +++ b/ee/tabby-ui/app/auth/components/signup.tsx @@ -0,0 +1,24 @@ +"use client" + +import { UserAuthForm } from "./user-auth-form" +import { useGraphQL } from "@/lib/hooks/use-graphql" +import { getIsAdminInitialized } from "@/lib/gql/request-documents" + +export default function Signup() { + const { data } = useGraphQL(getIsAdminInitialized) + const title = data?.isAdminInitialized ? "Create an account" : "Create an admin account" + + return ( +
+
+

+ {title} +

+

+ Enter your credentials below to create account +

+
+ +
+ ) +} diff --git a/ee/tabby-ui/app/auth/components/user-auth-form.tsx b/ee/tabby-ui/app/auth/components/user-auth-form.tsx index de57837..3dd1b73 100644 --- a/ee/tabby-ui/app/auth/components/user-auth-form.tsx +++ b/ee/tabby-ui/app/auth/components/user-auth-form.tsx @@ -8,9 +8,11 @@ import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" -interface UserAuthFormProps extends React.HTMLAttributes { } +interface UserAuthFormProps extends React.HTMLAttributes { + invitationCode?: string +} -export function UserAuthForm({ className, ...props }: UserAuthFormProps) { +export function UserAuthForm({ className, invitationCode, ...props }: UserAuthFormProps) { const [isLoading, setIsLoading] = React.useState(false) async function onSubmit(event: React.SyntheticEvent) { @@ -26,13 +28,13 @@ export function UserAuthForm({ className, ...props }: UserAuthFormProps) {
-
-