"use client" import { useState, useMemo } from "react" import { Button } from "@/components/ui/button" import { Card, CardContent } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import Link from "next/link" import { Star, Loader2 } from "lucide-react" import { useArtists } from "@/hooks/use-artist-data" const specialties = ["All", "Traditional", "Realism", "Fine Line", "Japanese", "Portraits", "Minimalist", "Black & Grey"] export function ArtistsGrid() { const [selectedSpecialty, setSelectedSpecialty] = useState("All") // Fetch artists from API const { data: artists, isLoading, error } = useArtists({ limit: 50 }) // Filter artists client-side const filteredArtists = useMemo(() => { if (!artists) return [] if (selectedSpecialty === "All") { return artists } return artists.filter((artist) => artist.specialties.some((style) => style.toLowerCase().includes(selectedSpecialty.toLowerCase()) ) ) }, [artists, selectedSpecialty]) return (

Our Artists

Meet our talented team of tattoo artists, each bringing their unique style and years of experience to create your perfect tattoo.

{/* Filter Buttons */}
{specialties.map((specialty) => ( ))}
{/* Loading State */} {isLoading && (
)} {/* Error State */} {error && (

Failed to load artists. Please try again later.

)} {/* Artists Grid */} {!isLoading && !error && (
{filteredArtists.length === 0 ? (

No artists found matching your criteria.

) : ( filteredArtists.map((artist) => { // Get profile image (first portfolio image or placeholder) const profileImage = artist.portfolioImages.find(img => img.tags.includes('profile'))?.url || artist.portfolioImages[0]?.url || "/placeholder.svg" return (
{/* Artist Image */}
{artist.name}
{artist.isActive ? "Available" : "Unavailable"}
{/* Artist Info */}

{artist.name}

{artist.specialties.slice(0, 2).join(", ")}

{artist.bio}

{/* Hourly Rate */} {artist.hourlyRate && (

Starting at ${artist.hourlyRate}/hr

)} {/* Styles */}

Specializes in:

{artist.specialties.slice(0, 3).map((style) => ( {style} ))} {artist.specialties.length > 3 && ( +{artist.specialties.length - 3} more )}
{/* Action Buttons */}
) }) )}
)}
) }