mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-17 16:44:29 +03:00
context menu on container ref
This commit is contained in:
parent
19abcb9e2f
commit
cd82e220b1
@ -1,4 +1,4 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo, useRef } from "react";
|
||||||
import { useApiHost } from "@/api";
|
import { useApiHost } from "@/api";
|
||||||
import { getIconForLabel } from "@/utils/iconUtil";
|
import { getIconForLabel } from "@/utils/iconUtil";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
@ -27,10 +27,11 @@ export default function SearchThumbnail({
|
|||||||
const apiHost = useApiHost();
|
const apiHost = useApiHost();
|
||||||
const { data: config } = useSWR<FrigateConfig>("config");
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
const [imgRef, imgLoaded, onImgLoad] = useImageLoaded();
|
const [imgRef, imgLoaded, onImgLoad] = useImageLoaded();
|
||||||
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
// interactions
|
// interactions
|
||||||
|
|
||||||
useContextMenu(imgRef, () => {
|
useContextMenu(containerRef, () => {
|
||||||
onClick(searchResult, true, false);
|
onClick(searchResult, true, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ export default function SearchThumbnail({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
ref={containerRef}
|
||||||
className="relative size-full cursor-pointer"
|
className="relative size-full cursor-pointer"
|
||||||
{...bindClickAndLongPress}
|
{...bindClickAndLongPress}
|
||||||
>
|
>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user