190 lines
12 KiB
TypeScript
190 lines
12 KiB
TypeScript
"use client"
|
|
|
|
import { Button } from "@/components/ui/button"
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
|
import { ArrowLeft, Eye, EyeOff, CheckCircle2 } from "lucide-react"
|
|
import Link from "next/link"
|
|
import Image from "next/image"
|
|
import { useState } from "react"
|
|
import { useRouter } from "next/navigation"
|
|
|
|
export default function SignupPage() {
|
|
const [step, setStep] = useState(1)
|
|
const [showPassword, setShowPassword] = useState(false)
|
|
const [authMethod, setAuthMethod] = useState<"email" | "phone">("email")
|
|
const [showOTP, setShowOTP] = useState(false)
|
|
const router = useRouter()
|
|
|
|
const handleNextStep = () => {
|
|
if (step === 1) setStep(2)
|
|
else router.push("/dashboard")
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-background flex flex-col items-center justify-center p-6 selection:bg-primary/20">
|
|
<Link href="/" className="absolute top-8 left-8 text-muted-foreground hover:text-foreground flex items-center gap-2 transition-colors font-medium">
|
|
<ArrowLeft size={16} /> Back to Home
|
|
</Link>
|
|
|
|
<div className="w-full max-w-md space-y-8 animate-in fade-in slide-in-from-bottom-8 duration-700">
|
|
<div className="flex justify-center mb-8">
|
|
<div className="relative h-20 w-72">
|
|
<Image
|
|
src="/PragatiVeer_Logo/SVG_Logos/Rectangular_dark_background.svg"
|
|
alt="PragatiVeer" fill className="object-contain scale-135 dark:hidden" priority
|
|
/>
|
|
<Image
|
|
src="/PragatiVeer_Logo/SVG_Logos/Rectangular_dark_background.svg"
|
|
alt="PragatiVeer" fill className="object-contain scale-135 hidden dark:block" priority
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Progress Bar */}
|
|
<div className="flex flex-col gap-2">
|
|
<div className="flex justify-between text-xs font-bold text-muted-foreground">
|
|
<span className={step >= 1 ? "text-primary" : ""}>Account Details</span>
|
|
<span className={step >= 2 ? "text-primary" : ""}>Personalize Profile</span>
|
|
</div>
|
|
<div className="w-full bg-secondary h-2 rounded-full overflow-hidden">
|
|
<div
|
|
className="bg-primary h-full transition-all duration-500 ease-in-out"
|
|
style={{ width: step === 1 ? '50%' : '100%' }}
|
|
></div>
|
|
</div>
|
|
</div>
|
|
|
|
<Card className="border-border bg-secondary/10 backdrop-blur-xl shadow-[0_0_50px_-20px_var(--color-primary)] rounded-[2rem] overflow-hidden">
|
|
<CardHeader className="text-center pb-2">
|
|
<CardTitle className="text-2xl font-bold tracking-tight">
|
|
{step === 1 ? "Create an account" : "Complete your profile"}
|
|
</CardTitle>
|
|
<CardDescription className="text-muted-foreground">
|
|
{step === 1 ? "Start your AI-powered preparation journey today." : "Help us personalize your study plan."}
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent className="space-y-6 pt-4">
|
|
|
|
{step === 1 ? (
|
|
<div className="space-y-4 animate-in fade-in zoom-in-95">
|
|
<div className="grid grid-cols-2 gap-4">
|
|
<div className="space-y-2">
|
|
<label className="text-sm font-bold text-foreground">First Name</label>
|
|
<input type="text" placeholder="John" className="w-full bg-background border border-border rounded-xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all"/>
|
|
</div>
|
|
<div className="space-y-2">
|
|
<label className="text-sm font-bold text-foreground">Last Name</label>
|
|
<input type="text" placeholder="Doe" className="w-full bg-background border border-border rounded-xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all"/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex bg-secondary p-1 rounded-xl">
|
|
<button type="button" onClick={() => setAuthMethod("email")} className={`flex-1 text-sm font-bold py-2 rounded-lg transition-all ${authMethod === "email" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`}>Email</button>
|
|
<button type="button" onClick={() => setAuthMethod("phone")} className={`flex-1 text-sm font-bold py-2 rounded-lg transition-all ${authMethod === "phone" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`}>Phone</button>
|
|
</div>
|
|
|
|
<div className="space-y-2">
|
|
<label className="text-sm font-bold text-foreground">{authMethod === "email" ? "Email Address" : "Phone Number"}</label>
|
|
<div className="flex gap-2">
|
|
<input type={authMethod === "email" ? "email" : "tel"} placeholder={authMethod === "email" ? "student@example.com" : "+91 9876543210"} className="flex-1 bg-background border border-border rounded-xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all"/>
|
|
{!showOTP && (
|
|
<Button variant="secondary" onClick={() => setShowOTP(true)} className="h-[46px] rounded-xl font-bold">Send OTP</Button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
{showOTP && (
|
|
<div className="space-y-2 animate-in slide-in-from-top-2">
|
|
<label className="text-sm font-bold text-foreground flex justify-between">
|
|
<span>Verification Code</span>
|
|
<span className="text-primary text-xs">Resend in 30s</span>
|
|
</label>
|
|
<div className="flex gap-2">
|
|
{[1,2,3,4,5,6].map((i) => (
|
|
<input key={i} type="text" maxLength={1} className="w-12 h-12 text-center text-lg font-bold bg-background border border-border rounded-xl focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all" />
|
|
))}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
<div className="space-y-2">
|
|
<label className="text-sm font-bold text-foreground">Password (Optional if using OTP)</label>
|
|
<div className="relative">
|
|
<input type={showPassword ? "text" : "password"} placeholder="••••••••" className="w-full bg-background border border-border rounded-xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all pr-10"/>
|
|
<button type="button" onClick={() => setShowPassword(!showPassword)} className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors">
|
|
{showPassword ? <EyeOff size={16} /> : <Eye size={16} />}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
) : (
|
|
<div className="space-y-4 animate-in fade-in slide-in-from-right-8">
|
|
<div className="space-y-2">
|
|
<label className="text-sm font-bold text-foreground">Target Exam</label>
|
|
<select className="w-full bg-background border border-border rounded-xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all appearance-none cursor-pointer">
|
|
<option value="jee_main">JEE Main</option>
|
|
<option value="jee_adv">JEE Advanced (Main + Adv)</option>
|
|
<option value="neet">NEET UG</option>
|
|
</select>
|
|
</div>
|
|
<div className="space-y-2">
|
|
<label className="text-sm font-bold text-foreground">Current Class</label>
|
|
<select className="w-full bg-background border border-border rounded-xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all appearance-none cursor-pointer">
|
|
<option value="11">Class 11</option>
|
|
<option value="12">Class 12</option>
|
|
<option value="dropper">Dropper / 12th Pass</option>
|
|
</select>
|
|
</div>
|
|
<div className="space-y-2">
|
|
<label className="text-sm font-bold text-foreground">Study Medium</label>
|
|
<select className="w-full bg-background border border-border rounded-xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all appearance-none cursor-pointer">
|
|
<option value="en">English</option>
|
|
<option value="hi">Hindi (हिंदी)</option>
|
|
<option value="bi">Bilingual (English + Hindi)</option>
|
|
</select>
|
|
</div>
|
|
<div className="space-y-2">
|
|
<label className="text-sm font-bold text-foreground">School / Coaching Name <span className="text-muted-foreground font-normal">(Optional)</span></label>
|
|
<input type="text" placeholder="e.g. DPS R.K. Puram" className="w-full bg-background border border-border rounded-xl px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all"/>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
<Button onClick={handleNextStep} className="w-full rounded-xl h-12 font-bold text-base bg-primary text-primary-foreground hover:bg-primary/90 transition-all shadow-[0_0_20px_-5px_var(--color-primary)]">
|
|
{step === 1 ? "Continue" : "Complete Setup"}
|
|
</Button>
|
|
|
|
{step === 1 && (
|
|
<>
|
|
<div className="relative">
|
|
<div className="absolute inset-0 flex items-center">
|
|
<span className="w-full border-t border-border"></span>
|
|
</div>
|
|
<div className="relative flex justify-center text-xs uppercase">
|
|
<span className="bg-background/80 px-2 text-muted-foreground font-bold tracking-widest backdrop-blur-md">Or continue with</span>
|
|
</div>
|
|
</div>
|
|
|
|
<Button variant="outline" className="w-full rounded-xl h-12 font-bold bg-background border-border hover:bg-secondary/50 transition-all flex items-center justify-center gap-2">
|
|
<svg viewBox="0 0 24 24" className="h-5 w-5"><path 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" fill="#4285F4"/><path 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" fill="#34A853"/><path 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" fill="#FBBC05"/><path 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" fill="#EA4335"/><path d="M1 1h22v22H1z" fill="none"/></svg>
|
|
Google
|
|
</Button>
|
|
</>
|
|
)}
|
|
</CardContent>
|
|
</Card>
|
|
|
|
{step === 1 ? (
|
|
<p className="text-center text-sm text-muted-foreground font-medium">
|
|
Already have an account? <Link href="/login" className="font-bold text-foreground hover:text-primary transition-colors">Log in</Link>
|
|
</p>
|
|
) : (
|
|
<button onClick={() => setStep(1)} className="w-full text-center text-sm font-bold text-muted-foreground hover:text-foreground transition-colors">
|
|
Go back
|
|
</button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|