import type { SwitchMiiInstructions } from "@tomodachi-share/shared"; import ImageViewer from "../components/image-viewer"; import LikeButton from "../components/like-button"; import Description from "../components/description"; import ShareMiiButton from "../components/mii/share-mii-button"; import ThreeDsScanTutorialButton from "../components/tutorial/3ds-scan"; import SwitchAddMiiTutorialButton from "../components/tutorial/switch-add-mii"; import MiiInstructions from "../components/mii/instructions"; import { Icon } from "@iconify/react"; import { useEffect, useState } from "react"; import { Link, useNavigate, useParams } from "react-router"; import AuthorButtons from "../components/mii/author-buttons"; import { useStore } from "@nanostores/react"; import { session } from "../session"; export default function MiiPage() { const { id } = useParams(); const navigate = useNavigate(); const $session = useStore(session); const [mii, setMii] = useState(null); const [loading, setLoading] = useState(true); const [isLiked, setIsLiked] = useState(false); const API_URL = import.meta.env.VITE_API_URL; useEffect(() => { fetch(`${API_URL}/api/mii/${id}/info`) .then((res) => { if (!res.ok) throw new Error("Failed to fetch Miis"); return res.json(); }) .then((data) => { setMii(data); setLoading(false); if ($session === null || $session === undefined) return; fetch(`${API_URL}/api/mii/has-liked?ids=${data.id}`, { credentials: "include" }) .then((res) => (res.ok ? res.json() : [])) .then((likedIds: number[]) => setIsLiked(likedIds.length > 0)) .catch((err) => { console.error("Error liking:", err); }); }) .catch((err) => { console.error(err); setLoading(false); navigate("/404"); }); }, [id]); if (loading || !mii) return
Loading...
; const images = [...Array.from({ length: mii.imageCount ?? 0 }, (_, index) => `${API_URL}/mii/${mii.id}/image?type=image${index}`)]; return (
{mii.quarantined && (

This Mii is flagged as controversial and only appears when the filter is enabled

)} {mii.in_queue && (

This Mii is waiting to be manually reviewed and is hidden from the main page. The review could take between a few hours and a few days.
Despite that, you can still share the Mii through the URL!

)}
{/* Mii Image */}
{/* QR Code */} {mii.platform === "THREE_DS" ? (
) : ( )}
{/* Mii Info */} {mii.platform === "THREE_DS" && (
  • Name:{" "} {mii.firstName} {mii.lastName}
  • From: {mii.islandName} Island
  • Allowed Copying:
)} {/* Mii Platform */}

Platform
{mii.platform === "THREE_DS" ? "3DS" : "Switch"}
{/* Mii Gender */}

Gender
{mii.gender === "MALE" ? "Male" : mii.gender === "FEMALE" ? "Female" : "Nonbinary"}
{mii.platform !== "THREE_DS" && (
)}
{/* Makeup */} {mii.platform === "SWITCH" && ( <>

Makeup
{/* Tooltip */}
{mii.makeup === "FULL" ? "Full Makeup" : mii.makeup === "PARTIAL" ? "Partial Makeup" : "No Makeup"}
{/* Full Makeup */}
{/* Partial Makeup */}
{/* No Makeup */}
)}
{/* Information */}
{/* Submission name */}

{mii.name}

{/* Like button */}
{/* Tags */}
{mii.tags.map((tag: string) => ( {tag} ))}
{/* Author and Created date */}
By {mii.user.name}

Created:{" "} {new Date(mii.createdAt).toLocaleString("en-GB", { day: "2-digit", month: "long", year: "numeric", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZone: "UTC", })}{" "} UTC

{/* Description */} {mii.description && }
{/* Buttons */}
Report {mii.platform === "THREE_DS" ? : }
{/* Instructions */} {mii.platform === "SWITCH" && (

Instructions

{mii.youtubeId && (