"use client"; import { useEffect, useRef, Suspense } from "react"; import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; export default function HomeClient() { return ( ); } function HomeInner() { const searchParams = useSearchParams(); const router = useRouter(); useEffect(() => { // sync with hf.co/spaces URL params if (searchParams.get("path")) { router.push(searchParams.get("path")!); return; } // legacy sync with hf.co/spaces URL params let redirectUrl: string | null = null; if (searchParams.get("dataset") && searchParams.get("episode")) { redirectUrl = `/${searchParams.get("dataset")}/episode_${searchParams.get( "episode", )}`; } else if (searchParams.get("dataset")) { redirectUrl = `/${searchParams.get("dataset")}`; } if (redirectUrl && searchParams.get("t")) { redirectUrl += `?t=${searchParams.get("t")}`; } if (redirectUrl) { router.push(redirectUrl); } }, [searchParams, router]); const playerRef = useRef(null); useEffect(() => { // Load YouTube IFrame API if not already present if (!(window as any).YT) { const tag = document.createElement("script"); tag.src = "https://www.youtube.com/iframe_api"; document.body.appendChild(tag); } let interval: NodeJS.Timeout; (window as any).onYouTubeIframeAPIReady = () => { playerRef.current = new (window as any).YT.Player("yt-bg-player", { videoId: "Er8SPJsIYr0", playerVars: { autoplay: 1, mute: 1, controls: 0, showinfo: 0, modestbranding: 1, rel: 0, loop: 1, fs: 0, playlist: "Er8SPJsIYr0", start: 0, }, events: { onReady: (event: any) => { event.target.playVideo(); event.target.mute(); interval = setInterval(() => { const t = event.target.getCurrentTime(); if (t >= 60) { event.target.seekTo(0); } }, 500); }, }, }); }; return () => { if (interval) clearInterval(interval); if (playerRef.current && playerRef.current.destroy) playerRef.current.destroy(); }; }, []); const inputRef = useRef(null); const handleGo = (e: React.FormEvent) => { e.preventDefault(); const value = inputRef.current?.value.trim(); if (value) { router.push(value); } }; return ( {/* YouTube Video Background */} {/* Overlay */} {/* Centered Content */} LeRobot Dataset Visualizer create & train your own robots { if (e.key === "Enter") { // Prevent double submission if form onSubmit also fires e.preventDefault(); handleGo(e as any); } }} /> Go {/* Example Datasets */} Example Datasets: {[ "lerobot/aloha_static_cups_open", "lerobot/columbia_cairlab_pusht_real", "lerobot/taco_play", ].map((ds) => ( { if (inputRef.current) { inputRef.current.value = ds; inputRef.current.focus(); } router.push(ds); }} > {ds} ))} Explore Open Datasets ); }