);
}
diff --git a/web/src/Events.jsx b/web/src/Events.jsx
index 79805ea97..0607f4073 100644
--- a/web/src/Events.jsx
+++ b/web/src/Events.jsx
@@ -1,5 +1,6 @@
import { h } from 'preact';
import { ApiHost } from './context';
+import Box from './components/Box';
import Heading from './components/Heading';
import Link from './components/Link';
import { route } from 'preact-router';
@@ -19,71 +20,82 @@ export default function Events({ url } = {}) {
setEvents(data);
}, [searchParamsString]);
+ const searchKeys = Array.from(searchParams.keys());
+
return (
-
+
Events
-
- {Array.from(searchParams.keys()).map((filterKey) => (
-
- ))}
-
-
-
-
-
- Camera
- Label
- Score
- Zones
- Date
- Start
- End
-
-
-
- {events.map(
- (
- { camera, id, label, start_time: startTime, end_time: endTime, thumbnail, top_score: score, zones },
- i
- ) => {
- const start = new Date(parseInt(startTime * 1000, 10));
- const end = new Date(parseInt(endTime * 1000, 10));
- return (
-
-
-
-
-
-
-
-
-
-
-
-
- {(score * 100).toFixed(2)}%
-
-
- {zones.map((zone) => (
-
-
-
- ))}
-
-
- {start.toLocaleDateString()}
- {start.toLocaleTimeString()}
- {end.toLocaleTimeString()}
-
- );
- }
- )}
-
-
+
+ {searchKeys.length ? (
+
+ Filters
+
+ {searchKeys.map((filterKey) => (
+
+ ))}
+
+
+ ) : null}
+
+
+
+
+
+
+ Camera
+ Label
+ Score
+ Zones
+ Date
+ Start
+ End
+
+
+
+ {events.map(
+ (
+ { camera, id, label, start_time: startTime, end_time: endTime, thumbnail, top_score: score, zones },
+ i
+ ) => {
+ const start = new Date(parseInt(startTime * 1000, 10));
+ const end = new Date(parseInt(endTime * 1000, 10));
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ {(score * 100).toFixed(2)}%
+
+
+ {zones.map((zone) => (
+
+
+
+ ))}
+
+
+ {start.toLocaleDateString()}
+ {start.toLocaleTimeString()}
+ {end.toLocaleTimeString()}
+
+ );
+ }
+ )}
+
+
+
);
}
diff --git a/web/src/components/Box.jsx b/web/src/components/Box.jsx
new file mode 100644
index 000000000..73304c12a
--- /dev/null
+++ b/web/src/components/Box.jsx
@@ -0,0 +1,16 @@
+import { h } from 'preact';
+
+export default function Box({ children, className = '', hover = false, href, ...props }) {
+ const Element = href ? 'a' : 'div';
+ return (
+
+ {children}
+
+ );
+}
diff --git a/web/src/components/Heading.jsx b/web/src/components/Heading.jsx
index ee3c611bf..b730c6922 100644
--- a/web/src/components/Heading.jsx
+++ b/web/src/components/Heading.jsx
@@ -1,9 +1,5 @@
import { h } from 'preact';
export default function Heading({ children, className = '', size = '2xl' }) {
- return (
-
- {children}
-
- );
+ return
{children} ;
}
diff --git a/web/src/components/Link.jsx b/web/src/components/Link.jsx
index b190f25a8..dbe0518b0 100644
--- a/web/src/components/Link.jsx
+++ b/web/src/components/Link.jsx
@@ -2,7 +2,7 @@ import { h } from 'preact';
export default function Link({ className, children, href, ...props }) {
return (
-
+
{children}
);
diff --git a/web/src/components/Switch.jsx b/web/src/components/Switch.jsx
index 7723f9b46..9c687c1de 100644
--- a/web/src/components/Switch.jsx
+++ b/web/src/components/Switch.jsx
@@ -14,7 +14,11 @@ export default function Switch({ checked, label, id, onChange }) {
-
+
{children}
);
}
-export function Thead({ children, className }) {
+export function Thead({ children, className = '' }) {
return {children} ;
}
-export function Tbody({ children, className }) {
+export function Tbody({ children, className = '' }) {
return
{children} ;
}
-export function Tfoot({ children, className }) {
+export function Tfoot({ children, className = '' }) {
return {children} ;
}
-export function Tr({ children, className, index }) {
- return {children} ;
+export function Tr({ children, className = '', index }) {
+ return {children} ;
}
-export function Th({ children, className }) {
+export function Th({ children, className = '' }) {
return {children} ;
}
-export function Td({ children, className }) {
+export function Td({ children, className = '' }) {
return {children} ;
}