"use client" import { useState, useEffect, useRef, useCallback } from "react" import Image from "next/image" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import Link from "next/link" import { ArrowLeft, Star, MapPin, Calendar, Instagram, ExternalLink } from "lucide-react" // Mock data - in a real app, this would come from a database const artistsData = { "1": { id: "1", name: "Christy Lumberg", specialty: "Expert Cover-Up & Illustrative Specialist", image: "/artists/christy-lumberg-portrait.jpg", bio: "With over 22 years of experience, Christy Lumberg is a powerhouse in the tattoo industry, known for her exceptional cover-ups, tattoo makeovers, and bold illustrative designs. Whether you're looking to transform old ink, refresh a faded piece, or bring a brand-new vision to life, Christy's precision and artistry deliver next-level results.", experience: "22+ years", rating: 5.0, reviews: 245, location: "United Tattoo - Fountain & Colorado Springs", availability: "Available", styles: ["Cover-ups", "Illustrative", "Black & Grey", "Color Work", "Tattoo Makeovers"], instagram: "@inkmama719", portfolio: [ { id: 1, image: "/artists/christy-lumberg-work-1.jpg", title: "Cover-Up Transformation", category: "Cover-ups", }, { id: 2, image: "/artists/christy-lumberg-work-2.jpg", title: "Illustrative Design", category: "Illustrative", }, { id: 3, image: "/artists/christy-lumberg-work-3.jpg", title: "Black & Grey Masterpiece", category: "Black & Grey", }, { id: 4, image: "/artists/christy-lumberg-work-4.jpg", title: "Vibrant Color Work", category: "Color Work", }, { id: 5, image: "/black-and-grey-portrait-tattoo-masterpiece.jpg", title: "Portrait Mastery", category: "Black & Grey" }, { id: 6, image: "/realistic-portrait-tattoo-artwork.jpg", title: "Realistic Portrait", category: "Illustrative" }, { id: 7, image: "/botanical-nature-tattoo-artwork.jpg", title: "Botanical Design", category: "Color Work" }, { id: 8, image: "/geometric-abstract-tattoo-artwork.jpg", title: "Geometric Art", category: "Illustrative" }, { id: 9, image: "/watercolor-illustrative-tattoo-artwork.jpg", title: "Watercolor Style", category: "Color Work" }, { id: 10, image: "/fine-line-botanical-tattoo-elegant.jpg", title: "Fine Line Botanical", category: "Illustrative" }, { id: 11, image: "/realistic-animal-tattoo-detailed-shading.jpg", title: "Animal Portrait", category: "Black & Grey" }, { id: 12, image: "/traditional-neo-traditional-tattoo-artwork.jpg", title: "Neo-Traditional", category: "Color Work" }, { id: 13, image: "/photorealistic-portrait-tattoo-black-and-grey.jpg", title: "Photorealistic Portrait", category: "Black & Grey" }, { id: 14, image: "/hyperrealistic-eye-tattoo-design.jpg", title: "Hyperrealistic Eye", category: "Black & Grey" }, { id: 15, image: "/delicate-fine-line-flower-tattoo.jpg", title: "Delicate Florals", category: "Illustrative" }, { id: 16, image: "/professional-tattoo-artist-working-on-detailed-tat.jpg", title: "Detailed Work", category: "Cover-ups" }, { id: 17, image: "/fine-line-minimalist-tattoo-artwork.jpg", title: "Minimalist Design", category: "Illustrative" }, { id: 18, image: "/simple-line-work-tattoo-artistic.jpg", title: "Line Work Art", category: "Black & Grey" }, { id: 19, image: "/minimalist-geometric-tattoo-design.jpg", title: "Geometric Minimalism", category: "Illustrative" }, { id: 20, image: "/abstract-geometric-shapes.png", title: "Abstract Geometry", category: "Color Work" }, ], testimonials: [ { name: "Maria S.", rating: 5, text: "Christy transformed my old tattoo into something absolutely stunning! Her cover-up work is incredible and exceeded all my expectations.", }, { name: "David L.", rating: 5, text: "22 years of experience really shows. Christy is a true artist and professional. The Ink Mama knows her craft!", }, { name: "Sarah K.", rating: 5, text: "As the CEO of United Tattoo, Christy has created an amazing environment. Her illustrative work is phenomenal!", }, ], }, // Add other artists data here... } interface ArtistPortfolioProps { artistId: string } export function ArtistPortfolio({ artistId }: ArtistPortfolioProps) { const [selectedCategory, setSelectedCategory] = useState("All") const [selectedImage, setSelectedImage] = useState(null) const [scrollY, setScrollY] = useState(0) const artist = artistsData[artistId as keyof typeof artistsData] // keep a reference to the last focused thumbnail so we can return focus on modal close const lastFocusedRef = useRef(null) const closeButtonRef = useRef(null) useEffect(() => { const handleScroll = () => setScrollY(window.scrollY) window.addEventListener("scroll", handleScroll) return () => window.removeEventListener("scroll", handleScroll) }, []) // Derived lists (safe when `artist` is undefined during initial renders) const categories = ["All", ...Array.from(new Set((artist?.portfolio ?? []).map((item) => item.category)))] const filteredPortfolio = selectedCategory === "All" ? (artist?.portfolio ?? []) : (artist?.portfolio ?? []).filter((item) => item.category === selectedCategory) // keyboard navigation for modal (kept as hooks so they run in same order every render) const goToIndex = useCallback( (index: number) => { const item = filteredPortfolio[index] if (item) setSelectedImage(item.id) }, [filteredPortfolio], ) useEffect(() => { if (!selectedImage) return const handleKey = (e: KeyboardEvent) => { if (e.key === "Escape") { setSelectedImage(null) } else if (e.key === "ArrowRight") { const currentIndex = filteredPortfolio.findIndex((p) => p.id === selectedImage) const nextIndex = (currentIndex + 1) % filteredPortfolio.length goToIndex(nextIndex) } else if (e.key === "ArrowLeft") { const currentIndex = filteredPortfolio.findIndex((p) => p.id === selectedImage) const prevIndex = (currentIndex - 1 + filteredPortfolio.length) % filteredPortfolio.length goToIndex(prevIndex) } } document.addEventListener("keydown", handleKey) // move focus to close button for keyboard users setTimeout(() => closeButtonRef.current?.focus(), 0) return () => { document.removeEventListener("keydown", handleKey) } }, [selectedImage, filteredPortfolio, goToIndex]) const openImageFromElement = (id: number, el: HTMLElement | null) => { if (el) lastFocusedRef.current = el setSelectedImage(id) } const closeModal = () => { setSelectedImage(null) // return focus to last focused thumbnail setTimeout(() => lastFocusedRef.current?.focus(), 0) } const currentIndex = selectedImage ? filteredPortfolio.findIndex((p) => p.id === selectedImage) : -1 const currentItem = selectedImage ? filteredPortfolio.find((p) => p.id === selectedImage) : null if (!artist) { return (

