Spaces:
Sleeping
Sleeping
Download src/app/(auth)/login/page.tsx from veltrixcode/Iot: direct link, hf CLI and curl.
- Browser
- Download file 13.2 kB
-
https://huggingface.co/spaces/veltrixcode/Iot/resolve/main/src/app/(auth)/login/page.tsx
- Command line
-
hf download 'hf://spaces/veltrixcode/Iot/src/app/(auth)/login/page.tsx'
-
curl -L -o page.tsx 'https://huggingface.co/spaces/veltrixcode/Iot/resolve/main/src/app/(auth)/login/page.tsx'
13.2 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 } from "lucide-react" | |
| export default function LoginPage() { | |
| 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 result = await signIn("credentials", { | |
| email: formData.get("email"), | |
| password: formData.get("password"), | |
| redirect: false, | |
| }) | |
| if (result?.error) { | |
| setError("Invalid email or password") | |
| } else { | |
| router.push("/create") | |
| router.refresh() | |
| } | |
| } catch (error) { | |
| setError("Something went wrong") | |
| } finally { | |
| setIsLoading(false) | |
| } | |
| } | |
| return ( | |
| <div className="min-h-screen flex font-sans"> | |
| {/* Left Panel - Branding */} | |
| <div className="hidden lg:flex lg:w-1/2 relative overflow-hidden bg-primary/5 border-r-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-8 text-center w-full"> | |
| <div className="space-y-8 max-w-lg"> | |
| <div className="inline-flex items-center gap-2 px-3 py-1.5 border-2 border-primary bg-primary/10 shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)]"> | |
| <Sparkles className="h-4 w-4 text-primary" /> | |
| <span className="text-xs font-black uppercase tracking-widest text-primary">AI Powered</span> | |
| </div> | |
| <h1 className="text-4xl xl:text-5xl font-black tracking-tighter leading-none uppercase"> | |
| Create Art That<br /> | |
| <span className="text-primary text-stroke-primary"> | |
| Breaks Limits | |
| </span> | |
| </h1> | |
| <p className="text-xl text-muted-foreground font-medium uppercase tracking-wide"> | |
| Join thousands of artists using Imyra to transform imagination into stunning visuals. | |
| </p> | |
| {/* Stats */} | |
| <div className="flex gap-8 justify-center pt-8"> | |
| <div className="text-center p-4 border-2 border-border bg-card shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)]"> | |
| <p className="text-3xl font-black text-primary">50K+</p> | |
| <p className="text-xs font-bold uppercase tracking-wider text-muted-foreground mt-1">Artworks</p> | |
| </div> | |
| <div className="text-center p-4 border-2 border-border bg-card shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)]"> | |
| <p className="text-3xl font-black text-primary">10K+</p> | |
| <p className="text-xs font-bold uppercase tracking-wider text-muted-foreground mt-1">Artists</p> | |
| </div> | |
| <div className="text-center p-4 border-2 border-border bg-card shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)]"> | |
| <p className="text-3xl font-black text-primary">Free</p> | |
| <p className="text-xs font-bold uppercase tracking-wider text-muted-foreground mt-1">To Start</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| {/* Right 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">Welcome back</h2> | |
| <p className="text-muted-foreground font-medium uppercase tracking-wide text-xs"> | |
| Enter your credentials to access your creative studio | |
| </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-6"> | |
| <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-12 rounded-none border-2 border-border bg-card px-3 text-sm font-medium 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" | |
| /> | |
| </div> | |
| <div className="space-y-2"> | |
| <div className="flex items-center justify-between"> | |
| <Label htmlFor="password" className="text-xs font-black uppercase tracking-wider">Password</Label> | |
| <Link href="#" className="text-[10px] font-bold uppercase tracking-wider text-muted-foreground hover:text-primary hover:underline decoration-2 underline-offset-4"> | |
| Forgot password? | |
| </Link> | |
| </div> | |
| <div className="relative"> | |
| <Input | |
| id="password" | |
| name="password" | |
| type={showPassword ? "text" : "password"} | |
| placeholder="••••••••" | |
| required | |
| 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" />} | |
| Sign In | |
| </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"> | |
| Don't have an account?{" "} | |
| <Link href="/signup" className="text-primary font-black uppercase tracking-wide hover:underline decoration-2 underline-offset-4 ml-1"> | |
| Create one free | |
| </Link> | |
| </p> | |
| </div> | |
| </div> | |
| </div> | |
| ) | |
| } | |