mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 06:35:24 +03:00
Add ability to submit to frigate+ from review panel
This commit is contained in:
parent
08ca6f8886
commit
d3ad325473
@ -8,7 +8,9 @@ import { getIconForLabel } from "@/utils/iconUtil";
|
|||||||
import { useApiHost } from "@/api";
|
import { useApiHost } from "@/api";
|
||||||
import { ReviewSegment } from "@/types/review";
|
import { ReviewSegment } from "@/types/review";
|
||||||
import { Event } from "@/types/event";
|
import { Event } from "@/types/event";
|
||||||
import { useMemo } from "react";
|
import { useMemo, useState } from "react";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
import { FrigatePlusDialog } from "../dialog/FrigatePlusDialog";
|
||||||
|
|
||||||
type ReviewDetailDialogProps = {
|
type ReviewDetailDialogProps = {
|
||||||
review?: ReviewSegment;
|
review?: ReviewSegment;
|
||||||
@ -24,6 +26,10 @@ export default function ReviewDetailDialog({
|
|||||||
|
|
||||||
const apiHost = useApiHost();
|
const apiHost = useApiHost();
|
||||||
|
|
||||||
|
// upload
|
||||||
|
|
||||||
|
const [upload, setUpload] = useState<Event>();
|
||||||
|
|
||||||
// data
|
// data
|
||||||
|
|
||||||
const { data: events } = useSWR<Event[]>(
|
const { data: events } = useSWR<Event[]>(
|
||||||
@ -59,6 +65,16 @@ export default function ReviewDetailDialog({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<FrigatePlusDialog
|
||||||
|
upload={upload}
|
||||||
|
onClose={() => setUpload(undefined)}
|
||||||
|
onEventUploaded={() => {
|
||||||
|
if (upload) {
|
||||||
|
upload.plus_id = "1234";
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Content
|
<Content
|
||||||
className={
|
className={
|
||||||
isDesktop ? "sm:max-w-xl" : "max-h-[75dvh] overflow-hidden p-2 pb-4"
|
isDesktop ? "sm:max-w-xl" : "max-h-[75dvh] overflow-hidden p-2 pb-4"
|
||||||
@ -127,7 +143,12 @@ export default function ReviewDetailDialog({
|
|||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
key={event.id}
|
key={event.id}
|
||||||
className="aspect-video select-none rounded-lg object-contain transition-opacity"
|
className={cn(
|
||||||
|
"aspect-video select-none rounded-lg object-contain transition-opacity",
|
||||||
|
event.has_snapshot &&
|
||||||
|
event.plus_id == undefined &&
|
||||||
|
"cursor-pointer",
|
||||||
|
)}
|
||||||
style={
|
style={
|
||||||
isIOS
|
isIOS
|
||||||
? {
|
? {
|
||||||
@ -142,6 +163,11 @@ export default function ReviewDetailDialog({
|
|||||||
? `${apiHost}api/events/${event.id}/snapshot.jpg`
|
? `${apiHost}api/events/${event.id}/snapshot.jpg`
|
||||||
: `${apiHost}api/events/${event.id}/thumbnail.jpg`
|
: `${apiHost}api/events/${event.id}/thumbnail.jpg`
|
||||||
}
|
}
|
||||||
|
onClick={() => {
|
||||||
|
if (event.has_snapshot && event.plus_id == undefined) {
|
||||||
|
setUpload(event);
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user