import { baseUrl } from "@/api/baseUrl"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Event } from "@/types/event"; import axios from "axios"; import { useCallback, useState } from "react"; import useSWR from "swr"; export default function SubmitPlus() { const { data: events, mutate: refresh } = useSWR([ "events", { limit: 100, in_progress: 0, is_submitted: 0 }, ]); const [upload, setUpload] = useState(); const onSubmitToPlus = useCallback( async (falsePositive: boolean) => { if (!upload) { return; } falsePositive ? axios.put(`events/${upload.id}/false_positive`) : axios.post(`events/${upload.id}/plus`, { include_annotation: 1, }); refresh( (data: Event[] | undefined) => { if (!data) { return data; } const index = data.findIndex((e) => e.id == upload.id); if (index == -1) { return data; } return [...data.slice(0, index), ...data.slice(index + 1)]; }, { revalidate: false, populateCache: true }, ); setUpload(undefined); }, [refresh, upload], ); return (
(!open ? setUpload(undefined) : null)} > Submit To Frigate+ Objects in locations you want to avoid are not false positives. Submitting them as false positives will confuse the model. {`${upload?.label}`} {events?.map((event) => { return (
setUpload(event)} >
); })}
); }