From 8f1dff839b4dde1b51dc0e95571957cd558b5462 Mon Sep 17 00:00:00 2001 From: MiraGeowerkstatt Date: Wed, 7 Aug 2024 08:30:28 +0200 Subject: [PATCH 1/4] Mover HeaderComponent to App.tsx --- src/client/src/App.tsx | 49 ++++++++++--------- src/client/src/components/styledComponents.js | 6 +++ .../src/pages/overview/overviewPage.jsx | 14 +----- .../src/pages/settings/settingsPage.jsx | 2 - 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/client/src/App.tsx b/src/client/src/App.tsx index 088461255..6e6efeca6 100644 --- a/src/client/src/App.tsx +++ b/src/client/src/App.tsx @@ -15,6 +15,8 @@ import { PromptProvider } from "./components/prompt/promptContext.tsx"; import { Prompt } from "./components/prompt/prompt.tsx"; import { BasemapProvider } from "./components/basemapSelector/basemapContext.tsx"; import { FilterProvider } from "./pages/overview/sidePanelContent/filter/filterContext.tsx"; +import HeaderComponent from "./components/header/headerComponent.tsx"; +import { AppBox } from "./components/styledComponents"; const queryClient = new QueryClient(); @@ -48,28 +50,31 @@ class App extends React.Component { - - - } key={1} path={"/setting"} /> - { - return ; - }} - exact={false} - key={0} - path={"/"} - /> - ( - - )} - /> - - + + + + + } key={1} path={"/setting"} /> + { + return ; + }} + exact={false} + key={0} + path={"/"} + /> + ( + + )} + /> + + + diff --git a/src/client/src/components/styledComponents.js b/src/client/src/components/styledComponents.js index d24018b6e..98821c73e 100644 --- a/src/client/src/components/styledComponents.js +++ b/src/client/src/components/styledComponents.js @@ -24,6 +24,12 @@ export const TypographyWithBottomMargin = styled(Typography)(() => ({ marginBottom: "1em", })); +export const AppBox = styled(Box)({ + display: "flex", + flexDirection: "column", + height: "100%", +}); + export const LayoutBox = styled(Box)({ flex: "1 1 100%", display: "flex", flexDirection: "row", overflow: "hidden" }); export const SidebarBox = styled(Box)(() => ({ diff --git a/src/client/src/pages/overview/overviewPage.jsx b/src/client/src/pages/overview/overviewPage.jsx index 7142e9bf5..5c4357775 100644 --- a/src/client/src/pages/overview/overviewPage.jsx +++ b/src/client/src/pages/overview/overviewPage.jsx @@ -9,19 +9,10 @@ import { DrawerContentTypes } from "./overviewPageInterfaces.ts"; import { AlertContext } from "../../components/alert/alertContext.tsx"; import CustomLayersPanel from "./sidePanelContent/customLayers/customLayersPanel.jsx"; import { LayoutBox, MainContentBox, SidebarBox } from "../../components/styledComponents.js"; -import HeaderComponent from "../../components/header/headerComponent"; import DetailHeader from "../detail/detailHeader"; -import { styled } from "@mui/material/styles"; -import { Box } from "@mui/material"; import DetailSideNav from "../detail/detailSideNav"; import BoreholeForm from "../detail/form/borehole/boreholeForm"; -const AppBox = styled(Box)({ - display: "flex", - flexDirection: "column", - height: "100%", -}); - const OverviewPage = props => { const [sort, setSort] = useState(null); const [sideDrawerOpen, setSideDrawerOpen] = useState(false); @@ -59,8 +50,7 @@ const OverviewPage = props => { }, [location.pathname]); return ( - - + <> } /> @@ -107,7 +97,7 @@ const OverviewPage = props => { - + ); }; diff --git a/src/client/src/pages/settings/settingsPage.jsx b/src/client/src/pages/settings/settingsPage.jsx index 2f53a917f..98ab829a2 100644 --- a/src/client/src/pages/settings/settingsPage.jsx +++ b/src/client/src/pages/settings/settingsPage.jsx @@ -1,7 +1,6 @@ import { withTranslation } from "react-i18next"; import { Route, Switch, withRouter } from "react-router-dom"; import MenuSettings from "./menuSettings"; -import HeaderComponent from "../../components/header/headerComponent.tsx"; import EditorSettings from "./editorSettings"; import AdminSettings from "./admin/adminSettings"; import AboutSettings from "./aboutSettings"; @@ -16,7 +15,6 @@ const SettingsPage = () => { flexDirection: "column", height: "100%", }}> -
Date: Wed, 7 Aug 2024 08:41:18 +0200 Subject: [PATCH 2/4] Restructure routing on overview page --- src/client/src/App.tsx | 8 +- src/client/src/pages/detail/detailPage.tsx | 2 +- ...boreholeForm.jsx => detailPageContent.jsx} | 44 +++++----- .../src/pages/overview/overviewPage.jsx | 80 +++++++------------ 4 files changed, 56 insertions(+), 78 deletions(-) rename src/client/src/pages/detail/{form/borehole/boreholeForm.jsx => detailPageContent.jsx} (90%) diff --git a/src/client/src/App.tsx b/src/client/src/App.tsx index 6e6efeca6..936bc7bc6 100644 --- a/src/client/src/App.tsx +++ b/src/client/src/App.tsx @@ -5,7 +5,7 @@ import { ReactQueryDevtools } from "react-query/devtools"; import { ThemeProvider } from "@mui/material/styles"; import { theme } from "./AppTheme"; import OverviewPage from "./pages/overview/overviewPage"; -import SettingCmp from "./pages/settings/settingsPage"; +import SettingsPage from "./pages/settings/settingsPage"; import { DataLoader } from "./pages/settings/dataLoader"; import AcceptTerms from "./term/accept"; import { AlertProvider } from "./components/alert/alertContext"; @@ -17,6 +17,7 @@ import { BasemapProvider } from "./components/basemapSelector/basemapContext.tsx import { FilterProvider } from "./pages/overview/sidePanelContent/filter/filterContext.tsx"; import HeaderComponent from "./components/header/headerComponent.tsx"; import { AppBox } from "./components/styledComponents"; +import { DetailPage } from "./pages/detail/detailPage.tsx"; const queryClient = new QueryClient(); @@ -54,13 +55,14 @@ class App extends React.Component { - } key={1} path={"/setting"} /> + } key={0} path={"/setting"} /> + } /> { return ; }} exact={false} - key={0} + key={2} path={"/"} /> { diff --git a/src/client/src/pages/detail/form/borehole/boreholeForm.jsx b/src/client/src/pages/detail/detailPageContent.jsx similarity index 90% rename from src/client/src/pages/detail/form/borehole/boreholeForm.jsx rename to src/client/src/pages/detail/detailPageContent.jsx index c9e4ed9da..24880e321 100644 --- a/src/client/src/pages/detail/form/borehole/boreholeForm.jsx +++ b/src/client/src/pages/detail/detailPageContent.jsx @@ -4,28 +4,28 @@ import { connect } from "react-redux"; import { withTranslation } from "react-i18next"; import _ from "lodash"; import { Redirect, Route, Switch, withRouter } from "react-router-dom"; -import { loadBorehole, patchBorehole, updateBorehole } from "../../../../api-lib"; -import EditorBoreholeFilesTable from "../../attachments/table/editorBoreholeFilesTable.tsx"; -import TranslationText from "../../../../components/legacyComponents/translationText.jsx"; +import { loadBorehole, patchBorehole, updateBorehole } from "../../api-lib"; +import EditorBoreholeFilesTable from "./attachments/table/editorBoreholeFilesTable.tsx"; +import TranslationText from "../../components/legacyComponents/translationText.jsx"; import { Dimmer, Loader } from "semantic-ui-react"; -import Lithology from "../stratigraphy/lithology"; -import IdentifierSegment from "../location/indentifierSegment.jsx"; -import NameSegment from "../location/nameSegment.jsx"; -import RestrictionSegment from "../location/restrictionSegment.jsx"; -import BoreholePanel from "./boreholePanel.jsx"; -import LocationSegment from "../location/locationSegment.jsx"; -import WaterIngress from "../hydrogeology/waterIngress.jsx"; -import GroundwaterLevelMeasurement from "../hydrogeology/groundwaterLevelMeasurement.jsx"; -import Hydrotest from "../hydrogeology/hydrotest.jsx"; -import FieldMeasurement from "../hydrogeology/fieldMeasurement.jsx"; -import ChronostratigraphyPanel from "../stratigraphy/chronostratigraphy/chronostratigraphyPanel.jsx"; -import LithostratigraphyPanel from "../stratigraphy/lithostratigraphy/lithostratigraphyPanel.jsx"; -import Completion from "../completion/completion.jsx"; +import Lithology from "./form/stratigraphy/lithology"; +import IdentifierSegment from "./form/location/indentifierSegment.jsx"; +import NameSegment from "./form/location/nameSegment.jsx"; +import RestrictionSegment from "./form/location/restrictionSegment.jsx"; +import BoreholePanel from "./form/borehole/boreholePanel.jsx"; +import LocationSegment from "./form/location/locationSegment.jsx"; +import WaterIngress from "./form/hydrogeology/waterIngress.jsx"; +import GroundwaterLevelMeasurement from "./form/hydrogeology/groundwaterLevelMeasurement.jsx"; +import Hydrotest from "./form/hydrogeology/hydrotest.jsx"; +import FieldMeasurement from "./form/hydrogeology/fieldMeasurement.jsx"; +import ChronostratigraphyPanel from "./form/stratigraphy/chronostratigraphy/chronostratigraphyPanel.jsx"; +import LithostratigraphyPanel from "./form/stratigraphy/lithostratigraphy/lithostratigraphyPanel.jsx"; +import Completion from "./form/completion/completion.jsx"; import { Box } from "@mui/material"; -import WorkflowForm from "../workflow/workflowForm.jsx"; -import { AlertContext } from "../../../../components/alert/alertContext"; +import WorkflowForm from "./form/workflow/workflowForm.jsx"; +import { AlertContext } from "../../components/alert/alertContext"; -class BoreholeForm extends React.Component { +class DetailPageContent extends React.Component { static contextType = AlertContext; constructor(props) { @@ -417,7 +417,7 @@ class BoreholeForm extends React.Component { } } -BoreholeForm.propTypes = { +DetailPageContent.propTypes = { borehole: PropTypes.object, getBorehole: PropTypes.func, id: PropTypes.number, @@ -431,7 +431,7 @@ BoreholeForm.propTypes = { workflow: PropTypes.object, }; -BoreholeForm.defaultProps = { +DetailPageContent.defaultProps = { id: undefined, }; @@ -457,6 +457,6 @@ const mapDispatchToProps = dispatch => { }; const ConnectedBoreholeForm = withRouter( - connect(mapStateToProps, mapDispatchToProps)(withTranslation(["common"])(BoreholeForm)), + connect(mapStateToProps, mapDispatchToProps)(withTranslation(["common"])(DetailPageContent)), ); export default ConnectedBoreholeForm; diff --git a/src/client/src/pages/overview/overviewPage.jsx b/src/client/src/pages/overview/overviewPage.jsx index 5c4357775..d24ce2cd0 100644 --- a/src/client/src/pages/overview/overviewPage.jsx +++ b/src/client/src/pages/overview/overviewPage.jsx @@ -1,5 +1,5 @@ import { useContext, useEffect, useState } from "react"; -import { Route, Switch, useLocation, withRouter } from "react-router-dom"; +import { useLocation, withRouter } from "react-router-dom"; import MainSideNav from "./layout/mainSideNav.tsx"; import MapView from "./layout/mapView.jsx"; import { SideDrawer } from "./layout/sideDrawer.tsx"; @@ -9,9 +9,6 @@ import { DrawerContentTypes } from "./overviewPageInterfaces.ts"; import { AlertContext } from "../../components/alert/alertContext.tsx"; import CustomLayersPanel from "./sidePanelContent/customLayers/customLayersPanel.jsx"; import { LayoutBox, MainContentBox, SidebarBox } from "../../components/styledComponents.js"; -import DetailHeader from "../detail/detailHeader"; -import DetailSideNav from "../detail/detailSideNav"; -import BoreholeForm from "../detail/form/borehole/boreholeForm"; const OverviewPage = props => { const [sort, setSort] = useState(null); @@ -50,54 +47,33 @@ const OverviewPage = props => { }, [location.pathname]); return ( - <> - } /> - - - - ( - - )} - /> - - - - - - - ( - { - showAlert(message, "error"); - }} - /> - )} - /> - } /> - - - - + + + + + + + { + showAlert(message, "error"); + }} + /> + + ); }; From a41fcd70b81c2ab371866ae9f689e82644f86735 Mon Sep 17 00:00:00 2001 From: MiraGeowerkstatt Date: Wed, 7 Aug 2024 08:58:57 +0200 Subject: [PATCH 3/4] Fix sorting --- src/client/src/pages/overview/table/boreholeEditorTable.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/src/pages/overview/table/boreholeEditorTable.jsx b/src/client/src/pages/overview/table/boreholeEditorTable.jsx index ecabc04e9..d3d136cc1 100644 --- a/src/client/src/pages/overview/table/boreholeEditorTable.jsx +++ b/src/client/src/pages/overview/table/boreholeEditorTable.jsx @@ -42,9 +42,9 @@ class BoreholeEditorTable extends TTable { } componentDidMount() { - const { filter, store, sort } = this.props; + const { filter, store } = this.props; this.props.clear(); - this.props.loadData(store.page, filter, this.props.featureIds, sort?.column ?? "creation", sort?.direction); + this.props.loadData(store.page, filter, this.props.featureIds, store?.orderby, store?.direction); } reorder(orderby) { From 676c3384e81833333b7b7dd18faed2a7d61062d9 Mon Sep 17 00:00:00 2001 From: MiraGeowerkstatt Date: Wed, 7 Aug 2024 09:16:21 +0200 Subject: [PATCH 4/4] Fix naming --- src/client/src/pages/detail/detailPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/src/pages/detail/detailPage.tsx b/src/client/src/pages/detail/detailPage.tsx index b014ac3db..528fe2337 100644 --- a/src/client/src/pages/detail/detailPage.tsx +++ b/src/client/src/pages/detail/detailPage.tsx @@ -1,7 +1,7 @@ import { LayoutBox, MainContentBox, SidebarBox } from "../../components/styledComponents.js"; import { FC } from "react"; import DetailSideNav from "./detailSideNav"; -import BoreholeForm from "./detailPageContent"; +import DetailPageContent from "./detailPageContent"; import DetailHeader from "./detailHeader.tsx"; export const DetailPage: FC = () => { @@ -13,7 +13,7 @@ export const DetailPage: FC = () => { - +