This commit is contained in:
legop3
2025-11-15 23:35:27 -05:00
parent aa6808a400
commit c55b5a7092
7 changed files with 146 additions and 140 deletions
+35
View File
@@ -0,0 +1,35 @@
import { useSession } from '../context/SessionContext.jsx';
import { useTelemetryFrame } from '../context/TelemetryContext.jsx';
import { useVideoRequests } from '../hooks/useVideoRequests.js';
import VideoTile from './VideoTile.jsx';
export default function DriverVideoPanel() {
const { session } = useSession();
const roverId = session?.assignment?.roverId;
const sources = useVideoRequests(roverId ? [roverId] : []);
const info = roverId ? sources[roverId] : null;
const frame = useTelemetryFrame(roverId);
const batteryRecord =
roverId && session?.roster
? session.roster.find((item) => String(item.id) === String(roverId))
: null;
const batteryConfig = batteryRecord?.battery ?? null;
return (
<section className="rounded-sm bg-[#242a32] p-1">
{roverId ? (
<div className="lg:min-h-[70vh]">
<VideoTile
sessionInfo={info}
label={roverId}
muted={false}
telemetryFrame={frame}
batteryConfig={batteryConfig}
/>
</div>
) : (
<p className="text-sm text-slate-400">Assign a rover to view the video feed.</p>
)}
</section>
);
}