From a4bb6c2c642c472a2e49943f6d1b9bb8636812b5 Mon Sep 17 00:00:00 2001 From: sumn2u Date: Tue, 25 Jun 2024 06:30:19 -0500 Subject: [PATCH 1/2] disable file download checkbox for images without regions --- client/src/FilesListMenu/index.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/FilesListMenu/index.jsx b/client/src/FilesListMenu/index.jsx index 266803e..850b2cd 100644 --- a/client/src/FilesListMenu/index.jsx +++ b/client/src/FilesListMenu/index.jsx @@ -74,6 +74,10 @@ export const FilesListMenu = ({ const handleCheckBoxClick = (image) => { onSelectFile(!image.selected) } + + const hasRegions = (imageIndex) => { + return allImages.length > 0 && allImages[imageIndex].regions.length > 0 + } return ( @@ -89,7 +93,6 @@ export const FilesListMenu = ({ className={classnames({ selected: image.name === selectedImage })} key = {index} > - handleCheckBoxClick(image, index)} data-testid="checkbox" - disabled={selectedImage !== null && selectedImage !== index} + disabled={(selectedImage !== null && selectedImage !== index) || !hasRegions(index)} />