Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support close action from setup page #133

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions client/src/Annotation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,12 @@ export default () => {
}
}

const showAnnotationLab = () => {
preloadConfiguration();
const showAnnotationLab = (newSettings) => {
setSettings(newSettings);
const lastSavedImageIndex = newSettings.lastSavedImageIndex || 0;
if (newSettings.images.length > 0) {
fetchImages(newSettings.images, lastSavedImageIndex);
}
}
useEffect(() => {
preloadConfiguration();
Expand Down
19 changes: 17 additions & 2 deletions client/src/SetupPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React, { useState } from "react";
import Card from '@mui/material/Card';
import CardContent from '@mui/material/CardContent';
import Typography from '@mui/material/Typography';
import IconButton from '@mui/material/IconButton';
import PropTypes from "prop-types"
import ConfigureImageClassification from "../ConfigureImageClassification";
import ConfigureImageSegmentation from "../ConfigureImageSegmentation";
Expand All @@ -20,6 +21,7 @@ import { useSettings } from "../SettingsProvider";
import { useTranslation } from "react-i18next"
import { Info } from '@mui/icons-material';
import NoteSection from "../NoteSection";
import CloseIcon from "@mui/icons-material/Close";
import useMediaQuery from '@mui/material/useMediaQuery';
import config from '../config.js';

Expand Down Expand Up @@ -60,6 +62,7 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
const [hasConfig, setHasConfig] = useState(false);
const settingsConfig = useSettings()
const isSmallDevice = useMediaQuery(theme.breakpoints.down('sm'));
const isLargeDevice = useMediaQuery(theme.breakpoints.up('md'));

const updateConfiguration = (newConfig) => {
const {labels, regionTypesAllowed, multipleRegionLabels, multipleRegions} = newConfig
Expand Down Expand Up @@ -113,7 +116,7 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
if(hasLabels) {
const newSettings = {...settings, showLab: true}
settingsConfig.changeSetting('settings',newSettings);
showAnnotationLab()
showAnnotationLab(newSettings)
}
}, [setShowLabel]);

Expand All @@ -130,7 +133,7 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
if(hasLabels) {
const newSettings = {...settings, showLab: true}
settingsConfig.changeSetting('settings',newSettings);
showAnnotationLab()
showAnnotationLab(newSettings)
}
}

Expand All @@ -141,6 +144,7 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
const isTaskInfoComplete = settings.taskDescription.trim().length > 0;
const isConfigComplete = settings.configuration.labels.length > 0;
const isImagesUploaded = settings.images.length > 0;
const hasShowLab = settings.showLab;

return (
<Box display="flex" justifyContent="center" minHeight="100vh" marginTop={isSmallDevice ? "": "5rem"}>
Expand All @@ -152,6 +156,17 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
<Tab disabled={!isConfigComplete} icon={<AddPhotoAlternateIcon />} label={t("setup.tabs.images")} value="images" />
</Tabs>
</Box>
<IconButton
disabled={!isTaskInfoComplete || !isConfigComplete || !isImagesUploaded}
onClick={showLab}
sx={{
position: 'absolute',
top: isLargeDevice ? '2rem' : '1rem',
right: isLargeDevice ? '10rem' : '1rem',
fontSize: isLargeDevice ? '2rem' : '1.5rem'
}}>
{hasShowLab && hasConfig && <CloseIcon fontSize={isLargeDevice ? "large" : "medium"} />}
</IconButton>
{currentTab === "datatype" && (
<Box minWidth="55vw" paddingTop={"1rem"}>
<>
Expand Down
Loading