diff --git a/web/src/components/card/AnimatedEventCard.tsx b/web/src/components/card/AnimatedEventCard.tsx index 021f38f2b..73c6af3b5 100644 --- a/web/src/components/card/AnimatedEventCard.tsx +++ b/web/src/components/card/AnimatedEventCard.tsx @@ -107,7 +107,7 @@ export function AnimatedEventCard({
{ if (e.button === 1) { diff --git a/web/src/views/search/SearchView.tsx b/web/src/views/search/SearchView.tsx index 3f6d59161..866170655 100644 --- a/web/src/views/search/SearchView.tsx +++ b/web/src/views/search/SearchView.tsx @@ -13,8 +13,8 @@ import { cn } from "@/lib/utils"; import { FrigateConfig } from "@/types/frigateConfig"; import { SearchFilter, SearchResult, SearchSource } from "@/types/search"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { isMobileOnly } from "react-device-detect"; -import { LuImage, LuSearchX, LuText } from "react-icons/lu"; +import { isDesktop, isMobileOnly } from "react-device-detect"; +import { LuColumns, LuImage, LuSearchX, LuText } from "react-icons/lu"; import useSWR from "swr"; import ExploreView from "../explore/ExploreView"; import useKeyboardListener, { @@ -26,6 +26,13 @@ import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import { isEqual } from "lodash"; import { formatDateToLocaleString } from "@/utils/dateUtil"; import { TooltipPortal } from "@radix-ui/react-tooltip"; +import { Slider } from "@/components/ui/slider"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; +import { usePersistence } from "@/hooks/use-persistence"; type SearchViewProps = { search: string; @@ -57,6 +64,21 @@ export default function SearchView({ revalidateOnFocus: false, }); + // grid + + const [columnCount, setColumnCount] = usePersistence("exploreGridColumns", 4); + const effectiveColumnCount = useMemo(() => columnCount ?? 4, [columnCount]); + + const gridClassName = cn("grid w-full gap-2 px-1 gap-2 lg:gap-4 md:mx-2", { + "sm:grid-cols-2": effectiveColumnCount <= 2, + "sm:grid-cols-3": effectiveColumnCount === 3, + "sm:grid-cols-4": effectiveColumnCount === 4, + "sm:grid-cols-5": effectiveColumnCount === 5, + "sm:grid-cols-6": effectiveColumnCount === 6, + "sm:grid-cols-7": effectiveColumnCount === 7, + "sm:grid-cols-8": effectiveColumnCount >= 8, + }); + // suggestions values const allLabels = useMemo(() => { @@ -340,7 +362,7 @@ export default function SearchView({ )} {uniqueResults && ( -
+
{uniqueResults && uniqueResults.map((value, index) => { const selected = selectedIndex === index; @@ -409,6 +431,47 @@ export default function SearchView({
{hasMore && isLoading && }
+ + {isDesktop && columnCount && ( +
+ + + + +
+ +
+
+
+ Adjust Grid Columns +
+ +
+
+ Grid Columns +
+
+ setColumnCount(value)} + max={8} + min={2} + step={1} + className="flex-grow" + /> + + {effectiveColumnCount} + +
+
+
+
+
+ )} )}