feat: setup admin JSON generation and pdf viewer for free plan DPPs

This commit is contained in:
2026-07-27 14:56:25 +05:30
parent c214ca41b6
commit a5bb2d867c
74 changed files with 8546 additions and 915 deletions

View File

@@ -11,13 +11,13 @@ import { Logo } from "@/components/Logo"
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 [isSubmitted, setIsSubmitted] = useState(false)
const router = useRouter()
const handleNextStep = () => {
if (step === 1) setStep(2)
else router.push("/dashboard")
else setIsSubmitted(true)
}
return (
@@ -45,125 +45,133 @@ export default function SignupPage() {
</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" />
))}
{isSubmitted ? (
<Card className="border-border bg-secondary/10 backdrop-blur-xl shadow-[0_0_50px_-20px_var(--color-primary)] rounded-[2rem] overflow-hidden text-center py-8">
<CardContent className="space-y-6 pt-4 flex flex-col items-center">
<CheckCircle2 size={64} className="text-primary mb-4" />
<h2 className="text-3xl font-black tracking-tight text-foreground">Thanks for registering!</h2>
<p className="text-muted-foreground text-sm font-medium px-4 leading-relaxed">
Our team will get back to you shortly. <br/><br/>
<span className="font-bold text-foreground">Note:</span> We are not live currently. Please use the demo credentials provided at the login screen to explore the platform.
</p>
<Link href="/login" className="w-full mt-4">
<Button 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)]">
Go to Login
</Button>
</Link>
</CardContent>
</Card>
) : (
<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="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 className="space-y-2">
<label className="text-sm font-bold text-foreground">Phone Number</label>
<div className="flex gap-2">
<div className="flex items-center justify-center bg-secondary/50 border border-border rounded-xl px-3 text-sm font-bold text-muted-foreground">
+91
</div>
<input
type="tel"
maxLength={10}
pattern="[0-9]*"
onInput={(e) => {
e.currentTarget.value = e.currentTarget.value.replace(/[^0-9]/g, '');
}}
placeholder="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>
) : (
<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 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</option>
<option value="neet">NEET</option>
<option value="jee_neet">JEE + NEET</option>
</select>
</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 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 11th</option>
<option value="12">Class 12th</option>
<option value="dropper">Dropper</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 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>
<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>
</CardContent>
</Card>
)}
{step === 1 ? (
<p className="text-center text-sm text-muted-foreground font-medium">