diff --git a/web/src/components/Tabs.jsx b/web/src/components/Tabs.jsx index 800375c31..2e14227fb 100644 --- a/web/src/components/Tabs.jsx +++ b/web/src/components/Tabs.jsx @@ -27,12 +27,14 @@ export function Tabs({ children, selectedIndex: selectedIndexProp, onChange, cla ); } -export function TextTab({ selected, text, onClick }) { - const selectedStyle = selected - ? 'text-white bg-blue-500 dark:text-black dark:bg-white' - : 'text-black dark:text-white bg-transparent'; +export function TextTab({ selected, text, onClick, disabled }) { + const selectedStyle = disabled + ? 'text-gray-400 dark:text-gray-600 bg-transparent' + : selected + ? 'text-white bg-blue-500 dark:text-black dark:bg-white' + : 'text-black dark:text-white bg-transparent'; return ( - ); diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index b93d661e4..e35925a4b 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -2,6 +2,7 @@ import { h, Fragment } from 'preact'; import { route } from 'preact-router'; import ActivityIndicator from '../components/ActivityIndicator'; import Heading from '../components/Heading'; +import { Tabs, TextTab } from '../components/Tabs'; import { useApiHost } from '../api'; import useSWR from 'swr'; import useSWRInfinite from 'swr/infinite'; @@ -54,6 +55,7 @@ export default function Events({ path, ...props }) { }); const [uploading, setUploading] = useState([]); const [viewEvent, setViewEvent] = useState(); + const [eventDetailType, setEventDetailType] = useState('clip'); const [downloadEvent, setDownloadEvent] = useState({ id: null, has_clip: false, @@ -235,6 +237,10 @@ export default function Events({ path, ...props }) { } }; + const handleEventDetailTabChange = (index) => { + setEventDetailType(index == 0 ? 'clip' : 'image'); + }; + if (!config) { return ; } @@ -495,9 +501,15 @@ export default function Events({ path, ...props }) { {viewEvent !== event.id ? null : (
- {event.has_clip ? ( - <> - Clip +
+ + + + +
+ +
+ {((eventDetailType == 'clip') && event.has_clip) ? ( {}} /> - - ) : ( -
-
- {event.has_snapshot ? 'Best Image' : 'Thumbnail'} + ) : null } + + {((eventDetailType == 'image') || !event.has_clip) ? ( +
{`${event.label}
-
- )} + ) : null } +
)}