fix(pdf-viewer): load PDF.js from CDN instead of npm

- Loads PDF.js from CDN to avoid SSR issues
- Component handles loading state while PDF.js initializes
- No more dynamic import errors
This commit is contained in:
2026-03-23 21:54:13 +01:00
parent 76e37e2363
commit 746615e095
2 changed files with 37 additions and 30 deletions
+2 -17
View File
@@ -1,33 +1,18 @@
"use client";
import BackToMC from "@/components/mission-control/BackToMC";
import dynamic from "next/dynamic";
// Dynamically import PDFViewer with SSR disabled
const PDFViewer = dynamic(() => import("@/components/mission-control/PDFViewerClient"), {
ssr: false,
loading: () => (
<div className="flex items-center justify-center h-full">
<div className="text-center">
<div className="animate-spin text-6xl mb-4"></div>
<p className="text-slate-400">Loading PDF viewer...</p>
</div>
</div>
),
});
import PDFViewerClient from "@/components/mission-control/PDFViewerClient";
export default function PdfViewerPage() {
return (
<div className="min-h-screen bg-slate-950 text-white flex flex-col">
{/* Header */}
<div className="bg-slate-900 border-b border-slate-800 px-6 py-4 flex-shrink-0">
<h1 className="text-2xl font-bold text-white">📄 PDF Viewer</h1>
<p className="text-slate-400 text-sm">View and analyze PDF documents</p>
</div>
{/* Content */}
<div className="flex-1 overflow-hidden">
<PDFViewer />
<PDFViewerClient />
</div>
</div>
);