Fix plus view resetting (#13160)

This commit is contained in:
Nicolas Mowen 2024-08-18 07:41:10 -06:00
parent ef46451b80
commit 58ca44bd15

View File

@ -242,27 +242,35 @@ export default function SubmitPlus() {
<PlusSortSelector selectedSort={sort} setSelectedSort={setSort} /> <PlusSortSelector selectedSort={sort} setSelectedSort={setSort} />
</div> </div>
<div className="no-scrollbar flex size-full flex-1 flex-wrap content-start gap-2 overflow-y-auto md:gap-4"> <div className="no-scrollbar flex size-full flex-1 flex-wrap content-start gap-2 overflow-y-auto md:gap-4">
{!events?.length ? (
<>
{isValidating ? ( {isValidating ? (
<ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" /> <ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" />
) : events?.length === 0 ? ( ) : (
<div className="absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center justify-center text-center"> <div className="absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center justify-center text-center">
<LuFolderX className="size-16" /> <LuFolderX className="size-16" />
No snapshots found No snapshots found
</div> </div>
)}
</>
) : ( ) : (
<>
<div className="grid w-full gap-2 p-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"> <div className="grid w-full gap-2 p-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5">
<Dialog <Dialog
open={upload != undefined} open={upload != undefined}
onOpenChange={(open) => (!open ? setUpload(undefined) : null)} onOpenChange={(open) => (!open ? setUpload(undefined) : null)}
> >
<DialogContent className="md:max-w-3xl lg:max-w-4xl xl:max-w-7xl"> <DialogContent className="md:max-w-3xl lg:max-w-4xl xl:max-w-7xl">
<TransformWrapper minScale={1.0} wheel={{ smoothStep: 0.005 }}> <TransformWrapper
minScale={1.0}
wheel={{ smoothStep: 0.005 }}
>
<DialogHeader> <DialogHeader>
<DialogTitle>Submit To Frigate+</DialogTitle> <DialogTitle>Submit To Frigate+</DialogTitle>
<DialogDescription> <DialogDescription>
Objects in locations you want to avoid are not false Objects in locations you want to avoid are not false
positives. Submitting them as false positives will confuse positives. Submitting them as false positives will
the model. confuse the model.
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
<TransformComponent <TransformComponent
@ -285,7 +293,9 @@ export default function SubmitPlus() {
)} )}
</TransformComponent> </TransformComponent>
<DialogFooter> <DialogFooter>
<Button onClick={() => setUpload(undefined)}>Cancel</Button> <Button onClick={() => setUpload(undefined)}>
Cancel
</Button>
<Button <Button
className="bg-success" className="bg-success"
onClick={() => onSubmitToPlus(false)} onClick={() => onSubmitToPlus(false)}
@ -353,8 +363,15 @@ export default function SubmitPlus() {
</div> </div>
); );
})} })}
{!isValidating && !isDone && <div ref={lastEventRef} />}
</div> </div>
{!isDone && isValidating ? (
<div className="flex w-full items-center justify-center">
<ActivityIndicator />
</div>
) : (
<div ref={lastEventRef} />
)}
</>
)} )}
</div> </div>
</div> </div>