From dc0e93f9210d62b241859e4e86d673e69e6c59fb Mon Sep 17 00:00:00 2001 From: MiraGeowerkstatt Date: Thu, 5 Sep 2024 11:07:15 +0200 Subject: [PATCH 1/8] Complete button styles and fix table buttons --- src/client/src/AppTheme.ts | 125 +++++++++++++----- src/client/src/components/buttons/buttons.tsx | 11 +- .../overview/boreholeTable/bottomBar.tsx | 5 +- 3 files changed, 105 insertions(+), 36 deletions(-) diff --git a/src/client/src/AppTheme.ts b/src/client/src/AppTheme.ts index 99a8e7225..6cf12b8d7 100644 --- a/src/client/src/AppTheme.ts +++ b/src/client/src/AppTheme.ts @@ -125,43 +125,100 @@ export const theme = createTheme({ "&:hover": { boxShadow: "none", }, - }, - contained: { - backgroundColor: "#337083", - "&:hover": { - backgroundColor: "#295969", - }, "&:focus-visible": { - backgroundColor: "#295969", boxShadow: "0px 0px 0px 3px #8655F6", }, - "&:active": { - backgroundColor: "#1F444F", - }, - "&:disabled": { - backgroundColor: "#C1D3D9", - }, - }, - outlined: { - color: "#337083", - backgroundColor: "#FFFFFF", - "&:hover": { - color: "#295969", - backgroundColor: "#D6E2E6", - }, - "&:focus-visible": { - color: "#295969", - backgroundColor: "#D6E2E6", - boxShadow: "0px 0px 0px 3px #8655F6", - }, - "&:active": { - color: "#1F444F", - backgroundColor: "#ADC6CD", - }, - "&:disabled": { - backgroundColor: "#FFFFFF", - color: "#C1D3D9", - }, + variants: [ + { + props: { variant: "contained", color: "primary" }, + style: { + backgroundColor: "#337083", + "&:hover": { + backgroundColor: "#295969", + }, + "&:focus-visible": { + backgroundColor: "#295969", + }, + "&:active": { + backgroundColor: "#1F444F", + }, + "&:disabled": { + backgroundColor: "#C1D3D9", + }, + }, + }, + { + props: { variant: "outlined", color: "primary" }, + style: { + color: "#337083", + backgroundColor: "#FFFFFF", + "&:hover": { + color: "#295969", + backgroundColor: "#D6E2E6", + }, + "&:focus-visible": { + color: "#295969", + backgroundColor: "#D6E2E6", + }, + "&:active": { + color: "#1F444F", + backgroundColor: "#ADC6CD", + }, + "&:disabled": { + backgroundColor: "#FFFFFF", + }, + }, + }, + { + props: { variant: "outlined", color: "secondary" }, + style: { + backgroundColor: "rgba(0,0,0,0)", + color: "#337083", + borderColor: "#337083", + "&:hover": { + color: "#2F4356", + backgroundColor: "#D6E2E6", + borderColor: "#2F4356", + }, + "&:focus-visible": { + color: "#295969", + backgroundColor: "#D6E2E6", + borderColor: "#295969", + }, + "&:active": { + color: "#1F444F", + backgroundColor: "#ADC6CD", + borderColor: "#1F444F", + }, + "&:disabled": { + backgroundColor: "#FFFFFF", + borderColor: "#FFFFFF", + }, + }, + }, + { + props: { variant: "text", color: "secondary" }, + style: { + backgroundColor: "rgba(0,0,0,0)", + color: "#337083", + "&:hover": { + color: "#2F4356", + backgroundColor: "#D6E2E6", + }, + "&:focus-visible": { + color: "#295969", + backgroundColor: "#D6E2E6", + }, + "&:active": { + color: "#1F444F", + backgroundColor: "#ADC6CD", + }, + "&:disabled": { + backgroundColor: "rgba(0,0,0,0)", + }, + }, + }, + ], }, }, }, diff --git a/src/client/src/components/buttons/buttons.tsx b/src/client/src/components/buttons/buttons.tsx index bcb5810ee..4ab92633e 100644 --- a/src/client/src/components/buttons/buttons.tsx +++ b/src/client/src/components/buttons/buttons.tsx @@ -43,6 +43,7 @@ export const BulkEditButton = forwardRef((props, {...props} label="bulkEditing" variant={props.variant ?? "outlined"} + color="secondary" icon={} /> ); @@ -79,5 +80,13 @@ export const AcceptButton = forwardRef((props, r }); export const DeleteButton = forwardRef((props, ref) => { - return } />; + return ( + } + /> + ); }); diff --git a/src/client/src/pages/overview/boreholeTable/bottomBar.tsx b/src/client/src/pages/overview/boreholeTable/bottomBar.tsx index 3d9e9b373..4054498d3 100644 --- a/src/client/src/pages/overview/boreholeTable/bottomBar.tsx +++ b/src/client/src/pages/overview/boreholeTable/bottomBar.tsx @@ -92,6 +92,7 @@ const BottomBar = ({ showPrompt(t("deleteBoreholesMessage", { count: selectionModel.length }), [ { @@ -106,7 +107,9 @@ const BottomBar = ({ ]) } /> - {selectionModel.length === 1 && showCopyPromptForSelectedWorkgroup()} />} + {selectionModel.length === 1 && ( + showCopyPromptForSelectedWorkgroup()} /> + )} {t("selectedCount", { count: selectionModel.length })} From 737d52c8e6866934e84cdcebe89bbd640b576835 Mon Sep 17 00:00:00 2001 From: MiraGeowerkstatt Date: Thu, 5 Sep 2024 11:08:12 +0200 Subject: [PATCH 2/8] Use Mui spacing system for buttons --- .../src/components/dataCard/dataCard.jsx | 2 +- .../multiple/multipleForm.jsx | 9 ++-- src/client/src/pages/detail/detailHeader.tsx | 52 ++++++++++--------- .../detail/form/completion/completion.jsx | 1 - .../infoCheckBox/infoCheckBox.jsx | 6 +-- 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/client/src/components/dataCard/dataCard.jsx b/src/client/src/components/dataCard/dataCard.jsx index 4aeb4de5b..de4f454b4 100644 --- a/src/client/src/components/dataCard/dataCard.jsx +++ b/src/client/src/components/dataCard/dataCard.jsx @@ -62,7 +62,7 @@ export const DataCardButtonContainer = forwardRef((props, ref) => { marginTop: "15px", marginRight: "10px", }}> - + {props.children} diff --git a/src/client/src/components/legacyComponents/multiple/multipleForm.jsx b/src/client/src/components/legacyComponents/multiple/multipleForm.jsx index 600edf4c7..3c65c7edf 100644 --- a/src/client/src/components/legacyComponents/multiple/multipleForm.jsx +++ b/src/client/src/components/legacyComponents/multiple/multipleForm.jsx @@ -4,7 +4,7 @@ import { connect } from "react-redux"; import { withTranslation } from "react-i18next"; import _ from "lodash"; import { produce } from "immer"; -import { FormControl, FormControlLabel, Radio, RadioGroup } from "@mui/material"; +import { FormControl, FormControlLabel, Radio, RadioGroup, Stack } from "@mui/material"; import DomainDropdown from "../domain/dropdown/domainDropdown.jsx"; import DomainTree from "../domain/tree/domainTree.jsx"; import DateField from "../dateField.jsx"; @@ -386,10 +386,7 @@ class MultipleForm extends React.Component { {this.getDomain("chronostratigraphy_top_bedrock", "custom.chronostratigraphy_top_bedrock")} -
+ { this.props.undo(); @@ -401,7 +398,7 @@ class MultipleForm extends React.Component { this.save(); }} /> -
+
); } diff --git a/src/client/src/pages/detail/detailHeader.tsx b/src/client/src/pages/detail/detailHeader.tsx index 5d5b54a8e..562d0adfa 100644 --- a/src/client/src/pages/detail/detailHeader.tsx +++ b/src/client/src/pages/detail/detailHeader.tsx @@ -84,32 +84,34 @@ const DetailHeader = ({ editingEnabled, setEditingEnabled, editableByCurrentUser icon={borehole?.data.workflow?.finished != null ? :
} /> - {editableByCurrentUser && - (editingEnabled ? ( - <> - - showPrompt(t("deleteBoreholesMessage", { count: 1 }), [ - { - label: t("cancel"), - }, - { - label: t("delete"), - icon: , - variant: "contained", - action: () => { - handleDelete(); + + {editableByCurrentUser && + (editingEnabled ? ( + <> + + showPrompt(t("deleteBoreholesMessage", { count: 1 }), [ + { + label: t("cancel"), }, - }, - ]) - } - /> - - - ) : ( - - ))} + { + label: t("delete"), + icon: , + variant: "contained", + action: () => { + handleDelete(); + }, + }, + ]) + } + /> + + + ) : ( + + ))} + ); }; diff --git a/src/client/src/pages/detail/form/completion/completion.jsx b/src/client/src/pages/detail/form/completion/completion.jsx index 571115c57..b006fd7a4 100644 --- a/src/client/src/pages/detail/form/completion/completion.jsx +++ b/src/client/src/pages/detail/form/completion/completion.jsx @@ -330,7 +330,6 @@ const Completion = props => { {isEditable && ( { handleCompletionChanged(e, -1); diff --git a/src/client/src/pages/detail/form/stratigraphy/lithology/lithologyInfo/infoCheckBox/infoCheckBox.jsx b/src/client/src/pages/detail/form/stratigraphy/lithology/lithologyInfo/infoCheckBox/infoCheckBox.jsx index 1091c1957..1e443434b 100644 --- a/src/client/src/pages/detail/form/stratigraphy/lithology/lithologyInfo/infoCheckBox/infoCheckBox.jsx +++ b/src/client/src/pages/detail/form/stratigraphy/lithology/lithologyInfo/infoCheckBox/infoCheckBox.jsx @@ -6,6 +6,7 @@ import { CopyButton, DeleteButton } from "../../../../../../../components/button import { PromptContext } from "../../../../../../../components/prompt/promptContext"; import { useContext } from "react"; import TrashIcon from "../../../../../../../assets/icons/trash.svg?react"; +import { Stack } from "@mui/material"; const InfoCheckBox = props => { const { profileInfo, updateChange, isEditable, onUpdated } = props.data; @@ -28,7 +29,7 @@ const InfoCheckBox = props => { {t("mainStratigraphy")} {isEditable && ( -
+ { copyStratigraphy(profileInfo?.id).then(() => { @@ -55,9 +56,8 @@ const InfoCheckBox = props => { }, ]); }} - sx={{ marginLeft: "5px" }} /> -
+ )} ); From 74b2cc752d09be9d5df61e7dfb64aa3be9233b7f Mon Sep 17 00:00:00 2001 From: MiraGeowerkstatt Date: Thu, 5 Sep 2024 12:00:02 +0200 Subject: [PATCH 3/8] Add button variant --- src/client/src/AppTheme.ts | 22 +++++++++++++++++++ .../overview/boreholeTable/bottomBar.tsx | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/client/src/AppTheme.ts b/src/client/src/AppTheme.ts index 6cf12b8d7..6bae85b36 100644 --- a/src/client/src/AppTheme.ts +++ b/src/client/src/AppTheme.ts @@ -196,6 +196,28 @@ export const theme = createTheme({ }, }, }, + { + props: { variant: "text", color: "primary" }, + style: { + backgroundColor: "#FFFFFF", + color: "#337083", + "&:hover": { + color: "#2F4356", + backgroundColor: "#D6E2E6", + }, + "&:focus-visible": { + color: "#295969", + backgroundColor: "#D6E2E6", + }, + "&:active": { + color: "#1F444F", + backgroundColor: "#ADC6CD", + }, + "&:disabled": { + backgroundColor: "#FFFFFF", + }, + }, + }, { props: { variant: "text", color: "secondary" }, style: { diff --git a/src/client/src/pages/overview/boreholeTable/bottomBar.tsx b/src/client/src/pages/overview/boreholeTable/bottomBar.tsx index 4054498d3..a19bf66ca 100644 --- a/src/client/src/pages/overview/boreholeTable/bottomBar.tsx +++ b/src/client/src/pages/overview/boreholeTable/bottomBar.tsx @@ -118,6 +118,8 @@ const BottomBar = ({ )}