From 70f4950363edc4d43d11b5efc3d6ff39934508e1 Mon Sep 17 00:00:00 2001 From: trafficlunar Date: Sat, 5 Apr 2025 21:39:08 +0100 Subject: [PATCH] feat: add mii images to carousel and add mii info to mii page --- src/app/components/mii-list.tsx | 2 +- src/app/mii/[slug]/page.tsx | 94 +++++++++++++++++++++++---------- 2 files changed, 68 insertions(+), 28 deletions(-) diff --git a/src/app/components/mii-list.tsx b/src/app/components/mii-list.tsx index 7e6f42e..6a4afe5 100644 --- a/src/app/components/mii-list.tsx +++ b/src/app/components/mii-list.tsx @@ -132,7 +132,7 @@ export default async function MiiList({ searchParams, userId, where }: Props) { key={mii.id} className="flex flex-col bg-zinc-50 rounded-3xl border-2 border-zinc-300 shadow-lg p-3 transition hover:scale-105 hover:bg-cyan-100 hover:border-cyan-600" > - 0 ? mii.images : ["/missing.webp"]} /> +
diff --git a/src/app/mii/[slug]/page.tsx b/src/app/mii/[slug]/page.tsx index e9790a7..4383b3f 100644 --- a/src/app/mii/[slug]/page.tsx +++ b/src/app/mii/[slug]/page.tsx @@ -1,3 +1,4 @@ +import Image from "next/image"; import Link from "next/link"; import { redirect } from "next/navigation"; @@ -42,38 +43,77 @@ export default async function MiiPage({ params }: Props) { if (!mii) redirect("/404"); + const images = [`/mii/${mii.id}/mii.webp`, `/mii/${mii.id}/qr-code.webp`, ...mii.images]; + return ( -
- 0 ? mii?.images : ["/missing.webp"]} className="shadow-lg" /> +
+
+
+ +
-
-

{mii?.name}

-
- {mii?.tags.map((tag) => ( - - {tag} +
+

{mii?.name}

+
+ {mii?.tags.map((tag) => ( + + {tag} + + ))} +
+ +
+ + By: @{mii?.user.username} +

+ Created: {mii?.createdAt.toLocaleDateString("en-GB", { month: "long", day: "2-digit", year: "numeric" })} +

+
+ +
+ 0} + isLoggedIn={session?.user != null} + big + /> +
+
+ +
+ Mii Info +
    +
  • + Name:{" "} + + {mii.firstName} {mii.lastName} + +
  • +
  • + From: {mii.islandName} Island +
  • +
  • + Copying: +
  • +
+
+
+ +
+
+ {images.map((src, index) => ( + mii screenshots ))}
- -
- - By: @{mii?.user.username} - -

- Created: {mii?.createdAt.toLocaleDateString("en-GB", { month: "long", day: "2-digit", year: "numeric" })} -

-
- -
- 0} - isLoggedIn={session?.user != null} - big - /> -
);