diff --git a/ee/tabby-ui/app/auth/signup/components/admin-register.css b/ee/tabby-ui/app/auth/signup/components/admin-register.css new file mode 100644 index 000000000000..7eb57e5f35cd --- /dev/null +++ b/ee/tabby-ui/app/auth/signup/components/admin-register.css @@ -0,0 +1,36 @@ +.admin-register-wrap { + transition: transform 0.35s ease-out; +} + +.step-mask { + position: relative; + pointer-events: none; + border-color: hsl(var(--muted-foreground) / 0.1); + &:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: linear-gradient( + 0deg, + hsl(var(--background) / 1) 0%, + hsl(var(--background) / 1) 30%, + hsl(var(--background) / 0.5) 100% + ); + pointer-events: none; + z-index: 10; + } + + &.remote { + &:after { + background: linear-gradient( + 0deg, + hsl(var(--background) / 1) 0%, + hsl(var(--background) / 1) 30%, + hsl(var(--background) / 0.9) 100% + ); + } + } +} diff --git a/ee/tabby-ui/app/auth/signup/components/admin-register.tsx b/ee/tabby-ui/app/auth/signup/components/admin-register.tsx new file mode 100644 index 000000000000..35cf0b0dda60 --- /dev/null +++ b/ee/tabby-ui/app/auth/signup/components/admin-register.tsx @@ -0,0 +1,69 @@ +"use client"; + +import { useState } from "react"; +import { useRouter } from 'next/navigation' + +import { cn } from "@/lib/utils"; + +import { Button } from "@/components/ui/button" +import { UserAuthForm } from './user-register-form' + +import './admin-register.css' + +export default function AdminRegister () { + const router = useRouter() + const [step, setStep] = useState(1) + + return ( +
+ +
2 })}> +

+ Welcome To Tabby Enterprise +

+

+ To get started, please create an admin account for your instance. +

+

+ This will allow you to invite team members and manage your instance. +

+ +
+ +
+

+ Create Admin Account +

+

+ Your instance will be secured, only registered users can access it. +

+ setStep(3)} buttonClass="self-start w-48" /> +
+ +
+

+ Enter The Instance +

+

+ Congratulations! You have successfully created an admin account. +

+

+ To begin collaborating with your team, please open the dashboard and invite members to join your instance. +

+ +
+
+ ) +} \ No newline at end of file diff --git a/ee/tabby-ui/app/auth/signup/components/signup.tsx b/ee/tabby-ui/app/auth/signup/components/signup.tsx index d7539d38b5db..c19f4082bb99 100644 --- a/ee/tabby-ui/app/auth/signup/components/signup.tsx +++ b/ee/tabby-ui/app/auth/signup/components/signup.tsx @@ -3,28 +3,29 @@ import { useSearchParams } from 'next/navigation' import { UserAuthForm } from './user-register-form' +import AdminRegister from './admin-register' export default function Signup() { const searchParams = useSearchParams() const invitationCode = searchParams.get('invitationCode') || undefined const isAdmin = searchParams.get('isAdmin') || false - - const title = isAdmin ? 'Create an admin account' : 'Create an account' - - const description = isAdmin - ? 'Your instance will be secured, only registered users can access it.' - : 'Fill form below to create your account' - - if (isAdmin || invitationCode) { - return - } else { + + if (isAdmin) return + if (invitationCode) { return ( ) } + return ( + + ) } function Content({ diff --git a/ee/tabby-ui/app/auth/signup/components/user-register-form.tsx b/ee/tabby-ui/app/auth/signup/components/user-register-form.tsx index d90be3355458..a5093a9b3a4d 100644 --- a/ee/tabby-ui/app/auth/signup/components/user-register-form.tsx +++ b/ee/tabby-ui/app/auth/signup/components/user-register-form.tsx @@ -50,12 +50,16 @@ const formSchema = z.object({ }) interface UserAuthFormProps extends React.HTMLAttributes { - invitationCode?: string + invitationCode?: string; + onSuccess?: () => void; + buttonClass?: string; } export function UserAuthForm({ className, invitationCode, + onSuccess, + buttonClass, ...props }: UserAuthFormProps) { const form = useForm>({ @@ -71,7 +75,11 @@ export function UserAuthForm({ const onSubmit = useMutation(registerUser, { async onCompleted(values) { if (await signIn(values?.register)) { - router.replace('/') + if (onSuccess) { + onSuccess() + } else { + router.replace('/') + } } }, form @@ -138,7 +146,10 @@ export function UserAuthForm({ )} /> -