diff --git a/web/src/components/DialogLarge.jsx b/web/src/components/DialogLarge.jsx new file mode 100644 index 000000000..8b03bd2a8 --- /dev/null +++ b/web/src/components/DialogLarge.jsx @@ -0,0 +1,35 @@ +import { h, Fragment } from 'preact'; +import { createPortal } from 'preact/compat'; +import { useState, useEffect } from 'preact/hooks'; + +export default function LargeDialog({ children, portalRootID = 'dialogs' }) { + const portalRoot = portalRootID && document.getElementById(portalRootID); + const [show, setShow] = useState(false); + + useEffect(() => { + window.requestAnimationFrame(() => { + setShow(true); + }); + }, []); + + const dialog = ( + +
+
+ {children} +
+
+
+ ); + + return portalRoot ? createPortal(dialog, portalRoot) : dialog; +} diff --git a/web/src/routes/Export.jsx b/web/src/routes/Export.jsx index 7156a1b0e..0b8a1452c 100644 --- a/web/src/routes/Export.jsx +++ b/web/src/routes/Export.jsx @@ -6,11 +6,15 @@ import axios from 'axios'; import { baseUrl } from '../api/baseUrl'; import { Fragment } from 'preact'; import ActivityIndicator from '../components/ActivityIndicator'; +import { Play } from '../icons/Play'; +import LargeDialog from '../components/DialogLarge'; +import VideoPlayer from '../components/VideoPlayer'; export default function Export() { const { data: config } = useSWR('config'); const { data: exports } = useSWR('exports/', (url) => axios({ baseURL: baseUrl, url }).then((res) => res.data)); + // Export States const [camera, setCamera] = useState('select'); const [playback, setPlayback] = useState('select'); const [message, setMessage] = useState({ text: '', error: false }); @@ -26,6 +30,10 @@ export default function Export() { const [endDate, setEndDate] = useState(localISODate); const [endTime, setEndTime] = useState('23:59'); + // Playback States + + const [selectedClip, setSelectedClip] = useState(); + const onHandleExport = () => { if (camera == 'select') { setMessage({ text: 'A camera needs to be selected.', error: true }); @@ -74,6 +82,38 @@ export default function Export() {
{message.text}
)} + {selectedClip && ( + +
+ Playback + { + this.player = player; + }} + onDispose={() => { + this.player = null; + }} + /> +
+
+ +
+
+ )} +
@@ -144,7 +184,7 @@ export default function Export() { {exports && (
Exports - + setSelectedClip(clip)} />
)}
@@ -152,7 +192,7 @@ export default function Export() { ); } -function Exports({ exports }) { +function Exports({ exports, onSetClip }) { return ( {exports.map((item) => ( @@ -166,6 +206,9 @@ function Exports({ exports }) {
) : (
+ {item.name.substring(0, item.name.length - 4)}