mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Add button to mark review item as reviewed in filmstrip (#12878)
* Add button to mark review item as reviewd in filmstrip * Add tooltip
This commit is contained in:
parent
b01ce31903
commit
4ecc0e15ce
@ -12,17 +12,21 @@ import { isCurrentHour } from "@/utils/dateUtil";
|
|||||||
import { useCameraPreviews } from "@/hooks/use-camera-previews";
|
import { useCameraPreviews } from "@/hooks/use-camera-previews";
|
||||||
import { baseUrl } from "@/api/baseUrl";
|
import { baseUrl } from "@/api/baseUrl";
|
||||||
import { useApiHost } from "@/api";
|
import { useApiHost } from "@/api";
|
||||||
import { isSafari } from "react-device-detect";
|
import { isDesktop, isSafari } from "react-device-detect";
|
||||||
import { usePersistence } from "@/hooks/use-persistence";
|
import { usePersistence } from "@/hooks/use-persistence";
|
||||||
import { Skeleton } from "../ui/skeleton";
|
import { Skeleton } from "../ui/skeleton";
|
||||||
|
import { Button } from "../ui/button";
|
||||||
|
import { FaCircleCheck } from "react-icons/fa6";
|
||||||
|
|
||||||
type AnimatedEventCardProps = {
|
type AnimatedEventCardProps = {
|
||||||
event: ReviewSegment;
|
event: ReviewSegment;
|
||||||
selectedGroup?: string;
|
selectedGroup?: string;
|
||||||
|
updateEvents: () => void;
|
||||||
};
|
};
|
||||||
export function AnimatedEventCard({
|
export function AnimatedEventCard({
|
||||||
event,
|
event,
|
||||||
selectedGroup,
|
selectedGroup,
|
||||||
|
updateEvents,
|
||||||
}: AnimatedEventCardProps) {
|
}: AnimatedEventCardProps) {
|
||||||
const { data: config } = useSWR<FrigateConfig>("config");
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
const apiHost = useApiHost();
|
const apiHost = useApiHost();
|
||||||
@ -59,6 +63,7 @@ export function AnimatedEventCard({
|
|||||||
}, [visibilityListener]);
|
}, [visibilityListener]);
|
||||||
|
|
||||||
const [isLoaded, setIsLoaded] = useState(false);
|
const [isLoaded, setIsLoaded] = useState(false);
|
||||||
|
const [isHovered, setIsHovered] = useState(false);
|
||||||
|
|
||||||
// interaction
|
// interaction
|
||||||
|
|
||||||
@ -102,7 +107,26 @@ export function AnimatedEventCard({
|
|||||||
style={{
|
style={{
|
||||||
aspectRatio: aspectRatio,
|
aspectRatio: aspectRatio,
|
||||||
}}
|
}}
|
||||||
|
onMouseEnter={isDesktop ? () => setIsHovered(true) : undefined}
|
||||||
|
onMouseLeave={isDesktop ? () => setIsHovered(false) : undefined}
|
||||||
>
|
>
|
||||||
|
{isHovered && (
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<Button
|
||||||
|
className="absolute right-2 top-1 z-40 bg-gray-500 bg-gradient-to-br from-gray-400 to-gray-500"
|
||||||
|
size="xs"
|
||||||
|
onClick={async () => {
|
||||||
|
await axios.post(`reviews/viewed`, { ids: [event.id] });
|
||||||
|
updateEvents();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<FaCircleCheck className="size-3 text-white" />
|
||||||
|
</Button>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent>Mark as Reviewed</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
<div
|
<div
|
||||||
className="size-full cursor-pointer overflow-hidden rounded md:rounded-lg"
|
className="size-full cursor-pointer overflow-hidden rounded md:rounded-lg"
|
||||||
onClick={onOpenReview}
|
onClick={onOpenReview}
|
||||||
|
@ -315,6 +315,7 @@ export default function LiveDashboardView({
|
|||||||
key={event.id}
|
key={event.id}
|
||||||
event={event}
|
event={event}
|
||||||
selectedGroup={cameraGroup}
|
selectedGroup={cameraGroup}
|
||||||
|
updateEvents={updateEvents}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
Loading…
Reference in New Issue
Block a user