From 039d8826043fe7eb1cbfb5514580a1531ee23689 Mon Sep 17 00:00:00 2001 From: sumn2u Date: Tue, 30 Jul 2024 21:56:19 -0500 Subject: [PATCH] add different colors for non-clickable files list --- client/src/Annotator/reducers/general-reducer.js | 4 +++- client/src/FilesListMenu/index.jsx | 7 +++++++ client/src/ThemeContext/index.jsx | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/Annotator/reducers/general-reducer.js b/client/src/Annotator/reducers/general-reducer.js index ffa281a..241ee43 100644 --- a/client/src/Annotator/reducers/general-reducer.js +++ b/client/src/Annotator/reducers/general-reducer.js @@ -175,7 +175,9 @@ export default (state, action) => { case "SELECT_FILE": { const { selected } = action if (!activeImage) return state - return setIn(state, [...pathToActiveImage, "selected"], selected) + const updatedState = setIn(state, [...pathToActiveImage, "selected"], selected); + const isAnyImageSelected = updatedState.images.some(image => image.selected); + return setIn(updatedState, ["enabledDownload"], isAnyImageSelected); } case "SELECT_REGION": { diff --git a/client/src/FilesListMenu/index.jsx b/client/src/FilesListMenu/index.jsx index d9d6a1e..0dc171b 100644 --- a/client/src/FilesListMenu/index.jsx +++ b/client/src/FilesListMenu/index.jsx @@ -106,6 +106,13 @@ export const FilesListMenu = ({ selectedImage !== null && selectedImage !== index ? "not-allowed" : "pointer", + "&.Mui-disabled": { + background: !hasRegions(index) ? muiColors.grey[400] : "auto", + cursor: "not-allowed", + borderRadius: 0, + width: 14, + height: 14, + }, }} checked={image.selected} onClick={() => handleCheckBoxClick(image, index)} diff --git a/client/src/ThemeContext/index.jsx b/client/src/ThemeContext/index.jsx index 5b935cd..25bc7c5 100644 --- a/client/src/ThemeContext/index.jsx +++ b/client/src/ThemeContext/index.jsx @@ -12,7 +12,6 @@ export const ThemeProvider = ({ children }) => { } const preferredColorScheme = getPreferredColorScheme(); - console.log(`Preferred color scheme: ${preferredColorScheme}`); const [theme, setTheme] = useState(preferredColorScheme); // Default to browser theme