From 6e8df1841ebb0e5fcdc904773f00ddc30f96de36 Mon Sep 17 00:00:00 2001 From: ectasy663 Date: Tue, 22 Sep 2026 17:39:18 +0530 Subject: [PATCH] Fix OG image, CBT filters, syllabus split, and trial duration --- src/app/api/og/progress/route.tsx | 72 +++++++++++++------- src/app/dashboard/cbt/page.tsx | 4 +- src/app/dashboard/layout.tsx | 2 +- src/app/dashboard/progress/page.tsx | 101 ++++++++++++++++++---------- src/components/AI/ProgressShare.tsx | 6 +- 5 files changed, 119 insertions(+), 66 deletions(-) diff --git a/src/app/api/og/progress/route.tsx b/src/app/api/og/progress/route.tsx index 7bf83ca..965fd81 100644 --- a/src/app/api/og/progress/route.tsx +++ b/src/app/api/og/progress/route.tsx @@ -12,7 +12,9 @@ export async function GET(req: NextRequest) { const accuracy = searchParams.get('accuracy') || '0'; const name = searchParams.get('name') || 'Student'; - // Renders a high-end, minimalist graphic using pure Tailwind and React + const target = searchParams.get('target') || 'JEE'; + const plan = searchParams.get('plan') || 'Free'; + return new ImageResponse( (
-
- PragatiVeer -
-
- {name}'s JEE Preparation Progress -
- -
- {/* Streak Metric */} -
- {streak}🔥 - Day Streak + {/* Header */} +
+
+
+ PRAGATIVEER
+
+ Weekly Report +
+
+ + {/* Main Content */} +
+

You crushed it this week!

- {/* Accuracy Metric */} -
- {accuracy}% - Top Accuracy + {/* 2x2 Grid */} +
+
+ {streak} + Day Streak +
+
+ {accuracy}% + Accuracy +
+
+ 4 + Tests Taken +
+
+ 78% + Avg Score +
-
- Join me on pragativeer.com/invite + {/* Footer */} +
+
+
{name}
+
{plan} Plan
+
{target} Aspirant
+
+
+ contact@pragativeer.com +
), diff --git a/src/app/dashboard/cbt/page.tsx b/src/app/dashboard/cbt/page.tsx index 9aba5a1..050a750 100644 --- a/src/app/dashboard/cbt/page.tsx +++ b/src/app/dashboard/cbt/page.tsx @@ -68,7 +68,9 @@ export default function CBTPage() { if (testRes.ok) { let testsData = await testRes.json(); if (selectedPattern === "JEE") { - testsData = testsData.filter((t: any) => t.exam_pattern === "JEE_Main" || t.exam_pattern === "JEE_Advanced"); + testsData = testsData.filter((t: any) => t.exam_pattern?.includes("JEE")); + } else if (selectedPattern === "NEET") { + testsData = testsData.filter((t: any) => t.exam_pattern === "NEET"); } setExams(testsData); } diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx index bee3c06..55663ad 100644 --- a/src/app/dashboard/layout.tsx +++ b/src/app/dashboard/layout.tsx @@ -376,7 +376,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) { {trialInfo.isTrialActive && (
- 15 Days Free Trial — Day {trialInfo.trialDayNumber} + {trialInfo.trialTotalDays} Days Free Trial — Day {trialInfo.trialDayNumber}
)} diff --git a/src/app/dashboard/progress/page.tsx b/src/app/dashboard/progress/page.tsx index 82de848..67855b3 100644 --- a/src/app/dashboard/progress/page.tsx +++ b/src/app/dashboard/progress/page.tsx @@ -81,20 +81,7 @@ const DEMO_SUBJECTS: Subject[] = [ } ] }, - { - name: "Mathematics / Biology", - completionPct: 22, - chapters: [ - { - name: "Calculus", - isExpanded: false, - topics: [ - { name: "Limits", status: "In Progress", accuracy: 60, questionsAttempted: 45 }, - { name: "Derivatives", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, - ] - } - ] - } + // Math/Bio dynamic subjects handled below ] const ZERO_SUBJECTS: Subject[] = [ @@ -143,20 +130,7 @@ const ZERO_SUBJECTS: Subject[] = [ } ] }, - { - name: "Mathematics / Biology", - completionPct: 0, - chapters: [ - { - name: "Core Foundation", - isExpanded: false, - topics: [ - { name: "Limits / Cell Structure", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, - { name: "Derivatives / Genetics", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, - ] - } - ] - } + // Math/Bio dynamic subjects handled below ] export default function ProgressTrackerPage() { @@ -166,19 +140,72 @@ export default function ProgressTrackerPage() { useEffect(() => { const targetExam = user?.target_exam || "JEE_Main"; - const mathOrBio = targetExam === "NEET" ? "Biology" : "Mathematics"; + const isNeet = targetExam === "NEET"; - const getSubjects = (demo: boolean) => { - const base = demo ? DEMO_SUBJECTS : ZERO_SUBJECTS; - return base.map(s => { - if (s.name === "Mathematics / Biology") { - return { ...s, name: mathOrBio }; + const mathDemoSubject: Subject = { + name: "Mathematics", + completionPct: 22, + chapters: [ + { + name: "Calculus", + isExpanded: true, + topics: [ + { name: "Limits", status: "In Progress", accuracy: 60, questionsAttempted: 45 }, + { name: "Derivatives", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, + ] } - return s; - }); + ] }; + + const bioDemoSubject: Subject = { + name: "Biology", + completionPct: 35, + chapters: [ + { + name: "Cell Structure", + isExpanded: true, + topics: [ + { name: "Cell Wall", status: "Practiced", accuracy: 80, questionsAttempted: 60 }, + { name: "Nucleus", status: "In Progress", accuracy: 50, questionsAttempted: 25 }, + ] + } + ] + }; + + const mathZeroSubject: Subject = { + name: "Mathematics", + completionPct: 0, + chapters: [ + { + name: "Calculus", + isExpanded: true, + topics: [ + { name: "Limits", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, + { name: "Derivatives", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, + ] + } + ] + }; + + const bioZeroSubject: Subject = { + name: "Biology", + completionPct: 0, + chapters: [ + { + name: "Cell Structure", + isExpanded: true, + topics: [ + { name: "Cell Wall", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, + { name: "Nucleus", status: "Not Started", accuracy: 0, questionsAttempted: 0 }, + ] + } + ] + }; + + const base = isDemo ? [...DEMO_SUBJECTS] : [...ZERO_SUBJECTS]; + base.push(isDemo ? (isNeet ? bioDemoSubject : mathDemoSubject) : (isNeet ? bioZeroSubject : mathZeroSubject)); - setSubjects(getSubjects(isDemo)); + setSubjects(base); }, [isDemo, user?.target_exam]); const toggleChapter = (subjectIndex: number, chapterIndex: number) => { diff --git a/src/components/AI/ProgressShare.tsx b/src/components/AI/ProgressShare.tsx index 6cbca8e..a289dd2 100644 --- a/src/components/AI/ProgressShare.tsx +++ b/src/components/AI/ProgressShare.tsx @@ -14,9 +14,9 @@ export function ProgressShare() { const streak = "12" const accuracy = "85" const name = user?.name || "Student" - - // Use a fallback image if API endpoint is not yet ready, else use real endpoint - const imageUrl = `/api/og/progress?streak=${streak}&accuracy=${accuracy}&name=${encodeURIComponent(name)}` + const target = user?.target_exam === "NEET" ? "NEET" : "JEE" + const plan = user?.tier === "Al_Coach" ? "AI Coach" : user?.tier || "Free" + const imageUrl = `/api/og/progress?streak=${streak}&accuracy=${accuracy}&name=${encodeURIComponent(name)}&target=${target}&plan=${encodeURIComponent(plan)}` const handleDownload = async () => { try {