From 2438ec55d43371f0e4d21fd4b728d4ad5a4d5078 Mon Sep 17 00:00:00 2001 From: ectasy663 Date: Sun, 13 Sep 2026 21:30:58 +0530 Subject: [PATCH] feat: add plan selection onboarding screen after signup --- src/app/onboarding/page.tsx | 238 ++++++++++++++++++++++++++++++++++++ src/app/signup/page.tsx | 4 +- src/proxy.ts | 9 +- 3 files changed, 248 insertions(+), 3 deletions(-) create mode 100644 src/app/onboarding/page.tsx diff --git a/src/app/onboarding/page.tsx b/src/app/onboarding/page.tsx new file mode 100644 index 0000000..cc58d72 --- /dev/null +++ b/src/app/onboarding/page.tsx @@ -0,0 +1,238 @@ +"use client"; + +import { useState } from "react"; +import { useRouter } from "next/navigation"; +import { motion } from "framer-motion"; +import { + CheckCircle2, + Zap, + Brain, + BarChart3, + BookOpen, + MessageSquareText, + Trophy, + ArrowRight, + Sparkles, + Clock, +} from "lucide-react"; +import { Logo } from "@/components/Logo"; + +const PRO_FEATURES = [ + { icon: BookOpen, text: "Unlimited Daily Practice Sheets" }, + { icon: BarChart3, text: "Weekly Test Series & Mock Tests" }, + { icon: Trophy, text: "Detailed Performance Analytics" }, + { icon: Zap, text: "Parent Dashboard Access" }, +]; + +const AI_COACH_FEATURES = [ + { icon: BookOpen, text: "Everything in Pro" }, + { icon: Brain, text: "AI Spaced Repetition (Mistake Engine)" }, + { icon: MessageSquareText, text: "24/7 Streaming AI Tutor Chat" }, + { icon: Trophy, text: "Predictive Rank & College Predictor" }, +]; + +export default function OnboardingPage() { + const router = useRouter(); + const [selecting, setSelecting] = useState<"Pro" | "Al_Coach" | null>(null); + + const handleSelect = async (plan: "Pro" | "Al_Coach") => { + setSelecting(plan); + // Save chosen plan preference to localStorage so dashboard can read it + if (typeof window !== "undefined") { + localStorage.setItem("chosen_plan", plan); + } + // Small UX delay so the button animation feels intentional + await new Promise((r) => setTimeout(r, 600)); + router.push("/dashboard"); + }; + + return ( +
+ {/* Background glows */} +
+
+
+
+ +
+ {/* Logo */} +
+ +
+ + {/* Header */} + +
+ + Account Created Successfully! +
+

+ Choose Your Plan +

+

+ Both plans include a{" "} + 15-day free trial{" "} + with full AI Coach access — no card needed. +

+ + {/* Trial banner */} +
+ + Your 15-day free trial with all features starts now — Day 1 of 15 +
+
+ + {/* Plan Cards */} +
+ {/* Pro Plan */} + +
!selecting && handleSelect("Pro")} + > +
+ {/* Header */} +
+
+ Pro Plan +
+
+ ₹3,499 + /year +
+

+ Perfect for self-paced, structured practice. +

+
+ + {/* Features */} +
    + {PRO_FEATURES.map(({ icon: Icon, text }) => ( +
  • + + {text} +
  • + ))} +
+ + {/* CTA */} + +
+
+
+ + {/* AI Coach Plan */} + +
!selecting && handleSelect("Al_Coach")} + > + {/* Most Popular Badge */} +
+ Most Popular +
+ +
+ {/* Header */} +
+
+ AI Coach Plan +
+
+ ₹11,999 + /year +
+

+ The complete AI-driven preparation system. +

+
+ + {/* Features */} +
    + {AI_COACH_FEATURES.map(({ icon: Icon, text }) => ( +
  • + + {text} +
  • + ))} +
+ + {/* CTA */} + +
+
+
+
+ + {/* Bottom note */} + + 🔒 No credit card required for trial  ·  Cancel anytime  ·  All prices inclusive of GST + +
+
+ ); +} diff --git a/src/app/signup/page.tsx b/src/app/signup/page.tsx index c75a2ca..9600c71 100644 --- a/src/app/signup/page.tsx +++ b/src/app/signup/page.tsx @@ -119,9 +119,9 @@ export default function SignupPage() { You have full AI Coach access for your trial period. Let's build your streak starting today.

- + diff --git a/src/proxy.ts b/src/proxy.ts index b0d67f0..283b66e 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -19,9 +19,16 @@ export function proxy(request: NextRequest) { } } + // Protect /onboarding route + if (path.startsWith('/onboarding')) { + if (!token) { + return NextResponse.redirect(new URL('/login', request.url)); + } + } + return NextResponse.next(); } export const config = { - matcher: ['/dashboard/:path*', '/admin/:path*'] + matcher: ['/dashboard/:path*', '/admin/:path*', '/onboarding/:path*', '/onboarding'] };