From 2e7b736a0bb4706252187cc2c37cdfd31a11144f Mon Sep 17 00:00:00 2001 From: tschumpr Date: Wed, 4 Sep 2024 16:39:02 +0200 Subject: [PATCH] Remove default margin --- src/client/src/AppTheme.ts | 1 - .../src/components/dataCard/dataCard.jsx | 2 +- src/client/src/pages/detail/detailHeader.tsx | 15 +++---- .../infoCheckBox/infoCheckBox.jsx | 40 +++++++++++++------ 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/client/src/AppTheme.ts b/src/client/src/AppTheme.ts index af91489c4..3a16fada6 100644 --- a/src/client/src/AppTheme.ts +++ b/src/client/src/AppTheme.ts @@ -111,7 +111,6 @@ export const theme = createTheme({ textTransform: "none", whiteSpace: "nowrap", minWidth: "auto", - marginLeft: "5px", padding: "8px 12px", borderRadius: "4px", boxShadow: "none", diff --git a/src/client/src/components/dataCard/dataCard.jsx b/src/client/src/components/dataCard/dataCard.jsx index f7dbdef80..4aeb4de5b 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/pages/detail/detailHeader.tsx b/src/client/src/pages/detail/detailHeader.tsx index 153809213..5d5b54a8e 100644 --- a/src/client/src/pages/detail/detailHeader.tsx +++ b/src/client/src/pages/detail/detailHeader.tsx @@ -84,9 +84,9 @@ const DetailHeader = ({ editingEnabled, setEditingEnabled, editableByCurrentUser icon={borehole?.data.workflow?.finished != null ? :
} /> - {editableByCurrentUser && ( - <> - {editingEnabled && ( + {editableByCurrentUser && + (editingEnabled ? ( + <> @@ -105,10 +105,11 @@ const DetailHeader = ({ editingEnabled, setEditingEnabled, editableByCurrentUser ]) } /> - )} - {editingEnabled ? : } - - )} + + + ) : ( + + ))} ); }; 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 e0bcecbe7..1091c1957 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 @@ -1,12 +1,16 @@ import * as Styled from "./styles.js"; -import { Checkbox, Popup } from "semantic-ui-react"; +import { Checkbox } from "semantic-ui-react"; import { copyStratigraphy, deleteStratigraphy } from "../../../../../../../api/fetchApiV2.js"; import { useTranslation } from "react-i18next"; import { CopyButton, DeleteButton } from "../../../../../../../components/buttons/buttons"; +import { PromptContext } from "../../../../../../../components/prompt/promptContext"; +import { useContext } from "react"; +import TrashIcon from "../../../../../../../assets/icons/trash.svg?react"; const InfoCheckBox = props => { const { profileInfo, updateChange, isEditable, onUpdated } = props.data; const { t } = useTranslation(); + const { showPrompt } = useContext(PromptContext); return ( @@ -31,18 +35,28 @@ const InfoCheckBox = props => { onUpdated("cloneStratigraphy"); }); }}> - }> - {t("deleteForever")}? -
- { - deleteStratigraphy(profileInfo?.id).then(() => { - onUpdated("deleteStratigraphy"); - }); - }} - /> -
+ { + showPrompt(t("deleteMessage"), [ + { + label: t("cancel"), + action: null, + }, + { + label: t("delete"), + icon: , + variant: "contained", + action: () => { + deleteStratigraphy(profileInfo?.id).then(() => { + onUpdated("deleteStratigraphy"); + }); + }, + }, + ]); + }} + sx={{ marginLeft: "5px" }} + />
)}