import Link from "next/link" import { BookOpen, Sparkles, Flame, Heart, Swords, Building2, Rocket, Crown, Laugh, Search, Shield } from "lucide-react" import { readerApiFetch } from "@/lib/server-api" const iconMap: Record = { Sparkles: , Flame: , Heart: , Sword: , Building: , Rocket: , Crown: , Laugh: , Search: , Shield: , } export const revalidate = 300 // cache 5 phút, genres ít thay đổi type GenreItem = { id: string name: string slug: string description: string | null icon: string | null novelCount: number } export default async function GenresPage() { let genres: GenreItem[] = [] try { genres = await readerApiFetch("/api/genres") } catch (error) { console.error("Failed to fetch genres during build/runtime", error) } return (

Thể Loại Truyện

{genres.map((genre) => { const novelCount = genre.novelCount return ( {genre.icon && iconMap[genre.icon] ? iconMap[genre.icon] : }

{genre.name}

{genre.description}

{novelCount} truyện

) })}
) }