Swap functionality: PDF only in Pro DPPs, CBT only in AI Coach PrepPilot AI
This commit is contained in:
@@ -82,6 +82,9 @@ export default function AIDailyPracticePage() {
|
||||
}, {} as Record<string, any>);
|
||||
|
||||
const filteredDpps = dpps.filter(dpp => {
|
||||
// Only show PDF DPPs here
|
||||
if (!dpp.pdf_url) return false;
|
||||
|
||||
if (dateFilter) {
|
||||
if (!dpp.scheduled_date) return false;
|
||||
const scheduledDate = new Date(dpp.scheduled_date).toISOString().split('T')[0];
|
||||
@@ -210,9 +213,9 @@ export default function AIDailyPracticePage() {
|
||||
<div className="flex flex-col sm:flex-row gap-2 shrink-0 md:self-center">
|
||||
{isUpcoming ? (
|
||||
<Button disabled variant="outline" size="sm" className="font-bold">Starts Soon</Button>
|
||||
) : isExpired && !isAttempted && !dpp.pdf_url ? (
|
||||
) : isExpired && !isAttempted ? (
|
||||
<Button disabled variant="outline" size="sm" className="font-bold bg-secondary/50">Expired</Button>
|
||||
) : dpp.pdf_url ? (
|
||||
) : (
|
||||
hasAccessTo('PRO') ? (
|
||||
<Button onClick={() => setSelectedPdfDpp(dpp)} variant="secondary" size="sm" className="rounded-xl bg-[var(--cyan-ai)] text-black hover:bg-[var(--cyan-ai-80)] font-extrabold gap-2 text-xs shadow-[0_0_12px_rgba(12,96,96,0.2)]">
|
||||
<FileText size={14} className="text-black" /> View PDF
|
||||
@@ -220,33 +223,6 @@ export default function AIDailyPracticePage() {
|
||||
) : (
|
||||
<Button variant="outline" size="sm" className="opacity-50" disabled><Lock size={14} className="mr-2"/> View PDF</Button>
|
||||
)
|
||||
) : isAttempted ? (
|
||||
<>
|
||||
<Link href={`/cbt/${dpp.id}/result`}>
|
||||
<Button variant="outline" size="sm" className="font-bold border-border">Result</Button>
|
||||
</Link>
|
||||
{!isExpired && (
|
||||
hasAccessTo('AI_COACH') ? (
|
||||
<Link href={`/cbt/${dpp.id}`}>
|
||||
<Button variant="secondary" size="sm" className="font-bold bg-[var(--cyan-ai-10)] text-[var(--cyan-ai)] hover:bg-[var(--cyan-ai-20)] gap-2">
|
||||
<Play size={14} className="fill-current" /> Retake Test
|
||||
</Button>
|
||||
</Link>
|
||||
) : (
|
||||
<Button variant="outline" size="sm" className="opacity-50" disabled><Lock size={14} className="mr-2"/> Retake</Button>
|
||||
)
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
hasAccessTo('AI_COACH') ? (
|
||||
<Link href={`/cbt/${dpp.id}`}>
|
||||
<Button variant="secondary" size="sm" className="rounded-xl bg-[var(--cyan-ai)] text-black hover:bg-[var(--cyan-ai-80)] font-extrabold gap-2 text-xs shadow-[0_0_12px_rgba(12,96,96,0.2)]">
|
||||
<Play size={14} className="fill-black" /> Launch Practice Test
|
||||
</Button>
|
||||
</Link>
|
||||
) : (
|
||||
<Button variant="outline" size="sm" className="opacity-50" disabled><Lock size={14} className="mr-2"/> Launch Practice Test</Button>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user