AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(frontend): logged out pages UI updates (#10314)
Ubbe574133125024
diff --git a/autogpt_platform/frontend/public/google-logo.svg b/autogpt_platform/frontend/public/google-logo.svgnew file mode 100644index 0000000000..0cf21a27c6--- /dev/null+++ b/autogpt_platform/frontend/public/google-logo.svg@@ -0,0 +1,6 @@+<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">+ <path d="M19.99 10.1871C19.99 9.36767 19.9246 8.76973 19.7831 8.14966H10.1943V11.8493H15.8207C15.7062 12.7676 15.0943 14.1618 13.7567 15.0492L13.7398 15.1632L16.7444 17.4429L16.9637 17.4648C18.8825 15.7291 19.99 13.2042 19.99 10.1871Z" fill="#4285F4"/>+ <path d="M10.1943 19.9313C12.9592 19.9313 15.2429 19.0454 16.9637 17.4648L13.7567 15.0492C12.8697 15.6438 11.7348 16.0244 10.1943 16.0244C7.50242 16.0244 5.25023 14.2886 4.39644 11.9036L4.28823 11.9125L1.17021 14.2775L1.13477 14.3808C2.84508 17.8028 6.1992 19.9313 10.1943 19.9313Z" fill="#34A853"/>+ <path d="M4.39644 11.9036C4.1758 11.2746 4.04876 10.6013 4.04876 9.90569C4.04876 9.21011 4.1758 8.53684 4.38177 7.90781L4.37563 7.7883L1.20776 5.3801L1.13477 5.41253C0.436264 6.80439 0.0390625 8.35202 0.0390625 9.90569C0.0390625 11.4594 0.436264 13.007 1.13477 14.3808L4.39644 11.9036Z" fill="#FBBC05"/>+ <path d="M10.1943 3.78682C12.1168 3.78682 13.397 4.66154 14.1236 5.33481L17.0194 2.59768C15.2373 0.953818 12.9592 0 10.1943 0C6.1992 0 2.84508 2.12847 1.13477 5.41253L4.38177 7.90781C5.25023 5.52278 7.50242 3.78682 10.1943 3.78682Z" fill="#EB4335"/>+</svg>\ No newline at end of filediff --git a/autogpt_platform/frontend/src/app/(platform)/login/actions.ts b/autogpt_platform/frontend/src/app/(platform)/login/actions.tsindex ab84cc54f0..fb53478f0a 100644--- a/autogpt_platform/frontend/src/app/(platform)/login/actions.ts+++ b/autogpt_platform/frontend/src/app/(platform)/login/actions.ts@@ -1,12 +1,12 @@"use server";+import BackendAPI from "@/lib/autogpt-server-api";+import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";+import { verifyTurnstileToken } from "@/lib/turnstile";+import { loginFormSchema, LoginProvider } from "@/types/auth";+import * as Sentry from "@sentry/nextjs";import { revalidatePath } from "next/cache";import { redirect } from "next/navigation";import { z } from "zod";-import * as Sentry from "@sentry/nextjs";-import { getServerSupabase } from "@/lib/supabase/server/getServerSupabase";-import BackendAPI from "@/lib/autogpt-server-api";-import { loginFormSchema, LoginProvider } from "@/types/auth";-import { verifyTurnstileToken } from "@/lib/turnstile";async function shouldShowOnboarding() {const api = new BackendAPI();@@ -38,7 +38,6 @@ export async function login(const { error } = await supabase.auth.signInWithPassword(values);if (error) {- console.error("Error logging in:", error);return error.message;}@@ -76,6 +75,11 @@ export async function providerLogin(provider: LoginProvider) {});if (error) {+ // FIXME: supabase doesn't return the correct error message for this case+ if (error.message.includes("P0001")) {+ return "not_allowed";+ }+console.error("Error logging in", error);return error.message;}diff --git a/autogpt_platform/frontend/src/app/(platform)/login/components/LoadingLogin.tsx b/autogpt_platform/frontend/src/app/(platform)/login/components/LoadingLogin.tsxnew file mode 100644index 0000000000..16ab084c2c--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/login/components/LoadingLogin.tsx@@ -0,0 +1,34 @@+import { AuthCard } from "@/components/auth/AuthCard";+import { Skeleton } from "@/components/ui/skeleton";++export function LoadingLogin() {+ return (+ <div className="flex h-full min-h-[85vh] flex-col items-center justify-center">+ <AuthCard title="">+ <div className="w-full space-y-6">+ <Skeleton className="mx-auto h-8 w-48" />+ <Skeleton className="h-12 w-full rounded-md" />+ <div className="flex w-full items-center">+ <Skeleton className="h-px flex-1" />+ <Skeleton className="mx-3 h-4 w-6" />+ <Skeleton className="h-px flex-1" />+ </div>+ <div className="space-y-2">+ <Skeleton className="h-4 w-12" />+ <Skeleton className="h-12 w-full rounded-md" />+ </div>+ <div className="space-y-2">+ <Skeleton className="h-4 w-16" />+ <Skeleton className="h-12 w-full rounded-md" />+ </div>+ <Skeleton className="h-16 w-full rounded-md" />+ <Skeleton className="h-12 w-full rounded-md" />+ <div className="flex justify-center space-x-1">+ <Skeleton className="h-4 w-32" />+ <Skeleton className="h-4 w-12" />+ </div>+ </div>+ </AuthCard>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/login/page.tsx b/autogpt_platform/frontend/src/app/(platform)/login/page.tsxindex 4ce4aab9a9..c08babe9f7 100644--- a/autogpt_platform/frontend/src/app/(platform)/login/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/login/page.tsx@@ -1,26 +1,15 @@"use client";-import {- AuthBottomText,- AuthButton,- AuthCard,- AuthFeedback,- AuthHeader,- GoogleOAuthButton,- PasswordInput,- Turnstile,-} from "@/components/auth";-import {- Form,- FormControl,- FormField,- FormItem,- FormLabel,- FormMessage,-} from "@/components/ui/form";-import { Input } from "@/components/ui/input";-import LoadingBox from "@/components/ui/loading";+import { Button } from "@/components/atoms/Button/Button";+import { Input } from "@/components/atoms/Input/Input";+import { Link } from "@/components/atoms/Link/Link";+import { AuthCard } from "@/components/auth/AuthCard";+import AuthFeedback from "@/components/auth/AuthFeedback";+import { EmailNotAllowedModal } from "@/components/auth/EmailNotAllowedModal";+import { GoogleOAuthButton } from "@/components/auth/GoogleOAuthButton";+import Turnstile from "@/components/auth/Turnstile";+import { Form, FormField } from "@/components/ui/form";import { getBehaveAs } from "@/lib/utils";-import Link from "next/link";+import { LoadingLogin } from "./components/LoadingLogin";import { useLoginPage } from "./useLoginPage";export default function LoginPage() {@@ -30,17 +19,19 @@ export default function LoginPage() {turnstile,captchaKey,isLoading,- isCloudEnv,isLoggedIn,+ isCloudEnv,isUserLoading,isGoogleLoading,+ showNotAllowedModal,isSupabaseAvailable,handleSubmit,handleProviderLogin,+ handleCloseNotAllowedModal,} = useLoginPage();if (isUserLoading || isLoggedIn) {- return <LoadingBox className="h-[80vh]" />;+ return <LoadingLogin />;}if (!isSupabaseAvailable) {@@ -52,99 +43,100 @@ export default function LoginPage() {}return (- <AuthCard className="mx-auto">- <AuthHeader>Login to your account</AuthHeader>-- {isCloudEnv ? (- <>- <div className="mb-6">- <GoogleOAuthButton- onClick={() => handleProviderLogin("google")}- isLoading={isGoogleLoading}- disabled={isLoading}+ <div className="mt-16 flex h-full min-h-[85vh] flex-col items-center justify-center md:mt-0">+ <AuthCard title="Login to your account">+ {isCloudEnv ? (+ <>+ <div className="mb-3 w-full">+ <GoogleOAuthButton+ onClick={() => handleProviderLogin("google")}+ isLoading={isGoogleLoading}+ disabled={isLoading}+ />+ </div>+ <div className="mb-3 flex w-full items-center">+ <div className="h-px flex-1 bg-gray-300"></div>+ <span className="text-md mx-3 text-gray-500">or</span>+ <div className="h-px flex-1 bg-gray-300"></div>+ </div>+ </>+ ) : null}+ <Form {...form}>+ <form onSubmit={handleSubmit} className="flex w-full flex-col gap-1">+ <FormField+ control={form.control}+ name="email"+ render={({ field }) => (+ <Input+ id={field.name}+ label="Email"+ placeholder="[email protected]"+ type="email"+ autoComplete="username"+ className="w-full"+ error={form.formState.errors.email?.message}+ {...field}+ />+ )}+ />+ <FormField+ control={form.control}+ name="password"+ render={({ field }) => (+ <Input+ id={field.name}+ label="Password"+ placeholder="•••••••••••••••••••••"+ type="password"+ autoComplete="current-password"+ error={form.formState.errors.password?.message}+ hint={+ <Link variant="secondary" href="/reset-password">+ Forgot password?+ </Link>+ }+ {...field}+ />+ )}/>- </div>- <div className="mb-6 flex items-center">- <div className="flex-1 border-t border-gray-300"></div>- <span className="mx-3 text-sm text-gray-500">or</span>- <div className="flex-1 border-t border-gray-300"></div>- </div>- </>- ) : null}- <Form {...form}>- <form onSubmit={handleSubmit}>- <FormField- control={form.control}- name="email"- render={({ field }) => (- <FormItem className="mb-6">- <FormLabel>Email</FormLabel>- <FormControl>- <Input- placeholder="[email protected]"- {...field}- type="email" // Explicitly specify email type- autoComplete="username" // Added for password managers- />- </FormControl>- <FormMessage />- </FormItem>- )}- />- <FormField- control={form.control}- name="password"- render={({ field }) => (- <FormItem className="mb-6">- <FormLabel className="flex w-full items-center justify-between">- <span>Password</span>- <Link- href="/reset-password"- className="text-sm font-normal leading-normal text-black underline"- >- Forgot your password?- </Link>- </FormLabel>- <FormControl>- <PasswordInput- {...field}- autoComplete="current-password" // Added for password managers- />- </FormControl>- <FormMessage />- </FormItem>- )}- />+ {/* Turnstile CAPTCHA Component */}+ <Turnstile+ key={captchaKey}+ siteKey={turnstile.siteKey}+ onVerify={turnstile.handleVerify}+ onExpire={turnstile.handleExpire}+ onError={turnstile.handleError}+ setWidgetId={turnstile.setWidgetId}+ action="login"+ shouldRender={turnstile.shouldRender}+ />- {/* Turnstile CAPTCHA Component */}- <Turnstile- key={captchaKey}- siteKey={turnstile.siteKey}- onVerify={turnstile.handleVerify}- onExpire={turnstile.handleExpire}- onError={turnstile.handleError}- setWidgetId={turnstile.setWidgetId}- action="login"- shouldRender={turnstile.shouldRender}+ <Button+ variant="primary"+ loading={isLoading}+ type="submit"+ className="mt-6 w-full"+ >+ {isLoading ? "Logging in..." : "Login"}+ </Button>+ </form>+ <AuthFeedback+ type="login"+ message={feedback}+ isError={!!feedback}+ behaveAs={getBehaveAs()}/>-- <AuthButton isLoading={isLoading} type="submit">- Login- </AuthButton>- </form>- <AuthFeedback- type="login"- message={feedback}- isError={!!feedback}- behaveAs={getBehaveAs()}+ </Form>+ <AuthCard.BottomText+ text="Don't have an account?"+ link={{ text: "Sign up", href: "/signup" }}/>- </Form>- <AuthBottomText- text="Don't have an account?"- linkText="Sign up"- href="/signup"+ </AuthCard>+ <EmailNotAllowedModal+ isOpen={showNotAllowedModal}+ onClose={handleCloseNotAllowedModal}/>- </AuthCard>+ </div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/login/useLoginPage.ts b/autogpt_platform/frontend/src/app/(platform)/login/useLoginPage.tsindex a394b6e8a4..02f1e24963 100644--- a/autogpt_platform/frontend/src/app/(platform)/login/useLoginPage.ts+++ b/autogpt_platform/frontend/src/app/(platform)/login/useLoginPage.ts@@ -1,22 +1,24 @@import { useTurnstile } from "@/hooks/useTurnstile";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";+import { BehaveAs, getBehaveAs } from "@/lib/utils";import { loginFormSchema, LoginProvider } from "@/types/auth";import { zodResolver } from "@hookform/resolvers/zod";import { useRouter } from "next/navigation";import { useCallback, useEffect, useState } from "react";import { useForm } from "react-hook-form";-import { login, providerLogin } from "./actions";import z from "zod";-import { BehaveAs } from "@/lib/utils";-import { getBehaveAs } from "@/lib/utils";+import { login, providerLogin } from "./actions";+import { useToast } from "@/components/molecules/Toast/use-toast";export function useLoginPage() {const { supabase, user, isUserLoading } = useSupabase();const [feedback, setFeedback] = useState<string | null>(null);const [captchaKey, setCaptchaKey] = useState(0);const router = useRouter();+ const { toast } = useToast();const [isLoading, setIsLoading] = useState(false);const [isGoogleLoading, setIsGoogleLoading] = useState(false);+ const [showNotAllowedModal, setShowNotAllowedModal] = useState(false);const isCloudEnv = getBehaveAs() === BehaveAs.CLOUD;const turnstile = useTurnstile({@@ -44,29 +46,42 @@ export function useLoginPage() {async function handleProviderLogin(provider: LoginProvider) {setIsGoogleLoading(true);+try {const error = await providerLogin(provider);if (error) throw error;setFeedback(null);} catch (error) {resetCaptcha();- setFeedback(JSON.stringify(error));- } finally {setIsGoogleLoading(false);+ const errorString = JSON.stringify(error);+ if (errorString.includes("not_allowed")) {+ setShowNotAllowedModal(true);+ } else {+ setFeedback(errorString);+ }}}async function handleLogin(data: z.infer<typeof loginFormSchema>) {setIsLoading(true);if (!turnstile.verified) {- setFeedback("Please complete the CAPTCHA challenge.");+ toast({+ title: "Please complete the CAPTCHA challenge.",+ variant: "default",+ });+setIsLoading(false);resetCaptcha();return;}if (data.email.includes("@agpt.co")) {- setFeedback("Please use Google SSO to login using an AutoGPT email.");+ toast({+ title: "Please use Google SSO to login using an AutoGPT email.",+ variant: "default",+ });+setIsLoading(false);resetCaptcha();return;@@ -76,7 +91,11 @@ export function useLoginPage() {await supabase?.auth.refreshSession();setIsLoading(false);if (error) {- setFeedback(error);+ toast({+ title: error,+ variant: "destructive",+ });+resetCaptcha();// Always reset the turnstile on any errorturnstile.reset();@@ -95,8 +114,10 @@ export function useLoginPage() {isCloudEnv,isUserLoading,isGoogleLoading,+ showNotAllowedModal,isSupabaseAvailable: !!supabase,handleSubmit: form.handleSubmit(handleLogin),handleProviderLogin,+ handleCloseNotAllowedModal: () => setShowNotAllowedModal(false),};}diff --git a/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx b/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsxindex b1d375042d..593d56408e 100644--- a/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx@@ -1,43 +1,27 @@"use client";-import {- AuthButton,- AuthCard,- AuthFeedback,- AuthHeader,- PasswordInput,- Turnstile,-} from "@/components/auth";-import {- Form,- FormControl,- FormDescription,- FormField,- FormItem,- FormLabel,- FormMessage,-} from "@/components/ui/form";-import { Input } from "@/components/ui/input";+import { Button } from "@/components/atoms/Button/Button";+import { Input } from "@/components/atoms/Input/Input";+import { AuthCard } from "@/components/auth/AuthCard";+import Turnstile from "@/components/auth/Turnstile";+import { Form, FormField } from "@/components/ui/form";import LoadingBox from "@/components/ui/loading";import { useToast } from "@/components/molecules/Toast/use-toast";import { useTurnstile } from "@/hooks/useTurnstile";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";-import { getBehaveAs } from "@/lib/utils";import { changePasswordFormSchema, sendEmailFormSchema } from "@/types/auth";import { zodResolver } from "@hookform/resolvers/zod";import { useRouter, useSearchParams } from "next/navigation";-import { useCallback, useEffect, useState } from "react";+import { Suspense, useCallback, useEffect, useState } from "react";import { useForm } from "react-hook-form";import { z } from "zod";import { changePassword, sendResetEmail } from "./actions";-export default function ResetPasswordPage() {+function ResetPasswordContent() {const { supabase, user, isUserLoading } = useSupabase();const { toast } = useToast();const searchParams = useSearchParams();const router = useRouter();const [isLoading, setIsLoading] = useState(false);- const [feedback, setFeedback] = useState<string | null>(null);- const [isError, setIsError] = useState(false);const [disabled, setDisabled] = useState(false);const [sendEmailCaptchaKey, setSendEmailCaptchaKey] = useState(0);const [changePasswordCaptchaKey, setChangePasswordCaptchaKey] = useState(0);@@ -97,7 +81,6 @@ export default function ResetPasswordPage() {const onSendEmail = useCallback(async (data: z.infer<typeof sendEmailFormSchema>) => {setIsLoading(true);- setFeedback(null);if (!(await sendEmailForm.trigger())) {setIsLoading(false);@@ -105,8 +88,11 @@ export default function ResetPasswordPage() {}if (!sendEmailTurnstile.verified) {- setFeedback("Please complete the CAPTCHA challenge.");- setIsError(true);+ toast({+ title: "CAPTCHA Required",+ description: "Please complete the CAPTCHA challenge.",+ variant: "destructive",+ });setIsLoading(false);resetSendEmailCaptcha();return;@@ -118,24 +104,28 @@ export default function ResetPasswordPage() {);setIsLoading(false);if (error) {- setFeedback(error);- setIsError(true);+ toast({+ title: "Error",+ description: error,+ variant: "destructive",+ });resetSendEmailCaptcha();return;}setDisabled(true);- setFeedback(- "Password reset email sent if user exists. Please check your email.",- );- setIsError(false);+ toast({+ title: "Email Sent",+ description:+ "Password reset email sent if user exists. Please check your email.",+ variant: "default",+ });},- [sendEmailForm, sendEmailTurnstile, resetSendEmailCaptcha],+ [sendEmailForm, sendEmailTurnstile, resetSendEmailCaptcha, toast],);const onChangePassword = useCallback(async (data: z.infer<typeof changePasswordFormSchema>) => {setIsLoading(true);- setFeedback(null);if (!(await changePasswordForm.trigger())) {setIsLoading(false);@@ -143,8 +133,11 @@ export default function ResetPasswordPage() {}if (!changePasswordTurnstile.verified) {- setFeedback("Please complete the CAPTCHA challenge.");- setIsError(true);+ toast({+ title: "CAPTCHA Required",+ description: "Please complete the CAPTCHA challenge.",+ variant: "destructive",+ });setIsLoading(false);resetChangePasswordCaptcha();return;@@ -156,15 +149,26 @@ export default function ResetPasswordPage() {);setIsLoading(false);if (error) {- setFeedback(error);- setIsError(true);+ toast({+ title: "Error",+ description: error,+ variant: "destructive",+ });resetChangePasswordCaptcha();return;}- setFeedback("Password changed successfully. Redirecting to login.");- setIsError(false);+ toast({+ title: "Success",+ description: "Password changed successfully. Redirecting to login.",+ variant: "default",+ });},- [changePasswordForm, changePasswordTurnstile, resetChangePasswordCaptcha],+ [+ changePasswordForm,+ changePasswordTurnstile,+ resetChangePasswordCaptcha,+ toast,+ ],);if (isUserLoading) {@@ -180,39 +184,45 @@ export default function ResetPasswordPage() {}return (- <div className="flex min-h-screen items-center justify-center">- <AuthCard>- <AuthHeader>Reset Password</AuthHeader>+ <div className="flex h-full min-h-[85vh] w-full flex-col items-center justify-center">+ <AuthCard title="Reset Password">{user ? (- <form onSubmit={changePasswordForm.handleSubmit(onChangePassword)}>+ <form+ onSubmit={changePasswordForm.handleSubmit(onChangePassword)}+ className="flex w-full flex-col gap-1"+ ><Form {...changePasswordForm}><FormFieldcontrol={changePasswordForm.control}name="password"render={({ field }) => (- <FormItem className="mb-6">- <FormLabel>Password</FormLabel>- <FormControl>- <PasswordInput {...field} />- </FormControl>- <FormMessage />- </FormItem>+ <Input+ id={field.name}+ label="Password"+ type="password"+ placeholder="••••••••••••••••"+ error={+ changePasswordForm.formState.errors.password?.message+ }+ {...field}+ />)}/><FormFieldcontrol={changePasswordForm.control}name="confirmPassword"render={({ field }) => (- <FormItem className="mb-6">- <FormLabel>Confirm Password</FormLabel>- <FormControl>- <PasswordInput {...field} />- </FormControl>- <FormDescription className="text-sm font-normal leading-tight text-slate-500">- Password needs to be at least 12 characters long- </FormDescription>- <FormMessage />- </FormItem>+ <Input+ id={field.name}+ label="Confirm Password"+ type="password"+ placeholder="••••••••••••••••"+ error={+ changePasswordForm.formState.errors.confirmPassword+ ?.message+ }+ {...field}+ />)}/>@@ -228,35 +238,35 @@ export default function ResetPasswordPage() {shouldRender={changePasswordTurnstile.shouldRender}/>- <AuthButton- onClick={() => onChangePassword(changePasswordForm.getValues())}- isLoading={isLoading}+ <Button+ variant="primary"+ loading={isLoading}type="submit"+ className="mt-6 w-full"+ onClick={() => onChangePassword(changePasswordForm.getValues())}>- Update password- </AuthButton>- <AuthFeedback- type="login"- message={feedback}- isError={isError}- behaveAs={getBehaveAs()}- />+ {isLoading ? "Updating password..." : "Update password"}+ </Button></Form></form>) : (- <form onSubmit={sendEmailForm.handleSubmit(onSendEmail)}>+ <form+ onSubmit={sendEmailForm.handleSubmit(onSendEmail)}+ className="flex w-full flex-col gap-1"+ ><Form {...sendEmailForm}><FormFieldcontrol={sendEmailForm.control}name="email"render={({ field }) => (- <FormItem className="mb-6">- <FormLabel>Email</FormLabel>- <FormControl>- <Input placeholder="[email protected]" {...field} />- </FormControl>- <FormMessage />- </FormItem>+ <Input+ id={field.name}+ label="Email"+ placeholder="[email protected]"+ type="email"+ error={sendEmailForm.formState.errors.email?.message}+ {...field}+ />)}/>@@ -272,20 +282,16 @@ export default function ResetPasswordPage() {shouldRender={sendEmailTurnstile.shouldRender}/>- <AuthButton- onClick={() => onSendEmail(sendEmailForm.getValues())}- isLoading={isLoading}+ <Button+ variant="primary"+ loading={isLoading}disabled={disabled}type="submit"+ className="mt-6 w-full"+ onClick={() => onSendEmail(sendEmailForm.getValues())}>Send reset email- </AuthButton>- <AuthFeedback- type="login"- message={feedback}- isError={isError}- behaveAs={getBehaveAs()}- />+ </Button></Form></form>)}@@ -293,3 +299,11 @@ export default function ResetPasswordPage() {</div>);}++export default function ResetPasswordPage() {+ return (+ <Suspense fallback={<LoadingBox className="h-[80vh]" />}>+ <ResetPasswordContent />+ </Suspense>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/signup/components/LoadingSignup.tsx b/autogpt_platform/frontend/src/app/(platform)/signup/components/LoadingSignup.tsxnew file mode 100644index 0000000000..b29ebd20e2--- /dev/null+++ b/autogpt_platform/frontend/src/app/(platform)/signup/components/LoadingSignup.tsx@@ -0,0 +1,29 @@+import { AuthCard } from "@/components/auth/AuthCard";+import { Skeleton } from "@/components/ui/skeleton";++export function LoadingSignup() {+ return (+ <div className="flex h-full min-h-[85vh] flex-col items-center justify-center">+ <AuthCard title="">+ <Skeleton className="mx-auto h-8 w-48" />+ <Skeleton className="h-12 w-full rounded-md" />+ <div className="w-full space-y-6">+ <div className="space-y-2">+ <Skeleton className="h-4 w-12" />+ <Skeleton className="h-12 w-full rounded-md" />+ </div>+ <div className="space-y-2">+ <Skeleton className="h-4 w-16" />+ <Skeleton className="h-12 w-full rounded-md" />+ </div>+ <Skeleton className="h-16 w-full rounded-md" />+ <Skeleton className="h-12 w-full rounded-md" />+ <div className="flex justify-center space-x-1">+ <Skeleton className="h-4 w-32" />+ <Skeleton className="h-4 w-12" />+ </div>+ </div>+ </AuthCard>+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/app/(platform)/signup/page.tsx b/autogpt_platform/frontend/src/app/(platform)/signup/page.tsxindex 8ec99955b3..344edd16c9 100644--- a/autogpt_platform/frontend/src/app/(platform)/signup/page.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/signup/page.tsx@@ -1,28 +1,25 @@"use client";++import { Button } from "@/components/atoms/Button/Button";+import { Input } from "@/components/atoms/Input/Input";+import { Link } from "@/components/atoms/Link/Link";+import { Text } from "@/components/atoms/Text/Text";+import { AuthCard } from "@/components/auth/AuthCard";+import AuthFeedback from "@/components/auth/AuthFeedback";+import { EmailNotAllowedModal } from "@/components/auth/EmailNotAllowedModal";+import { GoogleOAuthButton } from "@/components/auth/GoogleOAuthButton";+import Turnstile from "@/components/auth/Turnstile";+import { Checkbox } from "@/components/ui/checkbox";import {Form,FormControl,- FormDescription,FormField,FormItem,FormLabel,- FormMessage,} from "@/components/ui/form";-import { Input } from "@/components/ui/input";-import Link from "next/link";-import { Checkbox } from "@/components/ui/checkbox";-import LoadingBox from "@/components/ui/loading";-import {- AuthCard,- AuthHeader,- AuthButton,- AuthBottomText,- GoogleOAuthButton,- PasswordInput,- Turnstile,-} from "@/components/auth";-import AuthFeedback from "@/components/auth/AuthFeedback";import { getBehaveAs } from "@/lib/utils";+import { WarningOctagonIcon } from "@phosphor-icons/react/dist/ssr";+import { LoadingSignup } from "./components/LoadingSignup";import { useSignupPage } from "./useSignupPage";export default function SignupPage() {@@ -36,13 +33,15 @@ export default function SignupPage() {isCloudEnv,isUserLoading,isGoogleLoading,+ showNotAllowedModal,isSupabaseAvailable,handleSubmit,handleProviderSignup,+ handleCloseNotAllowedModal,} = useSignupPage();if (isUserLoading || isLoggedIn) {- return <LoadingBox className="h-[80vh]" />;+ return <LoadingSignup />;}if (!isSupabaseAvailable) {@@ -53,143 +52,171 @@ export default function SignupPage() {);}+ const confirmPasswordError = form.formState.errors.confirmPassword?.message;+ const termsError = form.formState.errors.agreeToTerms?.message;+return (- <AuthCard className="mx-auto mt-12">- <AuthHeader>Create a new account</AuthHeader>+ <div className="mt-24 flex h-full min-h-[85vh] flex-col items-center justify-center md:mt-0">+ <AuthCard title="Create a new account">+ {isCloudEnv ? (+ <>+ <div className="mb-2 w-full">+ <GoogleOAuthButton+ onClick={() => handleProviderSignup("google")}+ isLoading={isGoogleLoading}+ disabled={isLoading}+ />+ </div>+ <div className="mb-3 flex w-full items-center">+ <div className="h-px flex-1 bg-gray-300"></div>+ <span className="text-md mx-3 text-gray-500">or</span>+ <div className="h-px flex-1 bg-gray-300"></div>+ </div>+ </>+ ) : null}- {isCloudEnv ? (- <>- <div className="mb-6">- <GoogleOAuthButton- onClick={() => handleProviderSignup("google")}- isLoading={isGoogleLoading}- disabled={isLoading}+ <Form {...form}>+ <form onSubmit={handleSubmit} className="flex w-full flex-col gap-1">+ <FormField+ control={form.control}+ name="email"+ render={({ field }) => (+ <Input+ id={field.name}+ label="Email"+ placeholder="[email protected]"+ type="email"+ autoComplete="email"+ error={form.formState.errors.email?.message}+ {...field}+ />+ )}/>- </div>- <div className="mb-6 flex items-center">- <div className="flex-1 border-t border-gray-300"></div>- <span className="mx-3 text-sm text-gray-500">or</span>- <div className="flex-1 border-t border-gray-300"></div>- </div>- </>- ) : null}-- <Form {...form}>- <form onSubmit={handleSubmit}>- <FormField- control={form.control}- name="email"- render={({ field }) => (- <FormItem className="mb-6">- <FormLabel>Email</FormLabel>- <FormControl>+ <FormField+ control={form.control}+ name="password"+ render={({ field }) => {+ console.log(field);+ return (<Input- placeholder="[email protected]"+ id={field.name}+ label="Password"+ placeholder="•••••••••••••••••••••"+ type="password"+ autoComplete="new-password"+ error={form.formState.errors.password?.message}{...field}- type="email"- autoComplete="email"/>- </FormControl>- <FormMessage />- </FormItem>- )}- />- <FormField- control={form.control}- name="password"- render={({ field }) => (- <FormItem className="mb-6">- <FormLabel>Password</FormLabel>- <FormControl>- <PasswordInput {...field} autoComplete="new-password" />- </FormControl>- <FormMessage />- </FormItem>- )}- />- <FormField- control={form.control}- name="confirmPassword"- render={({ field }) => (- <FormItem className="mb-4">- <FormLabel>Confirm Password</FormLabel>- <FormControl>- <PasswordInput {...field} autoComplete="new-password" />- </FormControl>- <FormDescription className="text-sm font-normal leading-tight text-slate-500">- Password needs to be at least 12 characters long- </FormDescription>- <FormMessage />- </FormItem>- )}- />+ );+ }}+ />+ <FormField+ control={form.control}+ name="confirmPassword"+ render={({ field }) => (+ <Input+ id={field.name}+ label="Confirm Password"+ placeholder="•••••••••••••••••••••"+ type="password"+ autoComplete="new-password"+ error={confirmPasswordError}+ {...field}+ />+ )}+ />+ <FormField+ control={form.control}+ name="agreeToTerms"+ render={({ field }) => (+ <>+ <FormItem className="mt-6 flex w-full flex-row items-center -space-y-1 space-x-2">+ <FormControl>+ <Checkbox+ checked={field.value}+ onCheckedChange={field.onChange}+ className="relative bottom-px"+ />+ </FormControl>+ <div>+ <FormLabel className="flex flex-wrap items-center gap-1">+ <Text+ variant="body-medium"+ className="inline-block text-slate-950"+ >+ I agree to the+ </Text>+ <Link+ href="https://auto-gpt.notion.site/Terms-of-Use-11400ef5bece80d0b087d7831c5fd6bf"+ variant="secondary"+ >+ Terms of Use+ </Link>+ <Text+ variant="body-medium"+ className="inline-block text-slate-950"+ >+ and+ </Text>+ <Link+ href="https://www.notion.so/auto-gpt/Privacy-Policy-ab11c9c20dbd4de1a15dcffe84d77984"+ variant="secondary"+ >+ Privacy Policy+ </Link>+ </FormLabel>+ </div>+ </FormItem>+ {termsError ? (+ <div className="flex items-center gap-2">+ <WarningOctagonIcon className="h-4 w-4 text-red-500" />+ <Text variant="small-medium" className="!text-red-500">+ {termsError}+ </Text>+ </div>+ ) : null}+ </>+ )}+ />- {/* Turnstile CAPTCHA Component */}- <Turnstile- key={captchaKey}- siteKey={turnstile.siteKey}- onVerify={turnstile.handleVerify}- onExpire={turnstile.handleExpire}- onError={turnstile.handleError}- setWidgetId={turnstile.setWidgetId}- action="signup"- shouldRender={turnstile.shouldRender}- />+ {/* Turnstile CAPTCHA Component */}+ <Turnstile+ key={captchaKey}+ siteKey={turnstile.siteKey}+ onVerify={turnstile.handleVerify}+ onExpire={turnstile.handleExpire}+ onError={turnstile.handleError}+ setWidgetId={turnstile.setWidgetId}+ action="signup"+ shouldRender={turnstile.shouldRender}+ />- <AuthButton isLoading={isLoading} type="submit">- Sign up- </AuthButton>- <FormField- control={form.control}- name="agreeToTerms"- render={({ field }) => (- <FormItem className="mt-6 flex flex-row items-start -space-y-1 space-x-2">- <FormControl>- <Checkbox- checked={field.value}- onCheckedChange={field.onChange}- />- </FormControl>- <div className="">- <FormLabel>- <span className="mr-1 text-sm font-normal leading-normal text-slate-950">- I agree to the- </span>- <Link- href="https://auto-gpt.notion.site/Terms-of-Use-11400ef5bece80d0b087d7831c5fd6bf"- className="text-sm font-normal leading-normal text-slate-950 underline"- >- Terms of Use- </Link>- <span className="mx-1 text-sm font-normal leading-normal text-slate-950">- and- </span>- <Link- href="https://www.notion.so/auto-gpt/Privacy-Policy-ab11c9c20dbd4de1a15dcffe84d77984"- className="text-sm font-normal leading-normal text-slate-950 underline"- >- Privacy Policy- </Link>- </FormLabel>- <FormMessage />- </div>- </FormItem>- )}- />- </form>- </Form>- <AuthFeedback- type="signup"- message={feedback}- isError={!!feedback}- behaveAs={getBehaveAs()}- />+ <Button+ variant="primary"+ loading={isLoading}+ type="submit"+ className="mt-6 w-full"+ >+ {isLoading ? "Signing up..." : "Sign up"}+ </Button>+ </form>+ </Form>+ <AuthFeedback+ type="signup"+ message={feedback}+ isError={!!feedback}+ behaveAs={getBehaveAs()}+ />- <AuthBottomText- text="Already a member?"- linkText="Log in"- href="/login"+ <AuthCard.BottomText+ text="Already a member?"+ link={{ text: "Log in", href: "/login" }}+ />+ </AuthCard>+ <EmailNotAllowedModal+ isOpen={showNotAllowedModal}+ onClose={handleCloseNotAllowedModal}/>- </AuthCard>+ </div>);}diff --git a/autogpt_platform/frontend/src/app/(platform)/signup/useSignupPage.ts b/autogpt_platform/frontend/src/app/(platform)/signup/useSignupPage.tsindex bc3a64291a..b3409a70bc 100644--- a/autogpt_platform/frontend/src/app/(platform)/signup/useSignupPage.ts+++ b/autogpt_platform/frontend/src/app/(platform)/signup/useSignupPage.ts@@ -1,22 +1,26 @@import { useTurnstile } from "@/hooks/useTurnstile";import { useSupabase } from "@/lib/supabase/hooks/useSupabase";-import { signupFormSchema, LoginProvider } from "@/types/auth";+import { BehaveAs, getBehaveAs } from "@/lib/utils";+import { LoginProvider, signupFormSchema } from "@/types/auth";import { zodResolver } from "@hookform/resolvers/zod";import { useRouter } from "next/navigation";import { useCallback, useEffect, useState } from "react";import { useForm } from "react-hook-form";-import { signup } from "./actions";-import { providerLogin } from "../login/actions";import z from "zod";-import { BehaveAs, getBehaveAs } from "@/lib/utils";+import { providerLogin } from "../login/actions";+import { signup } from "./actions";+import { useToast } from "@/components/molecules/Toast/use-toast";export function useSignupPage() {const { supabase, user, isUserLoading } = useSupabase();const [feedback, setFeedback] = useState<string | null>(null);const [captchaKey, setCaptchaKey] = useState(0);+ const { toast } = useToast();const router = useRouter();const [isLoading, setIsLoading] = useState(false);const [isGoogleLoading, setIsGoogleLoading] = useState(false);+ const [showNotAllowedModal, setShowNotAllowedModal] = useState(false);+const isCloudEnv = getBehaveAs() === BehaveAs.CLOUD;const turnstile = useTurnstile({@@ -47,10 +51,13 @@ export function useSignupPage() {async function handleProviderSignup(provider: LoginProvider) {setIsGoogleLoading(true);const error = await providerLogin(provider);- setIsGoogleLoading(false);if (error) {+ setIsGoogleLoading(false);resetCaptcha();- setFeedback(error);+ toast({+ title: error,+ variant: "destructive",+ });return;}setFeedback(null);@@ -60,16 +67,21 @@ export function useSignupPage() {setIsLoading(true);if (!turnstile.verified) {- setFeedback("Please complete the CAPTCHA challenge.");+ toast({+ title: "Please complete the CAPTCHA challenge.",+ variant: "default",+ });setIsLoading(false);resetCaptcha();return;}if (data.email.includes("@agpt.co")) {- setFeedback(- "Please use Google SSO to create an account using an AutoGPT email.",- );+ toast({+ title:+ "Please use Google SSO to create an account using an AutoGPT email.",+ variant: "default",+ });setIsLoading(false);resetCaptcha();@@ -83,8 +95,13 @@ export function useSignupPage() {setFeedback("User with this email already exists");turnstile.reset();return;+ } else if (error === "not_allowed") {+ setShowNotAllowedModal(true);} else {- setFeedback(error);+ toast({+ title: error,+ variant: "destructive",+ });resetCaptcha();turnstile.reset();}@@ -103,8 +120,10 @@ export function useSignupPage() {isCloudEnv,isUserLoading,isGoogleLoading,+ showNotAllowedModal,isSupabaseAvailable: !!supabase,handleSubmit: form.handleSubmit(handleSignup),+ handleCloseNotAllowedModal: () => setShowNotAllowedModal(false),handleProviderSignup,};}diff --git a/autogpt_platform/frontend/src/components/atoms/Button/helpers.ts b/autogpt_platform/frontend/src/components/atoms/Button/helpers.tsnew file mode 100644index 0000000000..80674c3acd--- /dev/null+++ b/autogpt_platform/frontend/src/components/atoms/Button/helpers.ts@@ -0,0 +1,55 @@+import { cva, VariantProps } from "class-variance-authority";+import { LinkProps } from "next/link";++// Extended button variants based on our design system+export const extendedButtonVariants = cva(+ "inline-flex items-center justify-center whitespace-nowrap font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-neutral-950 disabled:pointer-events-none disabled:opacity-50 font-sans leading-snug border",+ {+ variants: {+ variant: {+ primary:+ "bg-zinc-800 border-zinc-800 text-white hover:bg-zinc-900 hover:border-zinc-900 rounded-full disabled:text-white disabled:bg-zinc-200 disabled:border-zinc-200 disabled:opacity-1",+ secondary:+ "bg-zinc-100 border-zinc-100 text-black hover:bg-zinc-300 hover:border-zinc-300 rounded-full disabled:text-zinc-300 disabled:bg-zinc-50 disabled:border-zinc-50 disabled:opacity-1",+ destructive:+ "bg-red-500 border-red-500 text-white hover:bg-red-600 hover:border-red-600 rounded-full disabled:text-white disabled:bg-zinc-200 disabled:border-zinc-200 disabled:opacity-1",+ outline:+ "bg-transparent border-zinc-700 text-black hover:bg-zinc-100 hover:border-zinc-700 rounded-full disabled:border-zinc-200 disabled:text-zinc-200 disabled:opacity-1",+ ghost:+ "bg-transparent border-transparent text-black hover:bg-zinc-50 hover:border-zinc-50 rounded-full disabled:text-zinc-200 disabled:opacity-1",+ icon: "bg-white text-black border border-zinc-600 hover:bg-zinc-100 rounded-[96px] disabled:opacity-1",+ },+ size: {+ small: "px-3 py-2 text-sm gap-1.5 h-[2.25rem]",+ large: "min-w-20 px-4 py-3 text-sm gap-2",+ icon: "p-3",+ },+ },+ defaultVariants: {+ variant: "primary",+ size: "large",+ },+ },+);++type BaseButtonProps = {+ loading?: boolean;+ leftIcon?: React.ReactNode;+ rightIcon?: React.ReactNode;+ asChild?: boolean;+} & VariantProps<typeof extendedButtonVariants>;++type ButtonAsButton = BaseButtonProps &+ React.ButtonHTMLAttributes<HTMLButtonElement> & {+ as?: "button";+ href?: never;+ };++type ButtonAsLink = BaseButtonProps &+ Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> &+ LinkProps & {+ as: "NextLink";+ disabled?: boolean;+ };++export type ButtonProps = ButtonAsButton | ButtonAsLink;diff --git a/autogpt_platform/frontend/src/components/atoms/Card/Card.tsx b/autogpt_platform/frontend/src/components/atoms/Card/Card.tsxnew file mode 100644index 0000000000..9898e6b0cc--- /dev/null+++ b/autogpt_platform/frontend/src/components/atoms/Card/Card.tsx@@ -0,0 +1,15 @@+import { cn } from "@/lib/utils";+import { ReactNode } from "react";++interface Props {+ children: ReactNode;+ className?: string;+}++export function Card({ children, className }: Props) {+ return (+ <div className={cn("rounded-large bg-white p-6 shadow-md", className)}>+ {children}+ </div>+ );+}diff --git a/autogpt_platform/frontend/src/components/atoms/Input/Input.stories.tsx b/autogpt_platform/frontend/src/components/atoms/Input/Input.stories.tsxindex ccde5622bf..a78649f008 100644--- a/autogpt_platform/frontend/src/components/atoms/Input/Input.stories.tsx+++ b/autogpt_platform/frontend/src/components/atoms/Input/Input.stories.tsx@@ -115,19 +115,35 @@ export const InputTypes: Story = {function renderInputTypes() {return (<div className="w-full max-w-md space-y-8">- <Input label="Full Name" type="text" placeholder="Enter your full name" />- <Input label="Email" type="email" placeholder="[email protected]" />+ <Input+ label="Full Name"+ type="text"+ placeholder="Enter your full name"+ id="full-name"+ />+ <Input+ label="Email"+ type="email"+ placeholder="[email protected]"+ id="email"+ /><Inputlabel="Password"type="password"placeholder="Enter your password"+ id="password"/><div className="flex flex-col gap-4"><p className="font-mono text-sm">If type="number" prop is provided, the input will allow onlypositive or negative numbers. No decimal limiting.</p>- <Input label="Age" type="number" placeholder="Enter your age" />+ <Input+ label="Age"+ type="number"+ placeholder="Enter your age"+ id="age"+ /></div><div className="flex flex-col gap-4"><p className="font-mono text-sm">@@ -139,6 +155,7 @@ function renderInputTypes() {type="amount"placeholder="Enter amount"decimalCount={2}+ id="price"/></div><div className="flex flex-col gap-4">@@ -146,9 +163,19 @@ function renderInputTypes() {If type="tel" prop is provided, the input will allow onlynumbers, spaces, parentheses (), plus +, and brackets [].</p>- <Input label="Phone" type="tel" placeholder="+1 (555) 123-4567" />+ <Input+ label="Phone"+ type="tel"+ placeholder="+1 (555) 123-4567"+ id="phone"+ /></div>- <Input label="Website" type="url" placeholder="https://example.com" />+ <Input+ label="Website"+ type="url"+ placeholder="https://example.com"+ id="website"+ /></div>);}diff --git a/autogpt_platform/frontend/src/components/atoms/Input/Input.tsx b/autogpt_platform/frontend/src/components/atoms/Input/Input.tsxindex 561d8896f3..d7f3766458 100644--- a/autogpt_platform/frontend/src/components/atoms/Input/Input.tsx+++ b/autogpt_platform/frontend/src/components/atoms/Input/Input.tsx@@ -1,13 +1,17 @@import { Input as BaseInput, type InputProps } from "@/components/ui/input";import { cn } from "@/lib/utils";+import { Eye, EyeSlash } from "@phosphor-icons/react";+import { ReactNode, useState } from "react";import { Text } from "../Text/Text";import { useInput } from "./useInput";export interface TextFieldProps extends InputProps {label: string;+ id: string;hideLabel?: boolean;decimalCount?: number; // Only used for type="amount"error?: string;+ hint?: ReactNode;}export function Input({@@ -16,51 +20,93 @@ export function Input({placeholder,hideLabel = false,decimalCount,+ hint,error,...props}: TextFieldProps) {const { handleInputChange } = useInput({ ...props, decimalCount });+ const [showPassword, setShowPassword] = useState(false);++ const isPasswordType = props.type === "password";+ const inputType = showPassword ? "text" : props.type;++ function handleMouseDown() {+ setShowPassword(true);+ }++ function handleMouseUp() {+ setShowPassword(false);+ }++ function handleMouseLeave() {+ setShowPassword(false);+ }const input = (- <BaseInput- className={cn(- // Override the default input styles with Figma design- "h-[2.875rem] rounded-3xl border border-zinc-200 bg-white px-4 py-2.5 shadow-none",- "font-normal leading-6 text-black",- "placeholder:font-normal placeholder:text-zinc-400",- // Focus and hover states- "focus:border-zinc-400 focus:shadow-none focus:outline-none focus:ring-1 focus:ring-zinc-400 focus:ring-offset-0",- // Error state- error &&- "border-2 border-red-500 focus:border-red-500 focus:ring-red-500",- className,+ <div className="relative">+ <BaseInput+ className={cn(+ // Override the default input styles with Figma design+ "h-[2.875rem] rounded-3xl border border-zinc-200 bg-white px-4 py-2.5 shadow-none",+ "font-normal text-black",+ "placeholder:font-normal placeholder:text-zinc-400",+ // Focus and hover states+ "focus:border-zinc-400 focus:shadow-none focus:outline-none focus:ring-1 focus:ring-zinc-400 focus:ring-offset-0",+ // Error state+ error &&+ "border-1.5 border-red-500 focus:border-red-500 focus:ring-red-500",+ // Add padding for password toggle button+ isPasswordType && "pr-12",+ className,+ )}+ placeholder={placeholder || label}+ onChange={handleInputChange}+ {...(hideLabel ? { "aria-label": label } : {})}+ {...props}+ type={inputType}+ />+ {isPasswordType && (+ <button+ type="button"+ onMouseDown={handleMouseDown}+ onMouseUp={handleMouseUp}+ onMouseLeave={handleMouseLeave}+ className="absolute right-4 top-1/2 -translate-y-1/2 text-zinc-400 transition-colors hover:text-zinc-600"+ aria-label="Press and hold to show password"+ >+ {showPassword ? <Eye size={16} /> : <EyeSlash size={16} />}+ </button>)}- type={props.type}- placeholder={placeholder || label}- onChange={handleInputChange}- {...(hideLabel ? { "aria-label": label } : {})}- {...props}- />+ </div>);const inputWithError = (- <div className="flex flex-col gap-1">+ <div className="relative mb-6">{input}- {error && (- <Text variant="small-medium" as="span" className="!text-red-500">- {error}- </Text>- )}+ <Text+ variant="small-medium"+ as="span"+ className={cn(+ "absolute left-0 top-full mt-1 !text-red-500 transition-opacity duration-200",+ error ? "opacity-100" : "opacity-0",+ )}+ >+ {error || " "}{" "}+ {/* Always render with space to maintain consistent height calculation */}+ </Text></div>);return hideLabel ? (inputWithError) : (- <label className="flex flex-col gap-2">- <Text variant="body-medium" as="span" className="text-black">- {label}- </Text>+ <label htmlFor={props.id} className="flex flex-col gap-2">+ <div className="flex items-center justify-between">+ <Text variant="body-medium" as="span" className="text-black">+ {label}+ </Text>+ {hint}+ </div>{inputWithError}</label>);diff --git a/autogpt_platform/frontend/src/components/atoms/Link/Link.tsx b/autogpt_platform/frontend/src/components/atoms/Link/Link.tsxindex 80277d1b38..6256a944bb 100644--- a/autogpt_platform/frontend/src/components/atoms/Link/Link.tsx+++ b/autogpt_platform/frontend/src/components/atoms/Link/Link.tsx@@ -23,7 +23,7 @@ const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link() {const linkClasses = cn(// Base styles from Figma- "font-['Geist'] text-sm font-medium leading-[22px] text-[var(--AutoGPT-Text-text-black,#141414)]",+ "font-sans text-sm font-medium leading-[22px] text-[var(--AutoGPT-Text-text-black,#141414)]",// Variant-specific underline stylesvariant === "primary" && "hover:underline",variant === "secondary" && "underline",diff --git a/autogpt_platform/frontend/src/components/atoms/Text/Text.stories.tsx b/autogpt_platform/frontend/src/components/atoms/Text/Text.stories.tsxindex 4456539b5c..b8f2cb72fa 100644--- a/autogpt_platform/frontend/src/components/atoms/Text/Text.stories.tsx+++ b/autogpt_platform/frontend/src/components/atoms/Text/Text.stories.tsx@@ -94,8 +94,6 @@ export function AllVariants() {code={`<Text variant="small">Small</Text><Text variant="small-medium">Small Medium</Text>`}/>- <Text variant="subtle">Subtle</Text>- <StoryCode code={`<Text variant="subtle">Subtle</Text>`} /></div>);}@@ -128,7 +126,6 @@ export function BodyText() {<Text variant="body-medium">Body Medium</Text><Text variant="small">Small</Text><Text variant="small-medium">Small Medium</Text>- <Text variant="subtle">Subtle</Text></div>);}diff --git a/autogpt_platform/frontend/src/components/atoms/Text/helpers.ts b/autogpt_platform/frontend/src/components/atoms/Text/helpers.tsindex 050430bb5c..25edc6ed51 100644--- a/autogpt_platform/frontend/src/components/atoms/Text/helpers.ts+++ b/autogpt_platform/frontend/src/components/atoms/Text/helpers.ts@@ -14,24 +14,24 @@ export type As =export const variants = {// Headings- h1: "font-poppins text-5xl font-semibold leading-[56px] text-zinc-800",- h2: "font-poppins text-4xl font-normal leading-[52px] text-zinc-800",- h3: "font-poppins text-3xl font-medium leading-10 text-zinc-800",- h4: "font-poppins text-base font-medium leading-normal text-zinc-800",+ h1: "font-poppins text-[2.75rem] font-semibold leading-[3.5rem] text-zinc-800",+ h2: "font-poppins text-[2.25rem] font-normal leading-[3.25rem] text-zinc-800",+ h3: "font-poppins text-[1.75rem] font-medium leading-[2.5rem] text-zinc-800",+ h4: "font-poppins text-[1rem] font-medium leading-[1.5rem] text-zinc-800",// Body Text- lead: "font-sans text-xl font-normal leading-loose text-muted-zinc-800",- large: "font-sans text-base font-normal leading-normal text-zinc-800",+ lead: "font-sans text-[1.25rem] font-normal leading-[2rem] text-zinc-800",+ large: "font-sans text-[1rem] font-normal leading-[1.5rem] text-zinc-800","large-medium":- "font-sans text-base font-medium leading-normal text-zinc-800",+ "font-sans text-[1rem] font-medium leading-[1.5rem] text-zinc-800","large-semibold":- "font-sans text-base font-semibold leading-normal text-zinc-800",- body: "font-sans text-sm font-normal leading-snug text-zinc-800",+ "font-sans text-[1rem] font-semibold leading-[1.5rem] text-zinc-800",+ body: "font-sans text-[0.875rem] font-normal leading-[1.375rem] text-zinc-800","body-medium": "font-sans text-sm font-medium leading-snug text-zinc-800",- small: "font-sans text-xs font-normal leading-tight text-zinc-800",- "small-medium": "font-sans text-xs font-medium leading-tight text-zinc-800",- subtle:- "font-sans text-xs font-medium uppercase leading-tight tracking-wide text-zinc-800",+ small:+ "font-sans text-[0.75rem] font-normal leading-[1.125rem] text-zinc-800",+ "small-medium":+ "font-sans text-[0.75rem] font-medium leading-[1.125rem] text-zinc-800",} as const;export type Variant = keyof typeof variants;@@ -49,5 +49,4 @@ export const variantElementMap: Record<Variant, As> = {"body-medium": "p",small: "p","small-medium": "p",- subtle: "p",};diff --git a/autogpt_platform/frontend/src/components/auth/AuthBottomText.tsx b/autogpt_platform/frontend/src/components/auth/AuthBottomText.tsxdeleted file mode 100644index 7dcaecf489..0000000000--- a/autogpt_platform/frontend/src/components/auth/AuthBottomText.tsx+++ /dev/null@@ -1,37 +0,0 @@-import { cn } from "@/lib/utils";-import Link from "next/link";--interface Props {- className?: string;- text: string;- linkText?: string;- href?: string;-}--export default function AuthBottomText({- className = "",- text,- linkText,- href = "",-}: Props) {- return (- <div- className={cn(- className,- "mt-8 inline-flex w-full items-center justify-center",- )}- >- <span className="text-sm font-medium leading-normal text-slate-950">- {text}- </span>- {linkText && (- <Link- href={href}- className="ml-1 text-sm font-medium leading-normal text-slate-950 underline"- >- {linkText}- </Link>- )}- </div>- );-}diff --git a/autogpt_platform/frontend/src/components/auth/AuthButton.tsx b/autogpt_platform/frontend/src/components/auth/AuthButton.tsxdeleted file mode 100644index 319d06c216..0000000000--- a/autogpt_platform/frontend/src/components/auth/AuthButton.tsx+++ /dev/null@@ -1,35 +0,0 @@-import { ReactNode } from "react";-import { FaSpinner } from "react-icons/fa";-import { Button } from "../ui/button";--interface Props {- children?: ReactNode;- isLoading?: boolean;- disabled?: boolean;- type?: "button" | "submit" | "reset";- onClick?: () => void;-}--export default function AuthButton({- children,- isLoading = false,- disabled = false,- type = "button",- onClick,-}: Props) {- return (- <Button- className="mt-2 w-full px-4 py-2 text-zinc-800"- variant="outline"- type={type}- disabled={isLoading || disabled}- onClick={onClick}- >- {isLoading ? (- <FaSpinner className="animate-spin" />- ) : (- <div className="text-sm font-medium">{children}</div>- )}- </Button>- );-}diff --git a/autogpt_platform/frontend/src/components/auth/AuthCard.tsx b/autogpt_platform/frontend/src/components/auth/AuthCard.tsxindex c23ed0511e..8c3d013e47 100644--- a/autogpt_platform/frontend/src/components/auth/AuthCard.tsx+++ b/autogpt_platform/frontend/src/components/auth/AuthCard.tsx@@ -1,22 +1,52 @@-import { ReactNode } from "react";import { cn } from "@/lib/utils";+import { ReactNode } from "react";+import { Card } from "../atoms/Card/Card";+import { Link } from "../atoms/Link/Link";+import { Text } from "../atoms/Text/Text";-interface Props {- children: ReactNode;+interface BottomTextProps {+ text: string;+ link?: { text: string; href: string };className?: string;}-export default function AuthCard({ children, className }: Props) {+AuthCard.BottomText = function BottomText({+ text,+ link,+ className,+}: BottomTextProps) {return (<divclassName={cn(- "flex h-[80vh] w-[32rem] items-center justify-center",className,+ "mt-4 inline-flex w-full items-center justify-center gap-1",)}>- <div className="w-full max-w-md rounded-lg bg-white p-6 shadow-md">- {children}- </div>+ <Text variant="body-medium" className="text-slate-950">+ {text}+ </Text>+ {link ? (+ <Link href={link.href} variant="secondary">+ {link.text}+ </Link>+ ) : null}</div>);+};++interface Props {+ children: ReactNode;+ title: string;+ className?: string;+}++export function AuthCard({ children, title }: Props) {+ return (+ <Card className="mx-auto flex min-h-[40vh] w-full max-w-[32rem] flex-col items-center justify-center gap-8">+ <Text variant="h3" as="h2" className="mb-3">+ {title}+ </Text>+ {children}+ </Card>+ );}diff --git a/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx b/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsxindex 6867cd51d3..9388ecb9b6 100644--- a/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx+++ b/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx@@ -1,7 +1,7 @@-import { AlertCircle, CheckCircle } from "lucide-react";-import { Card, CardContent } from "@/components/ui/card";import { HelpItem } from "@/components/auth/help-item";+import { Card, CardContent } from "@/components/ui/card";import { BehaveAs } from "@/lib/utils";+import { AlertCircle, CheckCircle } from "lucide-react";interface Props {type: "login" | "signup";@@ -16,12 +16,24 @@ export default function AuthFeedback({isError = false,behaveAs = BehaveAs.CLOUD,}: Props) {- // If there's no message but isError is true, show a default error messageconst displayMessage =message || (isError ? "Something went wrong. Please try again." : "");+ const isCloudMode = behaveAs === BehaveAs.CLOUD;+ const isLocalMode = behaveAs === BehaveAs.LOCAL;+ const showCloudHelp = isError && isCloudMode;+ const showLocalHelp = isError && isLocalMode;+ const isSignupFlow = type === "signup";+ const hasAnyHelpContent = showCloudHelp || showLocalHelp;++ const hasContent = displayMessage || hasAnyHelpContent;++ if (!hasContent) {+ return null;+ }+return (- <div className="mt-4 space-y-4">+ <div className="mt-4 w-full space-y-4">{/* Message feedback */}{displayMessage && (<div className="text-center text-sm font-medium leading-normal">@@ -40,9 +52,8 @@ export default function AuthFeedback({)}{/* Cloud-specific help */}- {isError &&- behaveAs === BehaveAs.CLOUD &&- (type === "signup" ? (+ {showCloudHelp &&+ (isSignupFlow ? (<Card className="overflow-hidden rounded-lg border border-slate-200 bg-white shadow-sm"><CardContent className="p-0"><div className="divide-y divide-slate-100">@@ -81,32 +92,30 @@ export default function AuthFeedback({))}{/* Local-specific help */}- {isError && behaveAs === BehaveAs.LOCAL && (- <Card className="overflow-hidden rounded-lg border border-slate-200 bg-white shadow-sm">- <CardContent className="p-0">- <div className="space-y-4 divide-y divide-slate-100">- <HelpItem- title="Having trouble getting AutoGPT running locally?"- description="Ask for help on our"- linkText="Discord"- href="https://discord.gg/autogpt"- />+ {showLocalHelp && (+ <Card className="w-full overflow-hidden rounded-lg border border-slate-200 bg-white shadow-sm">+ <div className="w-full divide-y divide-slate-100">+ <HelpItem+ title="Having trouble getting AutoGPT running locally?"+ description="Ask for help on our"+ linkText="Discord"+ href="https://discord.gg/autogpt"+ />- <HelpItem- title="Think you've found a bug?"- description="Open an issue on our"- linkText="GitHub"- href="https://github.com/Significant-Gravitas/AutoGPT"- />+ <HelpItem+ title="Think you've found a bug?"+ description="Open an issue on our"+ linkText="GitHub"+ href="https://github.com/Significant-Gravitas/AutoGPT"+ />- <HelpItem- title="Interested in the cloud-hosted version?"- description="Join our"- linkText="waitlist here"- href="https://agpt.co/waitlist"- />- </div>- </CardContent>+ <HelpItem+ title="Interested in the cloud-hosted version?"+ description="Join our"+ linkText="waitlist here"+ href="https://agpt.co/waitlist"+ />+ </div></Card>)}</div>diff --git a/autogpt_platform/frontend/src/components/auth/AuthHeader.tsx b/autogpt_platform/frontend/src/components/auth/AuthHeader.tsxdeleted file mode 100644index 221a40b461..0000000000--- a/autogpt_platform/frontend/src/components/auth/AuthHeader.tsx+++ /dev/null@@ -1,13 +0,0 @@-import { ReactNode } from "react";--interface Props {- children: ReactNode;-}--export default function AuthHeader({ children }: Props) {- return (- <div className="mb-8 text-2xl font-semibold leading-normal text-slate-950">- {children}- </div>- );-}diff --git a/autogpt_platform/frontend/src/components/auth/EmailNotAllowedModal.tsx b/autogpt_platform/frontend/src/components/auth/EmailNotAllowedModal.tsxnew file mode 100644index 0000000000..adb7b74208--- /dev/null+++ b/autogpt_platform/frontend/src/components/auth/EmailNotAllowedModal.tsx@@ -0,0 +1,33 @@+import { Button } from "../atoms/Button/Button";+import { Text } from "../atoms/Text/Text";+import { Dialog } from "../molecules/Dialog/Dialog";++interface Props {+ isOpen: boolean;+ onClose: () => void;+}++export function EmailNotAllowedModal({ isOpen, onClose }: Props) {+ return (+ <Dialog+ controlled={{ isOpen, set: onClose }}+ styling={{ maxWidth: "35rem" }}+ >+ <Dialog.Content>+ <div className="flex flex-col items-center gap-8 py-4">+ <Text variant="h3">Access Restricted</Text>+ <Text variant="large-medium" className="text-center">+ We're currently in a limited access phase. Your email address+ isn't on our current allowlist for early access. If you believe+ this is an error or would like to request access, please contact us.+ </Text>+ <div className="flex justify-end pt-4">+ <Button variant="primary" onClick={onClose}>+ I understand+ </Button>+ </div>+ </div>+ </Dialog.Content>+ </Dialog>+ );+}diff --git a/autogpt_platform/frontend/src/components/auth/GoogleOAuthButton.tsx b/autogpt_platform/frontend/src/components/auth/GoogleOAuthButton.tsxindex 1f9b0a43d5..834bdc8ab9 100644--- a/autogpt_platform/frontend/src/components/auth/GoogleOAuthButton.tsx+++ b/autogpt_platform/frontend/src/components/auth/GoogleOAuthButton.tsx@@ -1,5 +1,5 @@-import { FaGoogle, FaSpinner } from "react-icons/fa";-import { Button } from "../ui/button";+import Image from "next/image";+import { Button } from "../atoms/Button/Button";interface GoogleOAuthButtonProps {onClick: () => void;@@ -7,26 +7,22 @@ interface GoogleOAuthButtonProps {disabled?: boolean;}-export default function GoogleOAuthButton({+export function GoogleOAuthButton({onClick,- isLoading = false,- disabled = false,+ isLoading,+ disabled,}: GoogleOAuthButtonProps) {return (<Buttontype="button"- className="w-full border bg-zinc-700 py-2 text-white disabled:opacity-50"- disabled={isLoading || disabled}+ variant="secondary"+ className="w-full gap-3"onClick={onClick}+ disabled={disabled}+ loading={isLoading}>- {isLoading ? (- <FaSpinner className="mr-2 h-4 w-4 animate-spin" />- ) : (- <FaGoogle className="mr-2 h-4 w-4" />- )}- <span className="text-sm font-medium">- {isLoading ? "Signing in..." : "Continue with Google"}- </span>+ <Image src="/google-logo.svg" alt="Google" width={20} height={20} />+ {isLoading ? "Connecting..." : "Continue with Google"}</Button>);}diff --git a/autogpt_platform/frontend/src/components/auth/index.ts b/autogpt_platform/frontend/src/components/auth/index.tsdeleted file mode 100644index da7a034ce6..0000000000--- a/autogpt_platform/frontend/src/components/auth/index.ts+++ /dev/null@@ -1,19 +0,0 @@-import AuthBottomText from "./AuthBottomText";-import AuthButton from "./AuthButton";-import AuthCard from "./AuthCard";-import AuthFeedback from "./AuthFeedback";-import AuthHeader from "./AuthHeader";-import GoogleOAuthButton from "./GoogleOAuthButton";-import { PasswordInput } from "./PasswordInput";-import Turnstile from "./Turnstile";--export {- AuthBottomText,- AuthButton,- AuthCard,- AuthFeedback,- AuthHeader,- GoogleOAuthButton,- PasswordInput,- Turnstile,-};diff --git a/autogpt_platform/frontend/src/components/tokens/typography.stories.tsx b/autogpt_platform/frontend/src/components/tokens/typography.stories.tsxindex b51709140a..d1f7471549 100644--- a/autogpt_platform/frontend/src/components/tokens/typography.stories.tsx+++ b/autogpt_platform/frontend/src/components/tokens/typography.stories.tsx@@ -169,8 +169,6 @@ export function AllVariants() {code={`<Text variant="small">Small</Text><Text variant="small-medium">Small Medium</Text>`}/>- <Text variant="subtle">Subtle</Text>- <StoryCode code={`<Text variant="subtle">Subtle</Text>`} /></div></div>);diff --git a/autogpt_platform/frontend/src/tests/pages/login.page.ts b/autogpt_platform/frontend/src/tests/pages/login.page.tsindex a2fcabddf4..074eec86e7 100644--- a/autogpt_platform/frontend/src/tests/pages/login.page.ts+++ b/autogpt_platform/frontend/src/tests/pages/login.page.ts@@ -9,26 +9,19 @@ export class LoginPage {password,});- // Fill email- const emailInput = this.page.getByPlaceholder("[email protected]");+ // Wait for the form to be ready+ await this.page.waitForSelector("form", { state: "visible" });++ // Fill email using input selector instead of label+ const emailInput = this.page.locator('input[type="email"]');await emailInput.waitFor({ state: "visible" });await emailInput.fill(email);- // Fill password- const passwordInput = this.page.getByTitle("Password");+ // Fill password using input selector instead of label+ const passwordInput = this.page.locator('input[type="password"]');await passwordInput.waitFor({ state: "visible" });await passwordInput.fill(password);- // TODO: This is a workaround to wait for the page to load after filling the email and password- const emailInput2 = this.page.getByPlaceholder("[email protected]");- await emailInput2.waitFor({ state: "visible" });- await emailInput2.fill(email);-- // Fill password- const passwordInput2 = this.page.getByTitle("Password");- await passwordInput2.waitFor({ state: "visible" });- await passwordInput2.fill(password);-// Wait for the button to be readyconst loginButton = this.page.getByRole("button", {name: "Login",diff --git a/autogpt_platform/frontend/src/tests/signup.spec.ts b/autogpt_platform/frontend/src/tests/signup.spec.tsindex 60607d2098..f561649819 100644--- a/autogpt_platform/frontend/src/tests/signup.spec.ts+++ b/autogpt_platform/frontend/src/tests/signup.spec.ts@@ -1,9 +1,9 @@-import { test, expect } from "./fixtures";+import { expect, test } from "./fixtures";import {- signupTestUser,- validateSignupForm,generateTestEmail,generateTestPassword,+ signupTestUser,+ validateSignupForm,} from "./utils/signup";test.describe("Signup Flow", () => {@@ -45,10 +45,13 @@ test.describe("Signup Flow", () => {// Test with mismatched passwordsconsole.log("❌ Testing mismatched passwords...");- await page.getByPlaceholder("[email protected]").fill(generateTestEmail());- const passwordInputs = page.getByTitle("Password");- await passwordInputs.nth(0).fill("password1");- await passwordInputs.nth(1).fill("password2");+ await page.getByLabel("Email").fill(generateTestEmail());+ const passwordInput = page.getByLabel("Password", { exact: true });+ const confirmPasswordInput = page.getByLabel("Confirm Password", {+ exact: true,+ });+ await passwordInput.fill("password1");+ await confirmPasswordInput.fill("password2");await page.getByRole("checkbox").click();await page.getByRole("button", { name: "Sign up" }).click();@@ -82,7 +85,10 @@ test.describe("Signup Flow", () => {}});- test("user can signup with existing email handling", async ({ page }) => {+ test("user can signup with existing email handling", async ({+ page,+ browser,+ }) => {console.log("🧪 Testing duplicate email handling...");try {@@ -96,13 +102,27 @@ test.describe("Signup Flow", () => {expect(firstUser.email).toBe(testEmail);console.log("✅ First signup successful");- // Second signup attempt with same email should handle gracefully- console.log(`👤 Second signup attempt: ${testEmail}`);+ // Create new browser context for second signup (simulates new browser window)+ console.log("🔄 Creating new browser context...");+ const newContext = await browser.newContext();+ const newPage = await newContext.newPage();+try {- await signupTestUser(page, testEmail, testPassword);+ // Second signup attempt with same email in new browser context+ console.log(+ `👤 Second signup attempt in new browser context: ${testEmail}`,+ );+ await signupTestUser(newPage, testEmail, testPassword);+ expect(+ newPage.getByText("User with this email already exists"),+ ).toBeVisible();console.log("ℹ️ Second signup handled gracefully");} catch (_error) {console.log("ℹ️ Second signup rejected as expected");+ } finally {+ // Clean up new browser context+ await newContext.close();+ console.log("🧹 New browser context closed");}console.log("✅ Duplicate email handling test completed");diff --git a/autogpt_platform/frontend/src/tests/utils/signup.ts b/autogpt_platform/frontend/src/tests/utils/signup.tsindex 11d7e23152..232c017dd8 100644--- a/autogpt_platform/frontend/src/tests/utils/signup.ts+++ b/autogpt_platform/frontend/src/tests/utils/signup.ts@@ -23,14 +23,15 @@ export async function signupTestUser(await page.goto("http://localhost:3000/signup");// Wait for page to load- const emailInput = page.getByPlaceholder("[email protected]");- await emailInput.waitFor({ state: "visible", timeout: 10000 });+ await page.getByText("Create a new account");// Fill form+ const emailInput = page.getByLabel("Email");await emailInput.fill(userEmail);- const passwordInputs = page.getByTitle("Password");- await passwordInputs.nth(0).fill(userPassword);- await passwordInputs.nth(1).fill(userPassword);+ const passwordInput = page.locator("#password");+ await passwordInput.fill(userPassword);+ const confirmPasswordInput = page.locator("#confirmPassword");+ await confirmPasswordInput.fill(userPassword);// Agree to terms and submitawait page.getByRole("checkbox").click();@@ -135,7 +136,7 @@ export async function validateSignupForm(page: any): Promise<void> {// Test invalid emailconsole.log("❌ Testing invalid email...");- await page.getByPlaceholder("[email protected]").fill("invalid-email");+ await page.getByLabel("Email").fill("invalid-email");await signupButton.click();// Should still be on signup page