"use client"; import React, { useEffect, useRef } from "react"; import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; import { postParentMessageWithParams } from "@/utils/postParentMessage"; type ExploreGridProps = { datasets: Array<{ id: string; videoUrl: string | null }>; currentPage: number; totalPages: number; }; export default function ExploreGrid({ datasets, currentPage, totalPages, }: ExploreGridProps) { // sync with parent window hf.co/spaces useEffect(() => { postParentMessageWithParams((params: URLSearchParams) => { params.set("path", window.location.pathname + window.location.search); }); }, []); // Create an array of refs for each video const videoRefs = useRef<(HTMLVideoElement | null)[]>([]); return (

Explore LeRobot Datasets

{datasets.map((ds, idx) => ( { const vid = videoRefs.current[idx]; if (vid) vid.play(); }} onMouseLeave={() => { const vid = videoRefs.current[idx]; if (vid) { vid.pause(); vid.currentTime = 0; } }} >
); }