Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Mar 14, 2024
1 parent a97f29c commit 7447b5a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 32 deletions.
65 changes: 40 additions & 25 deletions ee/tabby-ui/app/auth/signup/components/admin-register.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
"use client";
'use client'

import { useState } from "react";
import { useState } from 'react'
import { useRouter } from 'next/navigation'

import { cn } from "@/lib/utils";
import { cn } from '@/lib/utils'
import { Button } from '@/components/ui/button'

import { Button } from "@/components/ui/button"
import { UserAuthForm } from './user-register-form'

import './admin-register.css'

export default function AdminRegister () {
export default function AdminRegister() {
const router = useRouter()
const [step, setStep] = useState(1)

return (
<div className={cn("admin-register-wrap w-[550px]", {
"translate-y-1/3": step === 1,
"-translate-y-10": step === 2,
"-translate-y-20": step === 3
})}>

<div className={cn('border-l border-foreground py-8 pl-12', { 'step-mask': step !== 1, 'remote': step > 2 })}>
<div
className={cn('admin-register-wrap w-[550px]', {
'translate-y-1/3': step === 1,
'-translate-y-10': step === 2,
'-translate-y-20': step === 3
})}
>
<div
className={cn('border-l border-foreground py-8 pl-12', {
'step-mask': step !== 1,
remote: step > 2
})}
>
<h2 className="text-3xl font-semibold tracking-tight first:mt-0">
Welcome To Tabby Enterprise
</h2>
Expand All @@ -31,39 +37,48 @@ export default function AdminRegister () {
<p className="leading-7 text-muted-foreground">
This will allow you to invite team members and manage your instance.
</p>
<Button
className='mt-5 w-48'
onClick={() => setStep(2)}>
Create admin account
<Button className="mt-5 w-48" onClick={() => setStep(2)}>
Create admin account
</Button>
</div>

<div className={cn("border-l border-foreground py-8 pl-12", { 'step-mask': step !== 2 })}>
<div
className={cn('border-l border-foreground py-8 pl-12', {
'step-mask': step !== 2
})}
>
<h3 className="text-2xl font-semibold tracking-tight">
Create Admin Account
</h3>
<p className="mb-3 leading-7 text-muted-foreground">
Your instance will be secured, only registered users can access it.
</p>
<UserAuthForm onSuccess={() => setStep(3)} buttonClass="self-start w-48" />
<UserAuthForm
onSuccess={() => setStep(3)}
buttonClass="self-start w-48"
/>
</div>

<div className={cn("border-l border-foreground py-8 pl-12", { 'step-mask': step !== 3, 'remote': step < 2 })}>
<div
className={cn('border-l border-foreground py-8 pl-12', {
'step-mask': step !== 3,
remote: step < 2
})}
>
<h3 className="text-2xl font-semibold tracking-tight">
Enter The Instance
</h3>
<p className="leading-7 text-muted-foreground">
Congratulations! You have successfully created an admin account.
</p>
<p className="mb-3 leading-7 text-muted-foreground">
To begin collaborating with your team, please open the dashboard and invite members to join your instance.
To begin collaborating with your team, please open the dashboard and
invite members to join your instance.
</p>
<Button
className='mt-5 w-48'
onClick={() => router.replace("/")}>
Open the dashboard
<Button className="mt-5 w-48" onClick={() => router.replace('/')}>
Open the dashboard
</Button>
</div>
</div>
)
}
}
4 changes: 2 additions & 2 deletions ee/tabby-ui/app/auth/signup/components/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import { useSearchParams } from 'next/navigation'

import { UserAuthForm } from './user-register-form'
import AdminRegister from './admin-register'
import { UserAuthForm } from './user-register-form'

export default function Signup() {
const searchParams = useSearchParams()
const invitationCode = searchParams.get('invitationCode') || undefined
const isAdmin = searchParams.get('isAdmin') || false

if (isAdmin) return <AdminRegister />
if (invitationCode) {
return (
Expand Down
11 changes: 6 additions & 5 deletions ee/tabby-ui/app/auth/signup/components/user-register-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ const formSchema = z.object({
})

interface UserAuthFormProps extends React.HTMLAttributes<HTMLDivElement> {
invitationCode?: string;
onSuccess?: () => void;
buttonClass?: string;
invitationCode?: string
onSuccess?: () => void
buttonClass?: string
}

export function UserAuthForm({
Expand Down Expand Up @@ -148,8 +148,9 @@ export function UserAuthForm({
/>
<Button
type="submit"
className={cn("mt-2", buttonClass)}
disabled={isSubmitting}>
className={cn('mt-2', buttonClass)}
disabled={isSubmitting}
>
{isSubmitting && (
<IconSpinner className="mr-2 h-4 w-4 animate-spin" />
)}
Expand Down

0 comments on commit 7447b5a

Please sign in to comment.