"use client"; import { RefreshCw, Share, Info, Loader2, Trash2, ChevronLeft, ChevronRight } from "lucide-react"; import { useToast } from "@/hooks/use-toast"; import { Button } from "@/components/ui/button"; interface PageData { id: number; title: string; image: string; prompt: string; characterUploads?: string[]; style: string; dbId?: string; } interface ComicCanvasProps { page: PageData; pageIndex: number; totalPages?: number; isLoading?: boolean; isOwner?: boolean; onInfoClick?: () => void; onRedrawClick?: () => void; onDeletePage?: () => void; onNextPage?: () => void; onPrevPage?: () => void; } export function ComicCanvas({ page, pageIndex, totalPages = 1, isLoading = false, isOwner = true, onInfoClick, onRedrawClick, onDeletePage, onNextPage, onPrevPage, }: ComicCanvasProps) { const { toast } = useToast(); return (
{/* Dot grid background */}
{`Page { const rect = e.currentTarget.getBoundingClientRect(); const clickX = e.clientX - rect.left; const imageWidth = rect.width; if (clickX > imageWidth / 2) { // Right half - next page onNextPage?.(); } else { // Left half - previous page onPrevPage?.(); } }} />
{/* Page label */}
Page {page.id}
{/* Action buttons below the page image */}
{onInfoClick && ( )} {isOwner && ( )} {isOwner && totalPages > 1 && onDeletePage && ( )}
Page {pageIndex + 1} of {totalPages}
{/* Mobile action buttons */}
{onInfoClick && ( )} {isOwner && ( )}
); }