From 66bcb456020ca45f86b178fe4403518ef70940e4 Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:50:12 -0400 Subject: [PATCH] Add arrow buttons to video viewer --- components/ReportCard.tsx | 82 ++++++++++++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 9 deletions(-) diff --git a/components/ReportCard.tsx b/components/ReportCard.tsx index 0076738..11320ea 100644 --- a/components/ReportCard.tsx +++ b/components/ReportCard.tsx @@ -6,17 +6,20 @@ import { CardFooter, CardHeader, Heading, + HStack, Radio, RadioGroup, + Spacer, Stack, Text, } from "@chakra-ui/react"; import { useState } from "react"; export default function (props: ReportCardProps) { + const [attachmentIdx, setAttachmentIdx] = useState(0); const targetMap: { [k: number]: string } = {}; - const [attachmentReady, setAttachmentReady] = useState( - !props.attachment_loading + const [attachmentsReady, setAttachmentReady] = useState( + !props.attachments_loading, ); const actionMap: { [k: number]: number } = {}; @@ -26,8 +29,12 @@ export default function (props: ReportCardProps) { }); async function recheckAttachment() { - const attachmentCheck = await fetch(`/api/uploads/${props.attachment}`, { - method: "HEAD", + const attachmentCheck = await fetch("/api/uploads/status", { + body: JSON.stringify(props.attachments), + headers: { + "content-type": "application/json", + }, + method: "POST", }); setAttachmentReady(attachmentCheck.ok); @@ -42,14 +49,71 @@ export default function (props: ReportCardProps) { ID(s): {props.target_ids.toString()} - {attachmentReady ? ( - - {props.attachment_loading ? ( + {props.attachments_loading ? (