mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 23:25:25 +03:00
filter instructions
This commit is contained in:
parent
5e1f2fa6e6
commit
73b76ad7a2
@ -22,13 +22,21 @@ import {
|
|||||||
CommandGroup,
|
CommandGroup,
|
||||||
CommandItem,
|
CommandItem,
|
||||||
} from "@/components/ui/command";
|
} from "@/components/ui/command";
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from "@/components/ui/popover";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
|
||||||
import { TooltipPortal } from "@radix-ui/react-tooltip";
|
import { TooltipPortal } from "@radix-ui/react-tooltip";
|
||||||
import { usePersistence } from "@/hooks/use-persistence";
|
import { usePersistence } from "@/hooks/use-persistence";
|
||||||
import { SaveSearchDialog } from "./SaveSearchDialog";
|
import { SaveSearchDialog } from "./SaveSearchDialog";
|
||||||
import { DeleteSearchDialog } from "./DeleteSearchDialog";
|
import { DeleteSearchDialog } from "./DeleteSearchDialog";
|
||||||
import { convertLocalDateToTimestamp } from "@/utils/dateUtil";
|
import {
|
||||||
|
convertLocalDateToTimestamp,
|
||||||
|
getIntlDateFormat,
|
||||||
|
} from "@/utils/dateUtil";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
||||||
type InputWithTagsProps = {
|
type InputWithTagsProps = {
|
||||||
@ -489,8 +497,12 @@ export default function InputWithTags({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Tooltip>
|
<Popover>
|
||||||
<TooltipTrigger className="cursor-default">
|
<PopoverTrigger asChild>
|
||||||
|
<button
|
||||||
|
className="focus:outline-none"
|
||||||
|
aria-label="Filter information"
|
||||||
|
>
|
||||||
<LuFilter
|
<LuFilter
|
||||||
aria-label="Filters active"
|
aria-label="Filters active"
|
||||||
className={cn(
|
className={cn(
|
||||||
@ -500,14 +512,40 @@ export default function InputWithTags({
|
|||||||
: "text-secondary-foreground",
|
: "text-secondary-foreground",
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</TooltipTrigger>
|
</button>
|
||||||
<TooltipPortal>
|
</PopoverTrigger>
|
||||||
<TooltipContent>
|
<PopoverContent className="w-80">
|
||||||
Filters{" "}
|
<div className="space-y-2">
|
||||||
{Object.keys(filters).length > 0 ? "active" : "inactive"}
|
<h3 className="font-medium">How to use text filters</h3>
|
||||||
</TooltipContent>
|
<p className="text-sm text-muted-foreground">
|
||||||
</TooltipPortal>
|
Filters help you narrow down your search results. Here's how
|
||||||
</Tooltip>
|
to use them:
|
||||||
|
</p>
|
||||||
|
<ul className="list-disc pl-5 text-sm text-primary-variant">
|
||||||
|
<li>
|
||||||
|
Type a filter name followed by a colon (e.g., "cameras:").
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Select a value from the suggestions or type your own.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Use multiple filters by adding them one after another.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Date filters (before: and after:) use{" "}
|
||||||
|
{getIntlDateFormat()} format.
|
||||||
|
</li>
|
||||||
|
<li>Remove filters by clicking the 'x' next to them.</li>
|
||||||
|
</ul>
|
||||||
|
<p className="text-sm text-muted-foreground">
|
||||||
|
Example:{" "}
|
||||||
|
<code className="text-primary">
|
||||||
|
cameras:front_door label:person before:01012024
|
||||||
|
</code>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
|
||||||
{inputFocused ? (
|
{inputFocused ? (
|
||||||
<LuChevronUp
|
<LuChevronUp
|
||||||
|
|||||||
@ -356,3 +356,15 @@ export const convertLocalDateToTimestamp = (dateString: string): number => {
|
|||||||
|
|
||||||
return timestamp;
|
return timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function getIntlDateFormat() {
|
||||||
|
return new Intl.DateTimeFormat()
|
||||||
|
.formatToParts(new Date())
|
||||||
|
.reduce((acc, part) => {
|
||||||
|
if (part.type === "day") acc.push("DD");
|
||||||
|
if (part.type === "month") acc.push("MM");
|
||||||
|
if (part.type === "year") acc.push("YYYY");
|
||||||
|
return acc;
|
||||||
|
}, [] as string[])
|
||||||
|
.join("");
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user