From 28a8b7c8d47bd35821f4b61100e7ea5fae4a3b5a Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 19 Apr 2024 08:52:37 -0600 Subject: [PATCH] Get video playback working --- web/src/components/card/ExportCard.tsx | 44 +++++++++++--------------- web/src/pages/Exports.tsx | 33 +++++++++++++++++++ 2 files changed, 52 insertions(+), 25 deletions(-) diff --git a/web/src/components/card/ExportCard.tsx b/web/src/components/card/ExportCard.tsx index f4a5c18a5..5c40841d9 100644 --- a/web/src/components/card/ExportCard.tsx +++ b/web/src/components/card/ExportCard.tsx @@ -1,7 +1,7 @@ import ActivityIndicator from "../indicators/activity-indicator"; import { LuPencil, LuTrash } from "react-icons/lu"; import { Button } from "../ui/button"; -import { useRef, useState } from "react"; +import { useState } from "react"; import { isDesktop } from "react-device-detect"; import { FaPlay } from "react-icons/fa"; import Chip from "../indicators/Chip"; @@ -14,6 +14,7 @@ import { Export } from "@/types/export"; type ExportProps = { className: string; exportedRecording: Export; + onSelect: (selected: Export) => void; onRename: (original: string, update: string) => void; onDelete: (file: string) => void; }; @@ -21,12 +22,11 @@ type ExportProps = { export default function ExportCard({ className, exportedRecording, + onSelect, onRename, onDelete, }: ExportProps) { - const videoRef = useRef(null); const [hovered, setHovered] = useState(false); - const [playing, setPlaying] = useState(false); const [loading, setLoading] = useState(true); // editing name @@ -113,9 +113,7 @@ export default function ExportCard({ > {hovered && ( <> - {!playing && ( -
- )} +
- {!playing && ( - - )} + + )} {exportedRecording.in_progress ? ( ) : ( setLoading(false)} /> @@ -158,13 +154,11 @@ export default function ExportCard({ {loading && ( )} - {!playing && ( -
-
- {exportedRecording.name} -
+
+
+ {exportedRecording.name}
- )} +
); diff --git a/web/src/pages/Exports.tsx b/web/src/pages/Exports.tsx index 020212d17..8309d1804 100644 --- a/web/src/pages/Exports.tsx +++ b/web/src/pages/Exports.tsx @@ -1,3 +1,4 @@ +import { baseUrl } from "@/api/baseUrl"; import ExportCard from "@/components/card/ExportCard"; import { AlertDialog, @@ -9,6 +10,7 @@ import { AlertDialogTitle, } from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; +import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Export } from "@/types/export"; import axios from "axios"; @@ -69,6 +71,10 @@ function Exports() { [mutate], ); + // Viewing + + const [selected, setSelected] = useState(); + return (
+ { + if (!open) { + setSelected(undefined); + } + }} + > + + {selected?.name} + + + +
setDeleteClip(file)} />