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

@@ -3,7 +3,7 @@
import { useState } from "react"
import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Check, X, ShieldCheck, Loader2, Minus } from "lucide-react"
import { Check, X, ShieldCheck, Loader2, Minus, CheckCircle2 } from "lucide-react"
import { useActiveUser } from "@/hooks/useActiveUser"
@@ -103,42 +103,46 @@ export default function UpgradePage() {
<p className="text-xl text-muted-foreground">Unlock the full power of PragatiVeer to master JEE & NEET.</p>
</div>
<div className="grid grid-cols-1 md:grid-cols-3 gap-8 items-start">
<div className="grid grid-cols-1 md:grid-cols-3 gap-8 items-stretch">
{/* Free Tier */}
<Card className="bg-background/80 backdrop-blur-md border-white p-6 rounded-[2rem] flex flex-col h-full z-10 relative">
<CardHeader>
<CardTitle className="text-2xl">Free</CardTitle>
<CardDescription>Basic access for everyone.</CardDescription>
<div className="mt-4 font-black text-4xl">₹10<span className="text-xl text-muted-foreground font-semibold">/year</span></div>
</CardHeader>
<CardContent className="space-y-4 text-sm font-medium">
<div className="flex items-center gap-3"><Check className="text-white" size={18}/> Subject-wise diagnostics</div>
<div className="flex items-center gap-3"><Check className="text-white" size={18}/> Basic progress tracking</div>
<div className="flex items-center gap-3 text-muted-foreground opacity-50"><Minus size={18}/> Tests</div>
<div className="flex items-center gap-3 text-muted-foreground opacity-50"><Minus size={18}/> AI Spaced Repetition</div>
<div className="flex items-center gap-3 text-muted-foreground opacity-50"><Minus size={18}/> Parent Analytics</div>
</CardContent>
<CardFooter>
<Button variant="outline" className="w-full rounded-2xl h-12 border-white text-white font-bold text-lg hover:bg-secondary hover:text-white" disabled>Current Plan</Button>
<Card className="bg-background/80 backdrop-blur-md border border-border p-6 rounded-[2rem] flex flex-col justify-between h-full z-10 relative shadow-xl hover:border-border/80 transition-colors">
<div>
<CardHeader className="p-0 mb-6">
<CardTitle className="text-3xl font-bold mb-1 text-foreground">Free</CardTitle>
<CardDescription className="text-muted-foreground mb-6 text-base">Perfect to get started.</CardDescription>
<div className="text-6xl font-bold tracking-tighter mb-6 text-foreground">
₹0<span className="text-xl text-white/60 font-medium tracking-normal ml-1">/year</span>
</div>
</CardHeader>
<CardContent className="p-0 space-y-3 mb-6 font-medium text-lg">
<div className="flex items-center gap-4"><CheckCircle2 className="text-foreground shrink-0" size={24}/> 1 Daily Practice Sheet</div>
<div className="flex items-center gap-4"><CheckCircle2 className="text-foreground shrink-0" size={24}/> Basic Performance Analytics</div>
<div className="flex items-center gap-4"><CheckCircle2 className="text-foreground shrink-0" size={24}/> Community Access</div>
</CardContent>
</div>
<CardFooter className="p-0">
<Button variant="outline" className="w-full rounded-2xl h-12 border-border text-foreground font-bold text-lg hover:bg-secondary" disabled>Get Started Free</Button>
</CardFooter>
</Card>
{/* Pro Tier */}
<Card className="bg-background/80 backdrop-blur-md border-2 border-yellow-500 shadow-[0_0_25px_-5px_var(--color-yellow-500)] p-6 rounded-[2rem] flex flex-col h-full z-10 relative">
<CardHeader>
<CardTitle className="text-2xl text-yellow-500">Pro</CardTitle>
<CardDescription>For serious aspirants.</CardDescription>
<div className="mt-4 font-black text-4xl">₹1299<span className="text-xl text-muted-foreground font-semibold">/year</span></div>
</CardHeader>
<CardContent className="space-y-4 text-sm font-medium">
<div className="flex items-center gap-3"><Check className="text-yellow-500" size={18}/> Everything in Free</div>
<div className="flex items-center gap-3"><Check className="text-yellow-500" size={18}/> Unlimited Sectional Tests</div>
<div className="flex items-center gap-3"><Check className="text-yellow-500" size={18}/> Performance Analytics</div>
<div className="flex items-center gap-3"><Check className="text-yellow-500" size={18}/> Parent Dashboard</div>
<div className="flex items-center gap-3 text-muted-foreground opacity-50"><Minus size={18}/> AI Mistake Heatmap</div>
<div className="flex items-center gap-3 text-muted-foreground opacity-50"><Minus size={18}/> Spaced Repetition (SM-2)</div>
</CardContent>
<CardFooter>
<Card className="bg-background/80 backdrop-blur-md border border-border p-6 rounded-[2rem] flex flex-col justify-between h-full z-10 relative shadow-xl hover:border-border/80 transition-colors">
<div>
<CardHeader className="p-0 mb-6">
<CardTitle className="text-3xl font-bold mb-1 text-yellow-500">Pro</CardTitle>
<CardDescription className="text-muted-foreground mb-6 text-base">Perfect for self-paced practice.</CardDescription>
<div className="text-6xl font-bold tracking-tighter mb-6 text-yellow-500">
₹3,499<span className="text-xl text-yellow-500/60 font-medium tracking-normal ml-1">/year</span>
</div>
</CardHeader>
<CardContent className="p-0 space-y-3 mb-6 font-medium text-lg">
<div className="flex items-center gap-4"><CheckCircle2 className="text-yellow-500 shrink-0" size={24}/> Unlimited Daily Practice Sheets</div>
<div className="flex items-center gap-4"><CheckCircle2 className="text-yellow-500 shrink-0" size={24}/> Weekly Test Series & Mock Tests</div>
<div className="flex items-center gap-4"><CheckCircle2 className="text-yellow-500 shrink-0" size={24}/> Detailed Performance Analytics</div>
<div className="flex items-center gap-4"><CheckCircle2 className="text-yellow-500 shrink-0" size={24}/> Parent Dashboard Access</div>
</CardContent>
</div>
<CardFooter className="p-0">
<Button
className="w-full bg-yellow-500 text-black hover:bg-yellow-400 font-bold text-lg rounded-2xl h-12"
onClick={() => handleUpgrade("Pro")}
@@ -150,20 +154,23 @@ export default function UpgradePage() {
</Card>
{/* AI Coach Tier */}
<Card className="bg-secondary/30 backdrop-blur-xl border-2 border-[#00F0FF] shadow-[0_0_25px_-5px_#00F0FF] p-6 rounded-[2rem] flex flex-col transition-all h-full relative">
<CardHeader>
<CardTitle className="text-2xl flex items-center gap-2 text-[#00F0FF]">AI Coach <ShieldCheck size={24} className="text-[#00F0FF]"/></CardTitle>
<CardDescription>Personalized mastery loop.</CardDescription>
<div className="mt-4 font-black text-4xl">₹1599<span className="text-xl text-muted-foreground font-semibold">/year</span></div>
</CardHeader>
<CardContent className="space-y-4 text-sm font-medium">
<div className="flex items-center gap-3"><Check className="text-[#00F0FF]" size={18}/> Everything in Pro</div>
<div className="flex items-center gap-3"><Check className="text-[#00F0FF]" size={18}/> Daily AI Error Review Queue</div>
<div className="flex items-center gap-3"><Check className="text-[#00F0FF]" size={18}/> SM-2 Spaced Repetition</div>
<div className="flex items-center gap-3"><Check className="text-[#00F0FF]" size={18}/> Mistake Heatmap Tracking</div>
<div className="flex items-center gap-3"><Check className="text-[#00F0FF]" size={18}/> AI Chat Tutor Support</div>
</CardContent>
<CardFooter>
<Card className="bg-background/80 backdrop-blur-md border border-border p-6 rounded-[2rem] flex flex-col justify-between h-full z-10 relative shadow-xl hover:border-border/80 transition-colors">
<div>
<CardHeader className="p-0 mb-6">
<CardTitle className="text-3xl font-bold mb-2 text-[#00F0FF]">AI Coach</CardTitle>
<CardDescription className="text-muted-foreground mb-6 text-base">The complete AI-driven system.</CardDescription>
<div className="text-6xl font-bold tracking-tighter mb-6 text-[#00F0FF]">
₹11,999<span className="text-xl text-[#00F0FF]/60 font-medium tracking-normal ml-1">/year</span>
</div>
</CardHeader>
<CardContent className="p-0 space-y-3 mb-6 font-medium text-lg">
<div className="flex items-center gap-4"><CheckCircle2 className="text-[#00F0FF] shrink-0" size={24}/> Everything in Pro</div>
<div className="flex items-center gap-4"><CheckCircle2 className="text-[#00F0FF] shrink-0" size={24}/> AI Spaced Repetition (Mistakes)</div>
<div className="flex items-center gap-4"><CheckCircle2 className="text-[#00F0FF] shrink-0" size={24}/> 24/7 Streaming AI Tutor Chat</div>
<div className="flex items-center gap-4"><CheckCircle2 className="text-[#00F0FF] shrink-0" size={24}/> Predictive Rank & College Predictor</div>
</CardContent>
</div>
<CardFooter className="p-0">
<Button
className="w-full font-bold text-lg rounded-2xl h-12 bg-[#00F0FF] text-black hover:bg-[#00F0FF]/90 transition-all"
onClick={() => handleUpgrade("Al_Coach")}
@@ -175,6 +182,72 @@ export default function UpgradePage() {
</Card>
</div>
<p className="text-center mt-8 text-sm text-muted-foreground font-medium w-full">
* All above prices are inclusive of GST.
</p>
{/* ── Tier Comparison Matrix ── */}
<section className="mt-20 py-8">
<div className="text-center mb-12">
<h2 className="text-3xl md:text-4xl font-extrabold tracking-tight mb-3">Compare All Features</h2>
<p className="text-muted-foreground text-base md:text-lg max-w-2xl mx-auto">
Detailed breakdown of capabilities across Free, Pro, and AI Coach tiers.
</p>
</div>
<div className="overflow-x-auto rounded-2xl border border-border/50 bg-secondary/10 backdrop-blur-sm p-3 md:p-6 shadow-2xl">
<table className="w-full text-left border-collapse min-w-[700px]">
<thead>
<tr className="border-b border-border/50 bg-background/50">
<th className="p-4 md:p-6 font-bold text-lg w-2/5 border-l border-t border-border/50">Feature</th>
<th className="p-4 md:p-6 font-bold text-lg text-center w-1/5 border-x border-t border-white">Free</th>
<th className="p-4 md:p-6 font-bold text-lg text-center w-1/5 text-yellow-500 border-x border-t border-yellow-500">Pro</th>
<th className="p-4 md:p-6 font-bold text-lg text-center w-1/5 text-[#00F0FF] bg-[#00F0FF]/5 border-x border-t border-[#00F0FF]">AI Coach</th>
</tr>
</thead>
<tbody className="divide-y divide-border/30 text-sm md:text-base">
{[
{ name: "Daily Practice Sheets", free: "1/day", pro: "Unlimited", ai: "Unlimited" },
{ name: "Answer Keys", free: true, pro: true, ai: true },
{ name: "Basic Progress Dashboard", free: true, pro: true, ai: true },
{ name: "Streak Tracking", free: true, pro: true, ai: true },
{ name: "Leaderboard (City/School)", free: true, pro: true, ai: true },
{ name: "Topic-wise Micro-tests", free: "5/day", pro: "Unlimited", ai: "Unlimited" },
{ name: "Weekly Test Series", free: false, pro: true, ai: true },
{ name: "Full-Length Mock Tests", free: false, pro: "4/month", ai: "Unlimited" },
{ name: "Previous Year Papers", free: false, pro: true, ai: true },
{ name: "Detailed Performance Analytics", free: false, pro: true, ai: true },
{ name: "Chapter-wise Progress", free: false, pro: true, ai: true },
{ name: "Doubt Resolution (Community)", free: false, pro: true, ai: true },
{ name: "Parent Dashboard", free: false, pro: true, ai: true },
{ name: "Offline Mode (Download DPS)", free: false, pro: true, ai: true },
{ name: "AI Mistake Tracking", free: false, pro: false, ai: true },
{ name: "Spaced Repetition (SM-2)", free: false, pro: false, ai: true },
{ name: "Personalized Daily Study Plan", free: false, pro: false, ai: true },
{ name: "AI Tutor Chat", free: false, pro: false, ai: true },
{ name: "Exam Readiness Score", free: false, pro: false, ai: true },
{ name: "Exam Day Strategy", free: false, pro: false, ai: true },
{ name: "College Predictor", free: false, pro: false, ai: true },
{ name: "Study Time Optimization", free: false, pro: false, ai: true },
].map((feature, idx) => (
<tr key={idx} className="hover:bg-background/40 transition-colors">
<td className="p-4 md:p-6 font-medium border-y border-l border-border/30">{feature.name}</td>
<td className="p-4 md:p-6 text-center text-muted-foreground border border-white">
{typeof feature.free === 'boolean' ? (feature.free ? <CheckCircle2 className="mx-auto text-white" size={20} /> : <Minus className="mx-auto text-white/30" size={20} />) : <span className="font-semibold text-white">{feature.free}</span>}
</td>
<td className="p-4 md:p-6 text-center border border-yellow-500">
{typeof feature.pro === 'boolean' ? (feature.pro ? <CheckCircle2 className="mx-auto text-yellow-500" size={20} /> : <Minus className="mx-auto text-yellow-500/30" size={20} />) : <span className="font-semibold text-yellow-500">{feature.pro}</span>}
</td>
<td className="p-4 md:p-6 text-center bg-[#00F0FF]/5 border border-[#00F0FF]">
{typeof feature.ai === 'boolean' ? (feature.ai ? <CheckCircle2 className="mx-auto text-[#00F0FF]" size={20} /> : <Minus className="mx-auto text-[#00F0FF]/30" size={20} />) : <span className="font-semibold text-[#00F0FF]">{feature.ai}</span>}
</td>
</tr>
))}
</tbody>
</table>
</div>
</section>
{/* Mock Razorpay Modal */}
{showModal && (
<div className="fixed inset-0 bg-background/80 backdrop-blur-sm flex items-center justify-center z-50 p-4">