Artist not found

) } return (
{/* Back Button */}
{/* Hero Section with Split Screen */}
{/* Left Side - Artist Image */}
{artist.name}
{artist.availability}
{/* Right Side - Artist Info */}

{artist.name}

{artist.specialty}

{artist.rating} ({artist.reviews} reviews)

{artist.bio}

{artist.experience} experience
{artist.location}
{artist.instagram}

Specializes in:

{artist.styles.map((style) => ( {style} ))}
{/* Curved Border */}
{/* Portfolio Section with Split Screen Layout */}
{/* Left Side - Portfolio Grid */}
{filteredPortfolio.map((item) => (
{ // store the element that opened the modal openImageFromElement(item.id, (e.currentTarget as HTMLElement) || null) }} onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault() openImageFromElement(item.id, e.currentTarget as HTMLElement) } }} >
{item.title}

{item.title}

))}
{/* Right Side - Sticky Header and Info */}

Featured Work

{filteredPortfolio.length}

Explore the portfolio of {artist.name} showcasing {artist.experience} of expertise in{" "} {artist.specialty.toLowerCase()}. Each piece represents a unique collaboration between artist and client.

{/* Category Filter */}

Filter by Style

{categories.map((category) => ( ))}
{/* Quick Stats */}
{(artist.portfolio ?? []).length}
Pieces
{artist.rating}
Rating
{/* Reviews Section */}

What Clients Say

{/* Duplicate testimonials for seamless loop */} {[...artist.testimonials, ...artist.testimonials, ...artist.testimonials, ...artist.testimonials].map( (testimonial, idx) => (
{/* Enhanced spotlight background with stronger separation */}
{[...Array(testimonial.rating)].map((_, i) => ( ))}
{testimonial.text}
— {testimonial.name}
), )}
{/* Contact Section */}

Ready to Get Started?

Book a consultation with {artist.name} to discuss your next tattoo. If you'd like, we can help plan the design and schedule the session.

{artist.experience}
Experience
{artist.reviews}+
Happy Clients
{artist.rating}/5
Average Rating
{/* Image Modal / Lightbox */} {selectedImage && currentItem && (
closeModal()} >
e.stopPropagation()} > {/* Prev */}
{currentItem.title}
{/* Next */}
)}
) }