diff --git a/web/src/icons/Export.jsx b/web/src/icons/Export.jsx new file mode 100644 index 000000000..db8006da2 --- /dev/null +++ b/web/src/icons/Export.jsx @@ -0,0 +1,24 @@ +import { h } from 'preact'; +import { memo } from 'preact/compat'; + +export function Export({ className = 'h-6 w-6', stroke = 'currentColor', fill = 'none', onClick = () => {} }) { + return ( + + + + ); +} + +export default memo(Export); diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index c28d31cfa..f7ae6286f 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -19,6 +19,7 @@ import { Camera } from '../icons/Camera'; import { Clock } from '../icons/Clock'; import { Delete } from '../icons/Delete'; import { Download } from '../icons/Download'; +import { Export } from '../icons/Export'; import Menu, { MenuItem } from '../components/Menu'; import CalendarIcon from '../icons/Calendar'; import Calendar from '../components/Calendar'; @@ -216,6 +217,17 @@ export default function Events({ path, ...props }) { setState({ ...state, showDownloadMenu: true }); }; + const onExport = async (e, camera, start_time, end_time) => { + e.stopPropagation(); + + const response = await axios.post(`export/${camera}/start/${Math.round(start_time)}/end/${Math.round(end_time)}`, {playback : "realtime"}); + + if (response.status === 200) { + mutate(); + } + + }; + const showSubmitToPlus = (event_id, label, box, e) => { if (e) { e.stopPropagation(); @@ -663,6 +675,13 @@ export default function Events({ path, ...props }) { )} +
+ onExport(e, event.camera, event.start_time, event.end_time)} + /> +