"use client"; import { useEffect } from "react"; import { X, Download } from "lucide-react"; import { cn } from "@/lib/utils"; import { useTouchGesture } from "@/hooks/useTouchGesture"; interface MobileFileViewerProps { isOpen: boolean; onClose: () => void; fileName?: string; children?: React.ReactNode; className?: string; } /** * Full-screen file viewer overlay for mobile. * - Slides up from the bottom on open * - Swipe down to close * - Back/close button in header * - Content area is scrollable with pinch-to-zoom enabled on images */ export function MobileFileViewer({ isOpen, onClose, fileName, children, className, }: MobileFileViewerProps) { const swipeHandlers = useTouchGesture({ onSwipeDown: onClose, threshold: 80 }); // Lock body scroll and close on Escape useEffect(() => { if (isOpen) { document.body.style.overflow = "hidden"; } else { document.body.style.overflow = ""; } return () => { document.body.style.overflow = ""; }; }, [isOpen]); useEffect(() => { if (!isOpen) return; const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; document.addEventListener("keydown", onKey); return () => document.removeEventListener("keydown", onKey); }, [isOpen, onClose]); return (