import { baseUrl } from "@/api/baseUrl"; import ActivityIndicator from "../indicators/activity-indicator"; import { LuTrash } from "react-icons/lu"; import { Button } from "../ui/button"; import { useMemo, useRef, useState } from "react"; import { isDesktop } from "react-device-detect"; import { FaPlay } from "react-icons/fa"; import Chip from "../indicators/Chip"; type ExportProps = { file: { name: string; }; onDelete: (file: string) => void; }; export default function ExportCard({ file, onDelete }: ExportProps) { const videoRef = useRef(null); const [hovered, setHovered] = useState(false); const [playing, setPlaying] = useState(false); const inProgress = useMemo( () => file.name.startsWith("in_progress"), [file.name], ); return (
setHovered(true) : undefined } onMouseLeave={ isDesktop && !inProgress ? () => setHovered(false) : undefined } onClick={isDesktop || inProgress ? undefined : () => setHovered(!hovered)} > {!playing && hovered && ( <>
onDelete(file.name)} > )} {inProgress ? ( ) : ( )} {!playing && (
{file.name.substring(0, file.name.length - 4).replaceAll("_", " ")}
)}
); } /** * {file.name.substring(0, file.name.length - 4)} */