"use client"; import { useState } from "react"; import Link from "next/link"; type MangaItem = { slug: string; title: string; coverUrl: string; genre: string; _count?: { chapters: number }; }; export function GenreTabs({ manga, genres, }: { manga: MangaItem[]; genres: string[]; }) { const [activeGenre, setActiveGenre] = useState("All"); const allGenres = ["All", ...genres]; const filtered = activeGenre === "All" ? manga : manga.filter((m) => m.genre === activeGenre); return (
{/* Section header */}

Browse by Genre

{/* Horizontal scrollable genre tabs */}
{allGenres.map((genre) => ( ))}
{/* Filtered manga grid */} {filtered.length > 0 ? (
{filtered.map((m) => ( {m._count && m._count.chapters > 0 && ( {m._count.chapters} )}
{m.title}

{m.title}

{m.genre}

))}
) : (

No manga in this genre yet

)}
); }