diff --git a/public/tutorial/adding-mii/step2.png b/public/tutorial/adding-mii/step2.png new file mode 100644 index 0000000..60a1eb9 Binary files /dev/null and b/public/tutorial/adding-mii/step2.png differ diff --git a/public/tutorial/adding-mii/step3.png b/public/tutorial/adding-mii/step3.png new file mode 100644 index 0000000..df0840c Binary files /dev/null and b/public/tutorial/adding-mii/step3.png differ diff --git a/public/tutorial/adding-mii/step4.gif b/public/tutorial/adding-mii/step4.gif new file mode 100644 index 0000000..23088a6 Binary files /dev/null and b/public/tutorial/adding-mii/step4.gif differ diff --git a/public/tutorial/adding-mii/step5.gif b/public/tutorial/adding-mii/step5.gif new file mode 100644 index 0000000..ec1975d Binary files /dev/null and b/public/tutorial/adding-mii/step5.gif differ diff --git a/public/tutorial/adding-mii/step6.png b/public/tutorial/adding-mii/step6.png new file mode 100644 index 0000000..9269d13 Binary files /dev/null and b/public/tutorial/adding-mii/step6.png differ diff --git a/src/app/mii/[slug]/page.tsx b/src/app/mii/[slug]/page.tsx index d74674a..33c700d 100644 --- a/src/app/mii/[slug]/page.tsx +++ b/src/app/mii/[slug]/page.tsx @@ -11,6 +11,7 @@ import Carousel from "@/components/carousel"; import LikeButton from "@/components/like-button"; import ImageViewer from "@/components/image-viewer"; import DeleteMiiButton from "@/components/delete-mii"; +import ScanTutorialButton from "@/components/tutorial/scan"; interface Props { params: Promise<{ slug: string }>; @@ -161,16 +162,21 @@ export default async function MiiPage({ params }: Props) { From: {mii.islandName} Island
  • - Copying: + Allowed Copying:
  • -
    - - - - + {Number(session?.user.id) === mii.userId && ( + <> + + + + + + )} + +
    diff --git a/src/components/delete-mii.tsx b/src/components/delete-mii.tsx index 8cfac72..07ce3c2 100644 --- a/src/components/delete-mii.tsx +++ b/src/components/delete-mii.tsx @@ -49,7 +49,7 @@ export default function DeleteMiiButton({ miiId, miiName, likes }: Props) { return ( <> - diff --git a/src/components/tutorial/scan.tsx b/src/components/tutorial/scan.tsx new file mode 100644 index 0000000..debf9f4 --- /dev/null +++ b/src/components/tutorial/scan.tsx @@ -0,0 +1,101 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { createPortal } from "react-dom"; +import useEmblaCarousel from "embla-carousel-react"; +import { Icon } from "@iconify/react"; + +import TutorialPage from "./page"; + +export default function ScanTutorialButton() { + const [isOpen, setIsOpen] = useState(false); + const [isVisible, setIsVisible] = useState(false); + + const [emblaRef, emblaApi] = useEmblaCarousel({ loop: true }); + const [selectedIndex, setSelectedIndex] = useState(0); + + const close = () => { + setIsVisible(false); + setTimeout(() => { + setIsOpen(false); + setSelectedIndex(0); + }, 300); + }; + + useEffect(() => { + if (isOpen) { + // slight delay to trigger animation + setTimeout(() => setIsVisible(true), 10); + } + }, [isOpen]); + + useEffect(() => { + if (!emblaApi) return; + emblaApi.on("select", () => setSelectedIndex(emblaApi.selectedScrollSnap())); + }, [emblaApi]); + + return ( + <> + {/* todo: maybe make it an icon? */} + + + {isOpen && + createPortal( +
    +
    + +
    +
    +

    Tutorial

    + +
    + +
    +
    +
    + + + + + + + +
    +
    + +
    + + + Adding Mii to Island + + +
    +
    +
    +
    , + document.body + )} + + ); +}