mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-10 13:15:25 +03:00
Fix plus submission dialog
This commit is contained in:
parent
657fab2787
commit
f23a22735c
@ -26,6 +26,8 @@ import { FaList, FaVideo } from "react-icons/fa";
|
|||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
export default function SubmitPlus() {
|
export default function SubmitPlus() {
|
||||||
|
const { data: config } = useSWR<FrigateConfig>("config");
|
||||||
|
|
||||||
// filters
|
// filters
|
||||||
|
|
||||||
const [selectedCameras, setSelectedCameras] = useState<string[]>();
|
const [selectedCameras, setSelectedCameras] = useState<string[]>();
|
||||||
@ -45,6 +47,24 @@ export default function SubmitPlus() {
|
|||||||
]);
|
]);
|
||||||
const [upload, setUpload] = useState<Event>();
|
const [upload, setUpload] = useState<Event>();
|
||||||
|
|
||||||
|
const grow = useMemo(() => {
|
||||||
|
if (!config || !upload) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const camera = config.cameras[upload.camera];
|
||||||
|
|
||||||
|
if (!camera) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (camera.detect.width / camera.detect.height < 16 / 9) {
|
||||||
|
return "aspect-video object-contain";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}, [config, upload]);
|
||||||
|
|
||||||
const onSubmitToPlus = useCallback(
|
const onSubmitToPlus = useCallback(
|
||||||
async (falsePositive: boolean) => {
|
async (falsePositive: boolean) => {
|
||||||
if (!upload) {
|
if (!upload) {
|
||||||
@ -102,7 +122,7 @@ export default function SubmitPlus() {
|
|||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<img
|
<img
|
||||||
className="flex-grow-0"
|
className={`w-full ${grow} bg-black`}
|
||||||
src={`${baseUrl}api/events/${upload?.id}/snapshot.jpg`}
|
src={`${baseUrl}api/events/${upload?.id}/snapshot.jpg`}
|
||||||
alt={`${upload?.label}`}
|
alt={`${upload?.label}`}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user