Spaces:
Paused
Paused
Download src/app/(auth)/signup/page.tsx from veltrixcode/retest: direct link, hf CLI and curl.
- Browser
- Download file 14.8 kB
-
https://huggingface.co/spaces/veltrixcode/retest/resolve/main/src/app/(auth)/signup/page.tsx
- Command line
-
hf download 'hf://spaces/veltrixcode/retest/src/app/(auth)/signup/page.tsx'
-
curl -L -o page.tsx 'https://huggingface.co/spaces/veltrixcode/retest/resolve/main/src/app/(auth)/signup/page.tsx'
14.8 kB
| "use client" | |
| import { useState } from "react" | |
| import Link from "next/link" | |
| import { useRouter } from "next/navigation" | |
| import { signIn } from "next-auth/react" | |
| import { Button } from "@/components/ui/button" | |
| import { Input } from "@/components/ui/input" | |
| import { Label } from "@/components/ui/label" | |
| import { Loader2, Sparkles, Eye, EyeOff, Check } from "lucide-react" | |
| export default function SignupPage() { | |
| const router = useRouter() | |
| const [isLoading, setIsLoading] = useState(false) | |
| const [showPassword, setShowPassword] = useState(false) | |
| const [error, setError] = useState("") | |
| async function onSubmit(e: React.FormEvent<HTMLFormElement>) { | |
| e.preventDefault() | |
| setIsLoading(true) | |
| setError("") | |
| const formData = new FormData(e.currentTarget) | |
| try { | |
| const res = await fetch("/api/auth/register", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ | |
| name: formData.get("name"), | |
| email: formData.get("email"), | |
| password: formData.get("password"), | |
| }), | |
| }) | |
| if (!res.ok) { | |
| const data = await res.json() | |
| setError(data.error || "Something went wrong") | |
| return | |
| } | |
| // Auto sign in after registration | |
| const result = await signIn("credentials", { | |
| email: formData.get("email"), | |
| password: formData.get("password"), | |
| redirect: false, | |
| }) | |
| if (result?.ok) { | |
| router.push("/create") | |
| router.refresh() | |
| } | |
| } catch (error) { | |
| setError("Something went wrong") | |
| } finally { | |
| setIsLoading(false) | |
| } | |
| } | |
| const features = [ | |
| "100 free credits daily", | |
| "Access to all AI models", | |
| "High-resolution exports", | |
| "Public gallery showcase", | |
| "No credit card required" | |
| ] | |
| return ( | |
| <div className="min-h-screen flex font-sans"> | |
| {/* Left Panel - Form */} | |
| <div className="w-full lg:w-1/2 flex flex-col justify-center p-8 lg:p-12 bg-background relative"> | |
| <div className="relative z-10 max-w-sm mx-auto w-full space-y-6"> | |
| {/* Logo */} | |
| <Link href="/" className="inline-flex items-center gap-3 mb-6 group"> | |
| <div className="h-10 w-10 border-2 border-border bg-primary text-white flex items-center justify-center shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)] group-hover:translate-x-[2px] group-hover:translate-y-[2px] group-hover:shadow-[1px_1px_0px_0px_rgba(0,0,0,1)] dark:group-hover:shadow-[1px_1px_0px_0px_rgba(255,255,255,1)] transition-all"> | |
| <Sparkles className="h-5 w-5" /> | |
| </div> | |
| <span className="text-xl font-black tracking-tighter uppercase group-hover:text-primary transition-colors">Imyra</span> | |
| </Link> | |
| <div className="space-y-2 border-l-4 border-primary pl-4"> | |
| <h2 className="text-3xl font-black tracking-tighter uppercase">Start creating</h2> | |
| <p className="text-muted-foreground font-medium uppercase tracking-wide text-xs"> | |
| Create your account and get 100 free credits instantly | |
| </p> | |
| </div> | |
| <form onSubmit={onSubmit} className="space-y-6"> | |
| {error && ( | |
| <div className="p-4 border-2 border-destructive bg-destructive/5 text-destructive font-bold uppercase tracking-wide text-sm shadow-[4px_4px_0px_0px_rgba(239,68,68,1)]"> | |
| {error} | |
| </div> | |
| )} | |
| <div className="space-y-4"> | |
| <div className="space-y-2"> | |
| <Label htmlFor="name" className="text-sm font-black uppercase tracking-wider">Name</Label> | |
| <Input | |
| id="name" | |
| name="name" | |
| type="text" | |
| placeholder="Your name" | |
| required | |
| className="h-14 rounded-none border-2 border-border bg-card px-4 text-base font-medium shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)] focus:translate-x-[2px] focus:translate-y-[2px] focus:shadow-[2px_2px_0px_0px_rgba(0,0,0,1)] dark:focus:shadow-[2px_2px_0px_0px_rgba(255,255,255,1)] transition-all" | |
| /> | |
| </div> | |
| <div className="space-y-2"> | |
| <Label htmlFor="email" className="text-sm font-black uppercase tracking-wider">Email</Label> | |
| <Input | |
| id="email" | |
| name="email" | |
| type="email" | |
| placeholder="artist@example.com" | |
| required | |
| className="h-14 rounded-none border-2 border-border bg-card px-4 text-base font-medium shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)] focus:translate-x-[2px] focus:translate-y-[2px] focus:shadow-[2px_2px_0px_0px_rgba(0,0,0,1)] dark:focus:shadow-[2px_2px_0px_0px_rgba(255,255,255,1)] transition-all" | |
| /> | |
| </div> | |
| <div className="space-y-2"> | |
| <Label htmlFor="password" className="text-sm font-black uppercase tracking-wider">Password</Label> | |
| <div className="relative"> | |
| <Input | |
| id="password" | |
| name="password" | |
| type={showPassword ? "text" : "password"} | |
| placeholder="Min. 8 characters" | |
| required | |
| minLength={8} | |
| className="h-12 rounded-none border-2 border-border bg-card px-3 text-sm font-medium pr-10 shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)] focus:translate-x-[1px] focus:translate-y-[1px] focus:shadow-[1px_1px_0px_0px_rgba(0,0,0,1)] dark:focus:shadow-[1px_1px_0px_0px_rgba(255,255,255,1)] transition-all" | |
| /> | |
| <Button | |
| type="button" | |
| variant="ghost" | |
| size="icon" | |
| className="absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 hover:bg-transparent text-muted-foreground hover:text-foreground" | |
| onClick={() => setShowPassword(!showPassword)} | |
| > | |
| {showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />} | |
| </Button> | |
| </div> | |
| </div> | |
| </div> | |
| <Button | |
| type="submit" | |
| disabled={isLoading} | |
| className="w-full h-12 rounded-none border-2 border-primary bg-primary text-white text-base font-black uppercase tracking-widest shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)] hover:translate-x-[1px] hover:translate-y-[1px] hover:shadow-[1px_1px_0px_0px_rgba(0,0,0,1)] dark:hover:shadow-[1px_1px_0px_0px_rgba(255,255,255,1)] active:translate-x-[2px] active:translate-y-[2px] active:shadow-none transition-all" | |
| > | |
| {isLoading && <Loader2 className="mr-2 h-5 w-5 animate-spin" />} | |
| Create Account | |
| </Button> | |
| </form> | |
| <div className="relative py-4"> | |
| <div className="absolute inset-0 flex items-center"> | |
| <div className="w-full border-t-2 border-border" /> | |
| </div> | |
| <div className="relative flex justify-center"> | |
| <span className="bg-background px-4 text-xs font-black uppercase tracking-widest text-muted-foreground">Or</span> | |
| </div> | |
| </div> | |
| <Button | |
| type="button" | |
| variant="outline" | |
| onClick={() => signIn("google", { callbackUrl: "/create" })} | |
| className="w-full h-14 rounded-none border-2 border-border bg-card text-foreground text-base font-bold uppercase tracking-wider shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-[2px_2px_0px_0px_rgba(0,0,0,1)] dark:hover:shadow-[2px_2px_0px_0px_rgba(255,255,255,1)] active:translate-x-[4px] active:translate-y-[4px] active:shadow-none transition-all" | |
| > | |
| <svg className="mr-3 h-5 w-5" viewBox="0 0 24 24"> | |
| <path fill="currentColor" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" /> | |
| <path fill="currentColor" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" /> | |
| <path fill="currentColor" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" /> | |
| <path fill="currentColor" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" /> | |
| </svg> | |
| Continue with Google | |
| </Button> | |
| <p className="text-center text-sm font-medium text-muted-foreground"> | |
| Already have an account?{" "} | |
| <Link href="/login" className="text-primary font-black uppercase tracking-wide hover:underline decoration-2 underline-offset-4 ml-1"> | |
| Sign in | |
| </Link> | |
| </p> | |
| </div> | |
| </div> | |
| {/* Right Panel - Features */} | |
| <div className="hidden lg:flex lg:w-1/2 relative overflow-hidden bg-primary/5 border-l-2 border-border"> | |
| {/* Background Pattern */} | |
| <div className="absolute inset-0 bg-[linear-gradient(rgba(0,0,0,0.02)_1px,transparent_1px),linear-gradient(90deg,rgba(0,0,0,0.02)_1px,transparent_1px)] dark:bg-[linear-gradient(rgba(255,255,255,0.02)_1px,transparent_1px),linear-gradient(90deg,rgba(255,255,255,0.02)_1px,transparent_1px)] bg-[size:64px_64px]" /> | |
| {/* Content */} | |
| <div className="relative z-10 flex flex-col justify-center items-center p-12 w-full"> | |
| <div className="max-w-lg space-y-12"> | |
| <div className="inline-flex items-center gap-2 px-4 py-2 border-2 border-secondary bg-secondary/10 shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)]"> | |
| <Sparkles className="h-5 w-5 text-secondary" /> | |
| <span className="text-sm font-black uppercase tracking-widest text-secondary">Free Forever</span> | |
| </div> | |
| <h1 className="text-4xl xl:text-6xl font-black tracking-tighter leading-none uppercase"> | |
| Everything you need to create | |
| <span className="text-primary block text-stroke-primary"> | |
| Stunning Art | |
| </span> | |
| </h1> | |
| <ul className="space-y-6"> | |
| {features.map((feature, index) => ( | |
| <li key={index} className="flex items-center gap-4 group"> | |
| <div className="h-8 w-8 rounded-none border-2 border-primary bg-primary text-white flex items-center justify-center shadow-[2px_2px_0px_0px_rgba(0,0,0,1)] dark:shadow-[2px_2px_0px_0px_rgba(255,255,255,1)] group-hover:translate-x-[1px] group-hover:translate-y-[1px] group-hover:shadow-none transition-all"> | |
| <Check className="h-5 w-5" /> | |
| </div> | |
| <span className="text-lg font-bold uppercase tracking-wide">{feature}</span> | |
| </li> | |
| ))} | |
| </ul> | |
| {/* Testimonial */} | |
| <div className="pt-8 border-t-2 border-border"> | |
| <p className="text-xl italic font-serif text-muted-foreground mb-6"> | |
| "Imyra has completely transformed how I create visual content. The quality is incredible!" | |
| </p> | |
| <div className="flex items-center gap-4"> | |
| <div className="h-12 w-12 border-2 border-border bg-gradient-to-br from-primary to-secondary flex items-center justify-center text-white font-black text-xl shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)]"> | |
| S | |
| </div> | |
| <div> | |
| <p className="font-black uppercase tracking-wide">Sarah Chen</p> | |
| <p className="text-sm font-bold text-muted-foreground uppercase tracking-wider">Digital Artist</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| ) | |
| } | |