"use client"; import { useState } from "react"; import { AnimatePresence, motion } from "framer-motion"; import { useTrack } from "@/hooks/use-track"; import { TRACKING_EVENTS } from "@/lib/tracking-events"; export function ScreenshotGallery({ slug, shots }: { slug: string; shots: string[] }) { const [active, setActive] = useState(null); const { track } = useTrack(); const open = (idx: number) => { setActive(idx); track(TRACKING_EVENTS.galleryOpen, { slug, index: idx }); }; const move = (delta: number) => { setActive((prev) => { if (prev === null) return 0; const next = (prev + delta + shots.length) % shots.length; track(TRACKING_EVENTS.galleryNavigate, { slug, from: prev, to: next }); return next; }); }; return ( <>
{shots.map((_, idx) => ( ))}
{active !== null && ( setActive(null)} > e.stopPropagation()} >

截图大图 {active + 1}

{active + 1} / {shots.length}

)}
); }