Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Sync from huggingface/lerobot-dataset-visualizer via hub-sync
Browse files
src/components/urdf-playback-bar.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
"use client";
|
| 2 |
|
| 3 |
import React from "react";
|
|
|
|
| 4 |
|
| 5 |
interface UrdfPlaybackBarProps {
|
| 6 |
frame: number;
|
|
@@ -37,18 +38,10 @@ export default function UrdfPlaybackBar({
|
|
| 37 |
<button
|
| 38 |
onClick={onPlayPause}
|
| 39 |
disabled={disabled}
|
| 40 |
-
|
|
|
|
| 41 |
>
|
| 42 |
-
{playing ?
|
| 43 |
-
<svg width="12" height="14" viewBox="0 0 12 14">
|
| 44 |
-
<rect x="1" y="1" width="3" height="12" fill="white" />
|
| 45 |
-
<rect x="8" y="1" width="3" height="12" fill="white" />
|
| 46 |
-
</svg>
|
| 47 |
-
) : (
|
| 48 |
-
<svg width="12" height="14" viewBox="0 0 12 14">
|
| 49 |
-
<polygon points="2,1 11,7 2,13" fill="white" />
|
| 50 |
-
</svg>
|
| 51 |
-
)}
|
| 52 |
</button>
|
| 53 |
|
| 54 |
{/* Trail toggle */}
|
|
@@ -73,25 +66,30 @@ export default function UrdfPlaybackBar({
|
|
| 73 |
value={frame}
|
| 74 |
onChange={onFrameChange}
|
| 75 |
disabled={disabled}
|
| 76 |
-
className="flex-1 h-1
|
|
|
|
| 77 |
/>
|
| 78 |
-
<span
|
|
|
|
|
|
|
|
|
|
| 79 |
{currentTime}s / {totalTime}s
|
| 80 |
</span>
|
| 81 |
-
<span className="text-xs text-slate-500 tabular-nums w-20 text-right shrink-0">
|
| 82 |
-
F {frame}/{Math.max(totalFrames - 1, 0)}
|
| 83 |
-
</span>
|
| 84 |
|
| 85 |
-
{/*
|
| 86 |
-
<div className="
|
| 87 |
-
<p>
|
| 88 |
-
<
|
| 89 |
Space
|
| 90 |
-
</
|
| 91 |
-
pause/unpause
|
| 92 |
</p>
|
| 93 |
-
<p>
|
| 94 |
-
<span className="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
</p>
|
| 96 |
</div>
|
| 97 |
</div>
|
|
|
|
| 1 |
"use client";
|
| 2 |
|
| 3 |
import React from "react";
|
| 4 |
+
import { FaPlay, FaPause, FaArrowDown, FaArrowUp } from "react-icons/fa";
|
| 5 |
|
| 6 |
interface UrdfPlaybackBarProps {
|
| 7 |
frame: number;
|
|
|
|
| 38 |
<button
|
| 39 |
onClick={onPlayPause}
|
| 40 |
disabled={disabled}
|
| 41 |
+
title={playing ? "Pause. Toggle with Space" : "Play. Toggle with Space"}
|
| 42 |
+
className="h-9 w-9 flex items-center justify-center rounded-md bg-cyan-400/10 border border-cyan-400/30 text-cyan-300 hover:bg-cyan-400/15 disabled:bg-white/5 disabled:border-white/5 disabled:text-slate-500 disabled:cursor-not-allowed transition-colors shrink-0"
|
| 43 |
>
|
| 44 |
+
{playing ? <FaPause size={14} /> : <FaPlay size={14} />}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
</button>
|
| 46 |
|
| 47 |
{/* Trail toggle */}
|
|
|
|
| 66 |
value={frame}
|
| 67 |
onChange={onFrameChange}
|
| 68 |
disabled={disabled}
|
| 69 |
+
className="flex-1 min-w-16 mx-1 h-1 accent-cyan-400 cursor-pointer disabled:cursor-not-allowed"
|
| 70 |
+
aria-label="Seek frame"
|
| 71 |
/>
|
| 72 |
+
<span
|
| 73 |
+
className="text-right tabular text-[11px] text-slate-400 shrink-0"
|
| 74 |
+
title={`Frame ${frame} of ${Math.max(totalFrames - 1, 0)}`}
|
| 75 |
+
>
|
| 76 |
{currentTime}s / {totalTime}s
|
| 77 |
</span>
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
+
{/* Same hints, and breakpoint, as the Episodes playback bar. */}
|
| 80 |
+
<div className="hidden lg:flex flex-col gap-y-0.5 ml-4 text-[10px] text-slate-500 select-none shrink-0">
|
| 81 |
+
<p className="inline-flex items-center gap-1.5">
|
| 82 |
+
<kbd className="px-1.5 py-0.5 rounded border border-white/10 bg-white/5 text-slate-300 text-[10px]">
|
| 83 |
Space
|
| 84 |
+
</kbd>
|
| 85 |
+
<span>pause/unpause</span>
|
| 86 |
</p>
|
| 87 |
+
<p className="inline-flex items-center gap-1.5">
|
| 88 |
+
<span className="inline-flex items-center gap-0.5 text-slate-300">
|
| 89 |
+
<FaArrowUp size={10} />
|
| 90 |
+
<FaArrowDown size={10} />
|
| 91 |
+
</span>
|
| 92 |
+
<span>prev/next episode</span>
|
| 93 |
</p>
|
| 94 |
</div>
|
| 95 |
</div>
|
src/components/urdf-viewer.tsx
CHANGED
|
@@ -1058,7 +1058,7 @@ export default function URDFViewer({
|
|
| 1058 |
</button>
|
| 1059 |
|
| 1060 |
{showMapping && (
|
| 1061 |
-
<div className="flex gap-4 items-start">
|
| 1062 |
<div className="space-y-1 shrink-0">
|
| 1063 |
<label className="text-xs text-slate-400">Data source</label>
|
| 1064 |
<div className="flex gap-1 flex-wrap">
|
|
@@ -1068,8 +1068,8 @@ export default function URDFViewer({
|
|
| 1068 |
onClick={() => setSelectedGroup(name)}
|
| 1069 |
className={`px-2 py-1 text-xs rounded transition-colors ${
|
| 1070 |
selectedGroup === name
|
| 1071 |
-
? "bg-cyan-
|
| 1072 |
-
: "bg-white/5 text-slate-300 hover:bg-white/
|
| 1073 |
}`}
|
| 1074 |
>
|
| 1075 |
{name}
|
|
|
|
| 1058 |
</button>
|
| 1059 |
|
| 1060 |
{showMapping && (
|
| 1061 |
+
<div className="flex flex-col lg:flex-row gap-3 lg:gap-4 lg:items-start">
|
| 1062 |
<div className="space-y-1 shrink-0">
|
| 1063 |
<label className="text-xs text-slate-400">Data source</label>
|
| 1064 |
<div className="flex gap-1 flex-wrap">
|
|
|
|
| 1068 |
onClick={() => setSelectedGroup(name)}
|
| 1069 |
className={`px-2 py-1 text-xs rounded transition-colors ${
|
| 1070 |
selectedGroup === name
|
| 1071 |
+
? "bg-cyan-400/15 text-cyan-300 border border-cyan-400/40"
|
| 1072 |
+
: "bg-white/5 text-slate-300 border border-white/10 hover:bg-white/10"
|
| 1073 |
}`}
|
| 1074 |
>
|
| 1075 |
{name}
|