import ActivityIndicator from "../indicators/activity-indicator"; import { LuTrash } from "react-icons/lu"; import { Button } from "../ui/button"; import { useState } from "react"; import { isDesktop } from "react-device-detect"; import { FaDownload, FaPlay } from "react-icons/fa"; import Chip from "../indicators/Chip"; import { Skeleton } from "../ui/skeleton"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogTitle, } from "../ui/dialog"; import { Input } from "../ui/input"; import useKeyboardListener from "@/hooks/use-keyboard-listener"; import { DeleteClipType, Export } from "@/types/export"; import { MdEditSquare } from "react-icons/md"; import { baseUrl } from "@/api/baseUrl"; import { cn } from "@/lib/utils"; type ExportProps = { className: string; exportedRecording: Export; onSelect: (selected: Export) => void; onRename: (original: string, update: string) => void; onDelete: ({ file, exportName }: DeleteClipType) => void; }; export default function ExportCard({ className, exportedRecording, onSelect, onRename, onDelete, }: ExportProps) { const [hovered, setHovered] = useState(false); const [loading, setLoading] = useState( exportedRecording.thumb_path.length > 0, ); // editing name const [editName, setEditName] = useState<{ original: string; update: string; }>(); useKeyboardListener( editName != undefined ? ["Enter"] : [], (_, down, repeat) => { if (down && !repeat && editName && editName.update.length > 0) { onRename(exportedRecording.id, editName.update); setEditName(undefined); } }, ); return ( <>