"use client"; import Link from "next/link"; import Image from "next/image"; import { Music } from "lucide-react"; import { api } from "@/lib/api"; import { HorizontalCarousel, CarouselItem } from "@/components/ui/HorizontalCarousel"; import { memo } from "react"; interface PopularArtist { id?: string; name: string; image?: string; listeners?: number; } interface PopularArtistsGridProps { artists: PopularArtist[]; } // Always proxy images through the backend for caching and mobile compatibility const getProxiedImageUrl = (imageUrl: string | undefined): string | null => { if (!imageUrl) return null; return api.getCoverArtUrl(imageUrl, 300); }; interface PopularArtistCardProps { artist: PopularArtist; index: number; } const PopularArtistCard = memo(function PopularArtistCard({ artist, index }: PopularArtistCardProps) { const imageUrl = getProxiedImageUrl(artist.image); return (
{imageUrl ? ( {artist.name} ) : ( )}

{artist.name}

{artist.listeners?.toLocaleString()} listeners

); }); export function PopularArtistsGrid({ artists }: PopularArtistsGridProps) { return ( {artists.map((artist, index) => ( ))} ); }