From df67764e5cd3127c9f2620cefad75406df8ca633 Mon Sep 17 00:00:00 2001 From: sumn2u Date: Mon, 1 Jul 2024 17:19:08 -0500 Subject: [PATCH 1/2] display the annotation screen upon refresh --- client/src/Annotation/index.jsx | 6 +++++- client/src/FilesListMenu/FilesListMenu.test.js | 12 ++++++------ client/src/SettingsProvider/index.jsx | 2 +- client/src/SetupPage/index.jsx | 12 +++++++++++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/client/src/Annotation/index.jsx b/client/src/Annotation/index.jsx index 7ad7294..cc5d146 100644 --- a/client/src/Annotation/index.jsx +++ b/client/src/Annotation/index.jsx @@ -57,7 +57,7 @@ export default () => { taskDescription: "", taskChoice: "image_classification", images: [], - dataTask: null, + showLab: false, configuration: { labels: [], multipleRegions: true, @@ -150,6 +150,10 @@ export default () => { fetchImages(settings.images); } } + const showLab = settingsConfig.settings.showLab || false; + if(!isSettingsOpen && showLab) { + setShowLabel(showLab) + } } const showAnnotationLab = () => { diff --git a/client/src/FilesListMenu/FilesListMenu.test.js b/client/src/FilesListMenu/FilesListMenu.test.js index 9fa7959..d583c3b 100644 --- a/client/src/FilesListMenu/FilesListMenu.test.js +++ b/client/src/FilesListMenu/FilesListMenu.test.js @@ -45,7 +45,7 @@ describe('FilesListMenu', () => { "processed": false } ], - "dataTask": null, + "showLab": false, "configuration": { "labels": [ { @@ -108,7 +108,7 @@ describe('FilesListMenu', () => { "processed": false } ], - "dataTask": null, + "showLab": false, "configuration": { "labels": [ { @@ -256,7 +256,7 @@ describe('FilesListMenu', () => { "processed": false } ], - "dataTask": null, + "showLab": false, "configuration": { "labels": [ { @@ -382,7 +382,7 @@ describe('FilesListMenu', () => { "processed": false } ], - "dataTask": null, + "showLab": false, "configuration": { "labels": [ { @@ -508,7 +508,7 @@ describe('FilesListMenu', () => { "processed": false } ], - "dataTask": null, + "showLab": false, "configuration": { "labels": [ { @@ -633,7 +633,7 @@ describe('FilesListMenu', () => { "processed": false } ], - "dataTask": null, + "showLab": false, "configuration": { "labels": [ { diff --git a/client/src/SettingsProvider/index.jsx b/client/src/SettingsProvider/index.jsx index fa6ccf9..f414329 100644 --- a/client/src/SettingsProvider/index.jsx +++ b/client/src/SettingsProvider/index.jsx @@ -11,7 +11,7 @@ const defaultSettings = { taskDescription: "", taskChoice: "image_classification", images: [], - dataTask: null, + showLab: false, configuration: { labels: [], multipleRegions: true, diff --git a/client/src/SetupPage/index.jsx b/client/src/SetupPage/index.jsx index 28189ef..e9570f2 100644 --- a/client/src/SetupPage/index.jsx +++ b/client/src/SetupPage/index.jsx @@ -105,6 +105,15 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat setTab("datatype"); }, []); + useEffect(() => { + const hasLabels = configuration.labels.length > 0; + if(hasLabels) { + const newSettings = {...settings, showLab: true} + settingsConfig.changeSetting('settings',newSettings); + showAnnotationLab() + } + }, [setShowLabel]); + useEffect(() => { const { labels } = configuration if (labels.length > 0) { @@ -116,7 +125,8 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat const hasLabels = configuration.labels.length > 0; setShowLabel(hasLabels) if(hasLabels) { - settingsConfig.changeSetting('settings',settings); + const newSettings = {...settings, showLab: true} + settingsConfig.changeSetting('settings',newSettings); showAnnotationLab() } } From d71209a8d9605cb0d1345a2f8f005f4c1b43caaf Mon Sep 17 00:00:00 2001 From: sumn2u Date: Mon, 1 Jul 2024 17:29:42 -0500 Subject: [PATCH 2/2] remove isSmallDevice prop --- client/src/workspace/Header/index.jsx | 6 +++--- client/src/workspace/HeaderButton/index.jsx | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/src/workspace/Header/index.jsx b/client/src/workspace/Header/index.jsx index 11787c7..2b673fe 100644 --- a/client/src/workspace/Header/index.jsx +++ b/client/src/workspace/Header/index.jsx @@ -18,8 +18,8 @@ const Container = styled("div")(({ theme }) => ({ boxSizing: "border-box", })) -const BrandText = styled(Box)(({ theme, isSmallDevice }) => ({ - fontSize: isSmallDevice ? "1rem" : "1.5rem", +const BrandText = styled(Box)(({ theme }) => ({ + fontSize: useMediaQuery(theme.breakpoints.down('sm')) ? "1rem" : "1.5rem", marginLeft: "1rem", display: "flex", alignItems: "center", @@ -42,7 +42,7 @@ export const Header = ({ return ( - + {t("labname")} {!isSmallDevice && {leftSideContent}} diff --git a/client/src/workspace/HeaderButton/index.jsx b/client/src/workspace/HeaderButton/index.jsx index fd8a632..7f69f7e 100644 --- a/client/src/workspace/HeaderButton/index.jsx +++ b/client/src/workspace/HeaderButton/index.jsx @@ -19,10 +19,10 @@ const getIcon = (name, customIconMapping) => { return } -const StyledButton = styled(Button)(({ theme, isSmallDevice }) => ({ +const StyledButton = styled(Button)(({ theme }) => ({ textTransform: "none", - width: isSmallDevice ? 30: 60, - minWidth: isSmallDevice ? 32: 64, + width: useMediaQuery(theme.breakpoints.down('sm')) ? 30: 60, + minWidth: useMediaQuery(theme.breakpoints.down('sm')) ? 32: 64, paddingTop: 8, paddingBottom: 4, marginLeft: 1, @@ -64,7 +64,7 @@ export const HeaderButton = ({ return ( - + {icon || getIcon(name, customIconMapping)}