diff --git a/web/src/components/MultiSelect.jsx b/web/src/components/MultiSelect.jsx index 0e41a0503..99412e938 100644 --- a/web/src/components/MultiSelect.jsx +++ b/web/src/components/MultiSelect.jsx @@ -3,15 +3,19 @@ import { useRef, useState } from 'preact/hooks'; import Menu from './Menu'; import { ArrowDropdown } from '../icons/ArrowDropdown'; import Heading from './Heading'; +import Button from './Button'; +import CameraIcon from '../icons/Camera'; -export default function MultiSelect({ className, title, options, selection, onToggle }) { +export default function MultiSelect({ className, title, options, selection, onToggle, onShowAll, onSelectSingle }) { const popupRef = useRef(null); const [state, setState] = useState({ showMenu: false, }); - + + const isOptionSelected = (item) => { return selection == "all" || selection.split(',').indexOf(item) > -1; } + return (
{state.showMenu ? ( setState({ showMenu: false })}> - {title} +
+ {title} + +
{options.map((item) => ( - +
+ +
+ +
+
))}
): null}
); -} \ No newline at end of file +} diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index f99553031..e8807411e 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -301,6 +301,8 @@ export default function Events({ path, ...props }) { options={filterValues.cameras} selection={searchParams.cameras} onToggle={(item) => onToggleNamedFilter("cameras", item)} + onShowAll={() => onFilter("cameras", ["all"])} + onSelectSingle={(item) => onFilter("cameras", item)} /> onToggleNamedFilter("labels", item) } + onShowAll={() => onFilter("labels", ["all"])} + onSelectSingle={(item) => onFilter("labels", item)} /> onToggleNamedFilter("zones", item) } + onShowAll={() => onFilter("zones", ["all"])} + onSelectSingle={(item) => onFilter("zones", item)} /> { filterValues.sub_labels.length > 0 && ( @@ -324,6 +330,8 @@ export default function Events({ path, ...props }) { options={filterValues.sub_labels} selection={searchParams.sub_labels} onToggle={(item) => onToggleNamedFilter("sub_labels", item) } + onShowAll={() => onFilter("sub_labels", ["all"])} + onSelectSingle={(item) => onFilter("sub_labels", item)} /> )}