Skip to content

Commit

Permalink
feat(bc): change buttons layout
Browse files Browse the repository at this point in the history
  • Loading branch information
hdinia committed Mar 27, 2024
1 parent 4016508 commit 266f2d0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 39 deletions.
3 changes: 2 additions & 1 deletion webapp/public/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"global.versions": "Versions",
"global.reset": "Reset",
"global.delete": "Delete",
"global.delete.all": "Delete all",
"global.view": "View",
"global.archive": "Archive",
"global.unarchive": "Unarchive",
Expand Down Expand Up @@ -71,6 +72,7 @@
"global.time.weekly": "Weekly",
"global.time.monthly": "Monthly",
"global.time.annual": "Annual",
"global.update.success": "Update successful",
"global.errorLogs": "Error logs",
"global.error.emptyName": "Name cannot be empty",
"global.error.failedtoretrievejobs": "Failed to retrieve job information",
Expand Down Expand Up @@ -500,7 +502,6 @@
"study.modelization.bindingConst.timeSeries.greater": "Greater",
"study.modelization.bindingConst.newConstraintTerm": "New constraint term",
"study.modelization.bindingConst.createConstraintTerm": "Add constraint term",
"study.modelization.bindingConst.deleteConstraint": "Delete Constraint",
"study.modelization.bindingConst.weight": "Weight",
"study.modelization.bindingConst.offset": "Offset",
"study.modelization.bindingConst.question.deleteConstraintTerm": "Are you sure you want to delete this constraint term?",
Expand Down
3 changes: 2 additions & 1 deletion webapp/public/locales/fr/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"global.versions": "Versions",
"global.reset": "Réinitialiser",
"global.delete": "Supprimer",
"global.delete.all": "Supprimer tout",
"global.view": "Voir",
"global.archive": "Archiver",
"global.unarchive": "Désarchiver",
Expand Down Expand Up @@ -71,6 +72,7 @@
"global.time.weekly": "Hebdomadaire",
"global.time.monthly": "Mensuel",
"global.time.annual": "Annuel",
"global.update.success": "Mise à jour réussie",
"global.errorLogs": "Logs d'erreurs",
"global.error.emptyName": "Le nom ne peut pas être vide",
"global.error.failedtoretrievejobs": "Échec de la récupération des tâches",
Expand Down Expand Up @@ -500,7 +502,6 @@
"study.modelization.bindingConst.timeSeries.greater": "Supérieur",
"study.modelization.bindingConst.newConstraintTerm": "Nouveau terme",
"study.modelization.bindingConst.createConstraintTerm": "Ajouter un terme",
"study.modelization.bindingConst.deleteConstraint": "Supprimer contrainte",
"study.modelization.bindingConst.weight": "Poids",
"study.modelization.bindingConst.offset": "Décalage",
"study.modelization.bindingConst.question.deleteConstraintTerm": "Êtes-vous sûr de vouloir supprimer ce terme ?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function BindingConstForm({ study, options, constraintId }: Props) {

update(index, updatedTerm);

enqueueSnackbar("Constraint term updated", {
enqueueSnackbar(t("global.update.success"), {
variant: "success",
autoHideDuration: 1500,
});
Expand Down Expand Up @@ -134,14 +134,14 @@ function BindingConstForm({ study, options, constraintId }: Props) {
},
]);

enqueueSnackbar(t("study.success.deleteConstraint"), {
variant: "success",
autoHideDuration: 3000,
});

dispatch(setCurrentBindingConst(""));

navigate(`/studies/${study.id}/explore/modelization/bindingcontraint`);

enqueueSnackbar(t("study.success.deleteConstraint"), {
variant: "success",
autoHideDuration: 1500,
});
} catch (e) {
enqueueErrorSnackbar(t("study.error.deleteConstraint"), e as AxiosError);
} finally {
Expand All @@ -161,34 +161,39 @@ function BindingConstForm({ study, options, constraintId }: Props) {
>
<TermsList>
<TermsHeader>
<Button
variant="contained"
size="small"
color="secondary"
startIcon={<DatasetIcon />}
onClick={() => setMatrixDialogOpen(true)}
>
{t("study.modelization.bindingConst.timeSeries")}
</Button>
<Button
variant="contained"
size="small"
color="primary"
startIcon={<AddCircleOutlineRoundedIcon />}
onClick={() => setOpenConstraintTermDialog(true)}
>
{t("study.modelization.bindingConst.createConstraintTerm")}
</Button>
<Button
variant="outlined"
size="small"
startIcon={<DeleteIcon />}
color="error"
onClick={() => setConstraintToDelete(true)}
>
{t("study.modelization.bindingConst.deleteConstraint")}
</Button>
<DocLink to={`${ACTIVE_WINDOWS_DOC_PATH}#binding-constraints`} />
<Box>
<Button
variant="contained"
size="small"
color="secondary"
startIcon={<DatasetIcon />}
onClick={() => setMatrixDialogOpen(true)}
sx={{ mr: 2 }}
>
{t("study.modelization.bindingConst.timeSeries")}
</Button>
<Button
variant="contained"
size="small"
color="primary"
startIcon={<AddCircleOutlineRoundedIcon />}
onClick={() => setOpenConstraintTermDialog(true)}
>
{t("study.modelization.bindingConst.createConstraintTerm")}
</Button>
</Box>
<Box>
<Button
variant="outlined"
size="small"
startIcon={<DeleteIcon />}
color="error"
onClick={() => setConstraintToDelete(true)}
>
{t("global.delete.all")}
</Button>
<DocLink to={`${ACTIVE_WINDOWS_DOC_PATH}#binding-constraints`} />
</Box>
</TermsHeader>

{constraintTerms.map((term: ConstraintTerm, index: number) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export const TermsList = styled(Box)(({ theme }) => ({
export const TermsHeader = styled(Box)(({ theme }) => ({
width: "100%",
display: "flex",
gap: 15,
alignItems: "center",
justifyContent: "flex-end",
marginBottom: theme.spacing(1),
justifyContent: "space-between",
marginBottom: theme.spacing(2),
}));

0 comments on commit 266f2d0

Please sign in to comment.