"use client" import { useState, useEffect } from "react" import { Card, CardContent } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Trophy, TrendingUp, AlertTriangle, Sparkles, Building2, Target, Sliders, CheckCircle2, ChevronRight, UserCheck } from "lucide-react" import { useActiveUser } from "@/hooks/useActiveUser" export default function RankPredictorPage() { const { user } = useActiveUser() const [exam, setExam] = useState<"NEET" | "JEE">("NEET") const [physics, setPhysics] = useState(135) const [chemistry, setChemistry] = useState(155) const [bioOrMath, setBioOrMath] = useState(330) // Bio out of 360 or Math out of 100 const [saved, setSaved] = useState(false) useEffect(() => { if (user?.target_exam) { if (user.target_exam.includes("NEET")) { setExam("NEET") setPhysics(140) setChemistry(150) setBioOrMath(320) } else { setExam("JEE") setPhysics(65) setChemistry(70) setBioOrMath(75) } } }, [user]) const maxTotal = exam === "NEET" ? 720 : 300 const maxPhysics = exam === "NEET" ? 180 : 100 const maxChem = exam === "NEET" ? 180 : 100 const maxThird = exam === "NEET" ? 360 : 100 const totalScore = physics + chemistry + bioOrMath // Calculate predicted rank based on total score percentage const calculateRank = (score: number, max: number) => { const pct = score / max if (pct >= 0.95) return Math.max(12, Math.round((1 - pct) * 2000)) if (pct >= 0.90) return Math.round(1500 + (0.95 - pct) * 50000) if (pct >= 0.80) return Math.round(4000 + (0.90 - pct) * 80000) if (pct >= 0.70) return Math.round(12000 + (0.80 - pct) * 120000) if (pct >= 0.60) return Math.round(25000 + (0.70 - pct) * 200000) return Math.round(60000 + (0.60 - pct) * 400000) } const predictedRank = calculateRank(totalScore, maxTotal) const colleges = exam === "NEET" ? [ { name: "AIIMS New Delhi", category: "Top Tier Medical", minScore: 690, color: "text-[#00F0FF]", border: "border-[#00F0FF]/30", bg: "bg-[#00F0FF]/10" }, { name: "MAMC New Delhi", category: "Central GMC", minScore: 665, color: "text-amber-400", border: "border-amber-400/30", bg: "bg-amber-400/10" }, { name: "KGMU Lucknow / VMMCH", category: "Premier State GMC", minScore: 635, color: "text-emerald-400", border: "border-emerald-400/30", bg: "bg-emerald-400/10" }, { name: "Top State Govt Medical College", category: "State Quota", minScore: 590, color: "text-purple-400", border: "border-purple-400/30", bg: "bg-purple-400/10" }, ] : [ { name: "IIT Bombay / IIT Delhi (CS)", category: "Top 5 IITs", minScore: 260, color: "text-[#00F0FF]", border: "border-[#00F0FF]/30", bg: "bg-[#00F0FF]/10" }, { name: "IIT Madras / Kharagpur", category: "Core Engineering", minScore: 220, color: "text-amber-400", border: "border-amber-400/30", bg: "bg-amber-400/10" }, { name: "NIT Trichy / Surathkal", category: "Top NITs", minScore: 180, color: "text-emerald-400", border: "border-emerald-400/30", bg: "bg-emerald-400/10" }, { name: "Top State Engineering Colleges", category: "State Govt", minScore: 140, color: "text-purple-400", border: "border-purple-400/30", bg: "bg-purple-400/10" }, ] return (
Simulate your subject marks to dynamically calculate your All India Rank (AIR) and college admission chances.
{user && (Your Biology/Math score ({bioOrMath}) provides solid rank leverage. Keep maintaining your revision momentum.
Increasing Physics by just 25 marks will boost your rank by approximately ~4,800 positions.