Fix MinIO DPP upload linking to frontend

This commit is contained in:
2026-09-25 13:37:29 +05:30
parent 06cc9dac63
commit b20531b1e3
3 changed files with 11 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
"use client"
"use client"
import { fetchWithAuth } from "@/lib/apiClient";
import { Button } from "@/components/ui/button"
@@ -197,8 +197,12 @@ 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 ? (
) : isExpired && !isAttempted && !dpp.pdf_url ? (
<Button disabled variant="outline" size="sm" className="font-bold bg-secondary/50">Expired</Button>
) : dpp.pdf_url ? (
<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
</Button>
) : isAttempted ? (
<>
<Link href={`/cbt/${dpp.id}/result`}>
@@ -298,7 +302,7 @@ export default function AIDailyPracticePage() {
style={{minHeight: isFullScreen ? 'calc(100vh - 120px)' : '75vh'}}
>
<embed
src={getPdfUrl(selectedPdfDpp.title)}
src={selectedPdfDpp.pdf_url || getPdfUrl(selectedPdfDpp.title)}
type="application/pdf"
className="w-full h-full"
style={{height: isFullScreen ? 'calc(100vh - 120px)' : '75vh'}}