"use client"; import { Music2 } from "lucide-react"; import { useRouter } from "next/navigation"; import { HorizontalCarousel, CarouselItem } from "@/components/ui/HorizontalCarousel"; import { memo } from "react"; interface PlaylistPreview { id: string; source: string; type: string; title: string; description: string | null; creator: string; imageUrl: string | null; trackCount: number; url: string; } interface FeaturedPlaylistsGridProps { playlists: PlaylistPreview[]; } // Deezer icon const DeezerIcon = ({ className }: { className?: string }) => ( ); interface PlaylistCardProps { playlist: PlaylistPreview; onClick: () => void; } const PlaylistCard = memo(function PlaylistCard({ playlist, onClick }: PlaylistCardProps) { return (
{playlist.imageUrl ? ( {playlist.title} ) : (
)} {/* Play button on hover */}
{/* Deezer badge */}

{playlist.title}

{playlist.trackCount} songs

); }); export function FeaturedPlaylistsGrid({ playlists }: FeaturedPlaylistsGridProps) { const router = useRouter(); const handlePlaylistClick = (playlist: PlaylistPreview) => { router.push(`/browse/playlists/${playlist.id}`); }; if (!playlists || playlists.length === 0) { return null; } return ( {playlists.slice(0, 20).map((playlist, index) => ( handlePlaylistClick(playlist)} /> ))} ); }