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

design fixes in image upload section #127

Merged
merged 1 commit into from
Jul 6, 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
6 changes: 6 additions & 0 deletions client/src/ImageUpload/ImageUpload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ jest.mock('react-i18next', () => ({
"error.server_connection": "Server connection error",
}[key]),
}),
Trans: ({ i18nKey, values }) => {
const translations = {
"configuration.image_upload.description": `Upload images to be annotated, or drag and drop images here. Files supported: <strong>.jpg, .jpeg, .png</strong> and max number of images: <strong>${values.maxImages}</strong>`,
};
return <span dangerouslySetInnerHTML={{ __html: translations[i18nKey] }} />;
},
}));


Expand Down
4 changes: 2 additions & 2 deletions client/src/ImageUpload/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Box, Typography, IconButton } from '@mui/material';
import DeleteIcon from '@mui/icons-material/Delete';
import axios from 'axios';
import { useSnackbar } from '../SnackbarContext';
import { useTranslation } from "react-i18next";
import { useTranslation, Trans } from "react-i18next";
import useMediaQuery from '@mui/material/useMediaQuery';
import config from '../config.js';

Expand Down Expand Up @@ -177,7 +177,7 @@ const ImageUpload = ({ onImageUpload, settingsImages }) => {
</>
) : (
<Typography sx={{ fontSize: "14px", color: "rgb(117, 117, 117)" }}>
{t("configuration.image_upload.description")} {config.UPLOAD_LIMIT}
<Trans i18nKey="configuration.image_upload.description" values={{maxImages: config.UPLOAD_LIMIT}}/>
</Typography>
)}
</>
Expand Down
4 changes: 2 additions & 2 deletions client/src/Localization/translation-de-DE.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ const translationDeDE = {
"configuration.region_types_allowed": "Erlaubte Regionstypen",
"configuration.region_types_allowed.description": "Welche Arten von Regionen können auf dem Bild gezeichnet werden.",
"configuration.labels": "Verfügbare Labels",
"configuration.labels.option.id": "ID",
"configuration.labels.option.id": "Id",
"configuration.labels.option.description": "Beschreibung (optional)",
"configuration.labels.description": "Wenn Sie Regionen auf einem Bild kennzeichnen, sind dies die zulässigen Klassifikationen oder Tags.",
"configuration.regions": "Standard-Regionstyp",
"configuration.regions.description": "Wählen Sie den Standard-Regionstyp, der auf dem Bild gezeichnet werden kann.",
"error.configuration.image_upload.max": "Maximale Anzahl von Bildern erreicht",
"configuration.image_upload.description": "Laden Sie Bilder hoch, die annotiert werden sollen, oder ziehen Sie Bilder hierher. Unterstützte Dateien: .jpg, .jpeg, .png und maximale Anzahl von Bildern:",
"configuration.image_upload.description": "Laden Sie Bilder hoch, die annotiert werden sollen, oder ziehen Sie Bilder hierher. Unterstützte Dateien: <strong>.jpg, .jpeg, .png</strong> und maximale Anzahl von Bildern: <strong>{{maxImages}}</strong>",
"configuration.image_upload.file_drop": "Dateien hierher ziehen",
"download.configuration": "Konfiguration",
"download.image_mask": "Maskiertes Bild",
Expand Down
4 changes: 2 additions & 2 deletions client/src/Localization/translation-en-EN.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ const translationEnEN = {
"configuration.region_types_allowed": "Region Types Allowed",
"configuration.region_types_allowed.description": "What types of regions can be drawn on the image.",
"configuration.labels": "Available Labels",
"configuration.labels.option.id": "id",
"configuration.labels.option.id": "Id",
"configuration.labels.option.description": "Description (optional)",
"configuration.labels.description": "If you're labeling regions on an image, these are the allowed classifications or tags.",
"configuration.regions": "Default Region Type",
"configuration.regions.description": "Choose default region type that can be drawn on the image.",
"error.configuration.image_upload.max": "Maximum number of images reached",
"configuration.image_upload.description": "Upload images to be annotated, or drag and drop images here. Files supported: .jpg, .jpeg, .png and max number of images:",
"configuration.image_upload.description": "Upload images to be annotated, or drag and drop images here. Files supported: <strong>.jpg, .jpeg, .png</strong> and max number of images: <strong>{{maxImages}}</strong>",
"configuration.image_upload.file_drop": "Drop files here",
"download.configuration": "Configuration",
"download.image_mask": "Masked Image",
Expand Down
19 changes: 14 additions & 5 deletions client/src/SetupPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
</Tabs>
</Box>
{currentTab === "datatype" && (
<Box minWidth="55vw" paddingTop={"2rem"}>
<Box minWidth="55vw" paddingTop={"1rem"}>
<>
<ConfigurationTask config={settings} onChange={updateTaskInfo} />
<NoteSection
icon={Info}
Expand All @@ -165,11 +166,12 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
{t("btn.next")}
</Button>
</Box>
</>
</Box>
)}

{currentTab === "configure" && (
<Container>
<Box minWidth="55vw" paddingTop={"1rem"}>
{settings.taskChoice === "image_classification" && (
<>
<ConfigureImageClassification config={settings.configuration} onChange={updateConfiguration} />
Expand All @@ -192,12 +194,19 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat
</>

)}
</Container>
</Box>
)}
{currentTab === "images" && (
<>
<Box sx={{ padding: '2rem' }} width={isSmallDevice ? "auto" : "55vw"}>
<Typography gutterBottom sx={{ fontWeight: 'bold', color: 'rgb(66, 66, 66)', fontSize: '18px' }}>
<Box sx={(theme) => ({
paddingTop: isSmallDevice ? '0' : '0.5rem',
padding: isSmallDevice ? '1.5rem' : '1rem',
[theme.breakpoints.down('sm')]: {
padding: '1rem',
},
})}
width={isSmallDevice ? "auto" : "55vw"}>
<Typography gutterBottom sx={{ fontWeight: 'bold', color: 'rgb(66, 66, 66)', fontSize: '18px', paddingBottom: '1rem', paddingTop: '0.5rem'}}>
{t("btn.upload_images")}
</Typography>
<ImageUpload onImageUpload={handleImageUpload} settingsImages={settings.images} />
Expand Down
Loading