// src/components/product/ProductImageGallery.tsx 'use client'; import { useState } from 'react'; import Image from 'next/image'; import { WooCommerceImage } from '@/types/woocommerce'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { ChevronLeft, ChevronRight, Expand, Heart } from 'lucide-react'; import { cn } from '@/lib/utils'; import { Dialog, DialogContent, DialogTrigger, } from '@/components/ui/dialog'; interface ProductImageGalleryProps { images: WooCommerceImage[]; productName: string; isOnSale?: boolean; discountPercentage?: number; isFeatured?: boolean; } export default function ProductImageGallery({ images, productName, isOnSale = false, discountPercentage = 0, isFeatured = false, }: ProductImageGalleryProps): JSX.Element { const [currentImageIndex, setCurrentImageIndex] = useState(0); const [isWishlisted, setIsWishlisted] = useState(false); const hasMultipleImages = images.length > 1; const currentImage = images[currentImageIndex] || images[0]; const goToPrevious = (): void => { setCurrentImageIndex((prev) => prev === 0 ? images.length - 1 : prev - 1 ); }; const goToNext = (): void => { setCurrentImageIndex((prev) => prev === images.length - 1 ? 0 : prev + 1 ); }; const goToImage = (index: number): void => { setCurrentImageIndex(index); }; const toggleWishlist = (): void => { setIsWishlisted(!isWishlisted); }; if (!currentImage) { return (