Skip to content

feat(frontend): Update login and signup feedback #9917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export default function LoginPage() {
</AuthButton>
</form>
<AuthFeedback
type="login"
message={feedback}
isError={!!feedback}
behaveAs={getBehaveAs()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export default function ResetPasswordPage() {
Update password
</AuthButton>
<AuthFeedback
type="login"
message={feedback}
isError={isError}
behaveAs={getBehaveAs()}
Expand Down Expand Up @@ -184,6 +185,7 @@ export default function ResetPasswordPage() {
Send reset email
</AuthButton>
<AuthFeedback
type="login"
message={feedback}
isError={isError}
behaveAs={getBehaveAs()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default function SignupPage() {
}

return (
<AuthCard className="mx-auto">
<AuthCard className="mx-auto mt-12">
<AuthHeader>Create a new account</AuthHeader>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSignup)}>
Expand Down Expand Up @@ -188,6 +188,7 @@ export default function SignupPage() {
</form>
</Form>
<AuthFeedback
type="signup"
message={feedback}
isError={!!feedback}
behaveAs={getBehaveAs()}
Expand Down
82 changes: 40 additions & 42 deletions autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { AlertCircle, CheckCircle } from "lucide-react";
import { Card, CardContent } from "@/components/ui/card";
import { Card, CardContent, CardHeader } from "@/components/ui/card";
import { HelpItem } from "@/components/auth/help-item";
import Link from "next/link";
import { BehaveAs } from "@/lib/utils";

interface Props {
type: "login" | "signup";
message?: string | null;
isError?: boolean;
behaveAs?: BehaveAs;
}

export default function AuthFeedback({
type,
message = "",
isError = false,
behaveAs = BehaveAs.CLOUD,
Expand Down Expand Up @@ -39,48 +40,45 @@ export default function AuthFeedback({
)}

{/* Cloud-specific help */}
{isError && behaveAs === BehaveAs.CLOUD && (
<div className="mt-2 space-y-2 text-sm">
<span className="block text-center font-medium text-red-500">
The provided email may not be allowed to sign up.
</span>
<ul className="space-y-2 text-slate-700">
<li className="flex items-start">
<span className="mr-2">-</span>
<span>
AutoGPT Platform is currently in closed beta. You can join{" "}
<Link
{isError &&
behaveAs === BehaveAs.CLOUD &&
(type === "signup" ? (
<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">
<span className="my-3 block text-center text-sm font-medium text-red-500">
The provided email may not be allowed to sign up.
</span>
<HelpItem
title="AutoGPT Platform is currently in closed beta. "
description="You can join "
linkText="the waitlist here"
href="https://agpt.co/waitlist"
className="font-medium text-slate-950 underline hover:text-slate-700"
>
the waitlist here
</Link>
.
</span>
</li>
<li className="flex items-start">
<span className="mr-2">-</span>
<span>
Make sure you use the same email address you used to sign up for
the waitlist.
</span>
</li>
<li className="flex items-start">
<span className="mr-2">-</span>
<span>
You can self host the platform, visit our{" "}
<Link
/>
<HelpItem title="Make sure you use the same email address you used to sign up for the waitlist." />
<HelpItem
title="You can self host the platform!"
description="Visit our"
linkText="GitHub repository"
href="https://github.com/Significant-Gravitas/AutoGPT"
className="font-medium text-slate-950 underline hover:text-slate-700"
>
GitHub repository
</Link>
.
</span>
</li>
</ul>
</div>
)}
/>
</div>
</CardContent>
</Card>
) : (
<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">
<HelpItem
title="Having trouble logging in?"
description="Make sure you've already "
linkText="signed up"
href="/signup"
/>
</div>
</CardContent>
</Card>
))}

{/* Local-specific help */}
{isError && behaveAs === BehaveAs.LOCAL && (
Expand Down
26 changes: 15 additions & 11 deletions autogpt_platform/frontend/src/components/auth/help-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,33 @@ import Link from "next/link";

interface HelpItemProps {
title: string;
description: string;
linkText: string;
href: string;
description?: string;
linkText?: string;
href?: string;
}

export function HelpItem({
title,
description,
linkText,
href,
href = "",
}: HelpItemProps) {
const external = !href.startsWith("/");

return (
<div className="p-4">
<h3 className="mb-1 text-sm font-medium text-slate-950">{title}</h3>
<p className="text-sm text-slate-600">
{description}{" "}
<Link
href={href}
className="inline-flex items-center font-medium text-slate-950 hover:text-slate-700"
>
{linkText}
<ExternalLink className="ml-1 h-3 w-3" />
</Link>
{linkText && (
<Link
href={href}
className="inline-flex items-center font-medium text-slate-950 hover:text-slate-700"
>
{linkText}
{external && <ExternalLink className="ml-1 h-3 w-3" />}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated but is link inside link even allowed?

</Link>
)}
</p>
</div>
);
Expand Down
Loading