import React from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { NumberInput } from "@/components/ui/number-input"; import { Label } from "@/components/ui/label"; import { Checkbox } from "@/components/ui/checkbox"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, } from "@/components/ui/dialog"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { AlertTriangle, CheckCircle, ChevronDown } from "lucide-react"; import CameraConfiguration, { CameraConfig, } from "@/components/recording/CameraConfiguration"; import { useHfAuth } from "@/contexts/HfAuthContext"; import { RobotRecord } from "@/hooks/useRobots"; interface RecordingModalProps { open: boolean; onOpenChange: (open: boolean) => void; robot: RobotRecord | null; datasetName: string; setDatasetName: (value: string) => void; singleTask: string; setSingleTask: (value: string) => void; numEpisodes: number; setNumEpisodes: (value: number) => void; episodeTimeS: number; setEpisodeTimeS: (value: number) => void; resetTimeS: number; setResetTimeS: (value: number) => void; streamingEncoding: boolean; setStreamingEncoding: (value: boolean) => void; cameras: CameraConfig[]; setCameras: (cameras: CameraConfig[]) => void; onStart: () => void; releaseStreamsRef?: React.MutableRefObject<(() => void) | null>; } const RecordingModal: React.FC = ({ open, onOpenChange, robot, datasetName, setDatasetName, singleTask, setSingleTask, numEpisodes, setNumEpisodes, episodeTimeS, setEpisodeTimeS, resetTimeS, setResetTimeS, streamingEncoding, setStreamingEncoding, cameras, setCameras, onStart, releaseStreamsRef, }) => { const { auth } = useHfAuth(); const canStart = !!robot && robot.is_clean; return (
REC
Configure Recording
Pick a configured robot and dataset parameters for recording.

Robot Configuration

{!robot ? ( Select and configure a robot on the Landing page before recording. ) : !robot.is_clean ? ( {robot.name} is missing a calibration. Configure it before recording. ) : (
Recording with {robot.name}
)}

Dataset Configuration

setDatasetName( e.target.value.replace(/[^A-Za-z0-9._-]/g, "_") ) } placeholder="my_dataset" className="bg-gray-800 border-gray-700 text-white" />

Letters, numbers, . _{" "} - only — other characters become{" "} _.

{datasetName && (auth.status === "authenticated" ? (

Will be saved as{" "} {auth.username}/{datasetName}

) : auth.status === "unauthenticated" ? (

Log in to Hugging Face to set the repository owner.

) : null)}
setSingleTask(e.target.value)} placeholder="e.g., pick up the red block and place it on the blue square" className="bg-gray-800 border-gray-700 text-white" />
{ if (v !== undefined) setNumEpisodes(v); }} className="bg-gray-800 border-gray-700 text-white" />
{ if (v !== undefined) setEpisodeTimeS(v); }} className="bg-gray-800 border-gray-700 text-white" />
{ if (v !== undefined) setResetTimeS(v); }} className="bg-gray-800 border-gray-700 text-white" />
Advanced Parameters
setStreamingEncoding(value === true) } className="mt-0.5 border-gray-500 data-[state=checked]:bg-red-500 data-[state=checked]:border-red-500" />

Encodes frames in real time during capture so each episode saves almost instantly. Uncheck to fall back to the slower PNG-then-encode flow.

); }; export default RecordingModal;