import { useEffect, useState } from "react"; import { useParams } from "react-router-dom"; import VideoPlayer from "../components/VideoPlayer"; import VideoSidebar from "../components/VideoSidebar"; import { fetchVideo, formatRunTime } from "../api/client"; import type { VideoDetail } from "../types/video"; function getMapDisplayName(mapName: string): string { return mapName.replace(/_/g, " ").toUpperCase(); } function getMomUrl(mapName: string): string { return `https://dashboard.momentum-mod.org/maps/${mapName}`; } function SkeletonBlock({ className }: { className?: string }) { return (
); } function PageSkeleton() { return (
); } export default function VideoDetail() { const { id } = useParams<{ id: string }>(); const [video, setVideo] = useState(null); const [error, setError] = useState(null); useEffect(() => { if (!id) return; fetchVideo(id) .then(setVideo) .catch((err) => setError(err.message)); }, [id]); if (error) { return (

{error}

); } if (!video) { return ; } return (
{video.previousPbs && video.previousPbs.length > 0 && (
Previous PBs
    {video.previousPbs.map((pb) => (
  • {formatRunTime(pb.runTime)} {" ยท "} {new Date( pb.createdAt, ).toLocaleDateString()}
  • ))}
)}
); }