import { SwitchMiiInstructions } from "@/types"; import React, { useState } from "react"; import { Icon } from "@iconify/react"; import HeadTab from "./tabs/head"; import HairTab from "./tabs/hair"; import EyebrowsTab from "./tabs/eyebrows"; import EyesTab from "./tabs/eyes"; import NoseTab from "./tabs/nose"; import LipsTab from "./tabs/lips"; import EarsTab from "./tabs/ears"; import GlassesTab from "./tabs/glasses"; import OtherTab from "./tabs/other"; import MiscTab from "./tabs/misc"; interface Props { instructions: React.RefObject; } type Tab = "head" | "hair" | "eyebrows" | "eyes" | "nose" | "lips" | "ears" | "glasses" | "other" | "misc"; export const TAB_ICONS: Record = { head: "mingcute:head-fill", hair: "mingcute:hair-fill", eyebrows: "material-symbols:eyebrow", eyes: "mdi:eye", nose: "mingcute:nose-fill", lips: "material-symbols-light:lips", ears: "ion:ear", glasses: "solar:glasses-bold", other: "mdi:sparkles", misc: "material-symbols:settings", }; export const TAB_COMPONENTS: Record> = { head: HeadTab, hair: HairTab, eyebrows: EyebrowsTab, eyes: EyesTab, nose: NoseTab, lips: LipsTab, ears: EarsTab, glasses: GlassesTab, other: OtherTab, misc: MiscTab, }; export default function MiiEditor({ instructions }: Props) { const [tab, setTab] = useState("head"); return ( <>
{(Object.keys(TAB_COMPONENTS) as Tab[]).map((t) => ( ))}
{/* Keep all tabs loaded to avoid flickering */} {(Object.keys(TAB_COMPONENTS) as Tab[]).map((t) => { const TabComponent = TAB_COMPONENTS[t]; return (
); })}
); }