'use client'; import { useEffect, useState } from 'react'; import dynamic from 'next/dynamic'; import { Download, ExternalLink, FileWarning, ZoomIn } from 'lucide-react'; import { useQuery } from '@tanstack/react-query'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { apiFetch } from '@/lib/api/client'; import { isWordDocx } from '@/lib/constants/file-validation'; // yet-another-react-lightbox is ~50kb, lazy-load it. const Lightbox = dynamic(() => import('yet-another-react-lightbox'), { ssr: false }); import 'yet-another-react-lightbox/styles.css'; // pdfjs-dist is ~150kb gzip - lazy-load so routes that never preview // PDFs don't ship it. ssr:false because the worker setup needs window. const PdfViewer = dynamic(() => import('./pdf-viewer').then((m) => ({ default: m.PdfViewer })), { ssr: false, loading: () => (
{text}