"use client"; import { useState } from "react"; import Link from "next/link"; import { ArrowLeft, ArrowRight, Download, Plus, Copy, CheckCircle } from "lucide-react"; interface PageOutline { pageNumber: number; type: string; title: string; keyPoints: string[]; imagePrompt: string; } interface ZineData { id: string; topic: string; style: string; tone: string; outline: PageOutline[]; pageUrls: string[]; printLayoutUrl: string | null; shareUrl: string; createdAt: string; } interface ZineViewerProps { zine: ZineData; } export default function ZineViewer({ zine }: ZineViewerProps) { const [currentPage, setCurrentPage] = useState(0); const [copied, setCopied] = useState(false); const copyShareLink = async () => { await navigator.clipboard.writeText(window.location.href); setCopied(true); setTimeout(() => setCopied(false), 2000); }; const handlePrevPage = () => { setCurrentPage((p) => (p > 0 ? p - 1 : zine.pageUrls.length - 1)); }; const handleNextPage = () => { setCurrentPage((p) => (p < zine.pageUrls.length - 1 ? p + 1 : 0)); }; return (
{zine.style} • {zine.tone}
{/* Main Viewer */}Page {currentPage + 1} of {zine.pageUrls.length}
{zine.outline[currentPage] && ({zine.outline[currentPage].title}
)}Created with{" "} MycoZine {" by "} MycoFi
{new Date(zine.createdAt).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", })}