fix: admin page issues

This commit is contained in:
trafficlunar 2026-04-18 01:09:53 +01:00
parent ce1c7a667a
commit e81f054e3a

View file

@ -9,6 +9,7 @@ import { Icon } from "@iconify/react";
import LikeButton from "../../like-button";
import { useStore } from "@nanostores/react";
import { session } from "../../../session";
import Carousel from "../../carousel";
interface ApiResponse {
totalCount: number;
@ -79,7 +80,7 @@ export default function MiiList({ parentPage, userId }: Props) {
</div>
)}
<Link to={`/mii/${mii.id}`} className="overflow-hidden rounded-xl bg-zinc-300 shrink-0">
{parentPage !== "admin" ? <Link to={`/mii/${mii.id}`} className="overflow-hidden rounded-xl bg-zinc-300 shrink-0">
<img
src={`${import.meta.env.VITE_API_URL}/mii/${mii.id}/image?type=mii`}
width={240}
@ -87,7 +88,13 @@ export default function MiiList({ parentPage, userId }: Props) {
alt="mii image"
className="w-full h-auto aspect-3/2 object-contain"
/>
</Link>
</Link> : <Carousel
images={[
`${import.meta.env.VITE_API_URL}/mii/${mii.id}/image?type=mii`,
...(mii.platform === "THREE_DS" ? [`${import.meta.env.VITE_API_URL}/mii/${mii.id}/image?type=qr-code`] : [`${import.meta.env.VITE_API_URL}/mii/${mii.id}/image?type=features`]),
...Array.from({ length: mii.imageCount }, (_, index) => `${import.meta.env.VITE_API_URL}/mii/${mii.id}/image?type=image${index}`),
]}
/>}
<div className="p-4 flex flex-col gap-1 h-full">
<div className="flex justify-between">
@ -134,7 +141,7 @@ export default function MiiList({ parentPage, userId }: Props) {
<div className="flex gap-1 text-3xl justify-center">
<button
onClick={async () => {
await fetch(`/api/admin/accept-mii?id=${mii.id}`, { method: "PATCH" });
await fetch(`${import.meta.env.VITE_API_URL}/api/admin/accept-mii?id=${mii.id}`, { method: "PATCH", credentials: "include" });
}}
className="cursor-pointer text-zinc-400 hover:text-green-500 transition-colors p-1 bg-white rounded-md shadow-sm border border-zinc-200 hover:border-green-500"
title="Accept Mii"