import Image from "next/image"; import Link from "next/link"; import { redirect } from "next/navigation"; import { auth } from "@/lib/auth"; import { prisma } from "@/lib/prisma"; import Carousel from "@/app/components/carousel"; import LikeButton from "@/app/components/like-button"; interface Props { params: Promise<{ slug: string }>; } export default async function MiiPage({ params }: Props) { const { slug } = await params; const session = await auth(); const mii = await prisma.mii.findFirst({ where: { id: Number(slug), }, include: { user: { select: { id: true, username: true, }, }, likedBy: session?.user ? { where: { userId: Number(session.user.id), }, select: { userId: true }, } : false, _count: { select: { likedBy: true }, // Get total like count }, }, }); if (!mii) redirect("/404"); const images = [ `/mii/${mii.id}/mii.webp`, `/mii/${mii.id}/qr-code.webp`, ...Array.from({ length: mii.imageCount }, (_, index) => `/mii/${mii.id}/image${index}.webp`), ]; return (