fix: smart CBT result/back routing for DPPs and add Test Type selector in Admin panel

This commit is contained in:
2026-07-27 15:55:54 +05:30
parent 053b727725
commit 62d15c85f6
5 changed files with 40 additions and 7 deletions

View File

@@ -41,6 +41,7 @@ export default function AdminTestsPage() {
// Upload Form State
const [title, setTitle] = useState("")
const [testType, setTestType] = useState("CBT")
const [examPattern, setExamPattern] = useState("JEE_Main")
const [timeLimit, setTimeLimit] = useState("180")
const [scheduledDate, setScheduledDate] = useState<Date | null>(null)
@@ -180,6 +181,7 @@ export default function AdminTestsPage() {
const payload = {
title,
type: testType,
exam_pattern: examPattern,
time_limit: parseInt(timeLimit),
admin_id: userId,
@@ -236,6 +238,27 @@ export default function AdminTestsPage() {
<label className="text-sm font-medium">Test Title</label>
<Input required value={title} onChange={e => setTitle(e.target.value)} placeholder="e.g. JEE Main Mock Test 1" />
</div>
{/* TEST TYPE — KEY DIFFERENTIATOR */}
<div className="space-y-2">
<label className="text-sm font-medium flex items-center gap-2">
Test Type
<span className="text-[10px] text-muted-foreground font-normal">(determines which section it appears in)</span>
</label>
<select
className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
value={testType}
onChange={(e) => setTestType(e.target.value)}
>
<option value="CBT">🎯 CBT Mock Test — appears in Mock Tests section</option>
<option value="DPS">📋 DPP (Daily Practice) — appears in PrepPilot AI section</option>
</select>
<p className="text-[11px] text-muted-foreground">
{testType === 'CBT'
? '✅ This will appear under Dashboard → Mock Tests (CBT) for students to attempt.'
: '✅ This will appear under AI Coach → PrepPilot AI as a DPP with full CBT interface.'}
</p>
</div>
<div className="space-y-2">
<label className="text-sm font-medium">Exam Pattern</label>