33 lines
1000 B
TypeScript
33 lines
1000 B
TypeScript
import { prisma } from "@/lib/db";
|
|
import { signCoverUrls } from "@/lib/r2";
|
|
import { collectGenres } from "@/lib/genres";
|
|
import { TrendingCarousel } from "@/components/TrendingCarousel";
|
|
import { GenreTabs } from "@/components/GenreTabs";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function Home() {
|
|
const manga = await prisma.manga.findMany({
|
|
where: { status: "PUBLISHED" },
|
|
orderBy: { updatedAt: "desc" },
|
|
include: { _count: { select: { chapters: true } } },
|
|
});
|
|
|
|
const signedManga = await signCoverUrls(manga);
|
|
|
|
// Top 10 for trending
|
|
const trending = signedManga.slice(0, 10);
|
|
|
|
const genres = collectGenres(signedManga);
|
|
|
|
return (
|
|
<div className="max-w-6xl mx-auto px-4 py-5 space-y-8">
|
|
{/* Trending section — Webtoon-style ranked carousel */}
|
|
<TrendingCarousel manga={trending} />
|
|
|
|
{/* Genre browsing section — horizontal tabs + filtered grid */}
|
|
<GenreTabs manga={signedManga} genres={genres} />
|
|
</div>
|
|
);
|
|
}
|