From 470df49a4baa9bd0cd78b298baf9327be2b8ffee Mon Sep 17 00:00:00 2001 From: Ian Jones Date: Fri, 28 Jun 2024 15:17:59 +0100 Subject: [PATCH] feat: Fix editor layouts --- .../src/components/EditorNavMenu.tsx | 4 +- .../components/Flow/FeedbackPage.tsx | 96 +++++++++---------- .../components/Settings/ServiceSettings.tsx | 5 +- .../components/Settings/Submissions/index.tsx | 29 +++--- .../src/pages/FlowEditor/index.tsx | 3 + .../src/pages/layout/FlowEditorLayout.tsx | 14 +-- editor.planx.uk/src/routes/flow.tsx | 7 +- 7 files changed, 70 insertions(+), 88 deletions(-) diff --git a/editor.planx.uk/src/components/EditorNavMenu.tsx b/editor.planx.uk/src/components/EditorNavMenu.tsx index 6c110307f7..409d8263d1 100644 --- a/editor.planx.uk/src/components/EditorNavMenu.tsx +++ b/editor.planx.uk/src/components/EditorNavMenu.tsx @@ -87,7 +87,7 @@ const flowLayoutRoutes: Route[] = [ ]; const MENU_WIDTH_COMPACT = "52px"; -const MENU_WIDTH_FULL = "184px"; +const MENU_WIDTH_FULL = "178px"; const Root = styled(Box)<{ compact?: boolean }>(({ theme, compact }) => ({ width: compact ? MENU_WIDTH_COMPACT : MENU_WIDTH_FULL, @@ -99,7 +99,7 @@ const Root = styled(Box)<{ compact?: boolean }>(({ theme, compact }) => ({ const MenuWrap = styled("ul")(({ theme }) => ({ listStyle: "none", margin: 0, - padding: theme.spacing(2.5, 0.4, 0, 0.4), + padding: theme.spacing(1, 0.4, 0, 0.4), position: "sticky", top: 0, })); diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackPage.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackPage.tsx index 04c7307dcf..48c42e4fd0 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackPage.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackPage.tsx @@ -155,55 +155,53 @@ export const FeedbackPage: React.FC = ({ feedback }) => { return ( - - - - Feedback log - - - Feedback from users about this service. - - - - {feedback.length === 0 ? ( - - ) : ( - - - - *": { borderBottomColor: "black !important" } }} - > - - Type - - - Date - - - Comment - - - - - - {feedback.map((item) => ( - - ))} - -
-
- )} -
-
+ + + Feedback log + + + Feedback from users about this service. + + + + {feedback.length === 0 ? ( + + ) : ( + + + + *": { borderBottomColor: "black !important" } }} + > + + Type + + + Date + + + Comment + + + + + + {feedback.map((item) => ( + + ))} + +
+
+ )} +
); }; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceSettings.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceSettings.tsx index 06abc3430d..0e4ef6f895 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceSettings.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceSettings.tsx @@ -1,6 +1,7 @@ import Alert from "@mui/material/Alert"; import Box from "@mui/material/Box"; import Button from "@mui/material/Button"; +import Container from "@mui/material/Container"; import FormControlLabel, { formControlLabelClasses, } from "@mui/material/FormControlLabel"; @@ -143,7 +144,7 @@ const ServiceSettings: React.FC = () => { }); return ( - + @@ -309,7 +310,7 @@ const ServiceSettings: React.FC = () => { Service settings updated successfully - + ); }; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/Submissions/index.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/Submissions/index.tsx index 388d700279..73d1e4c247 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/Submissions/index.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/Submissions/index.tsx @@ -1,5 +1,4 @@ import { gql, useQuery } from "@apollo/client"; -import Box from "@mui/material/Box"; import Container from "@mui/material/Container"; import Typography from "@mui/material/Typography"; import React, { useMemo } from "react"; @@ -74,23 +73,17 @@ const Submissions: React.FC = () => { return ( - - - - Submissions - - - Feed of payment and submission events for this service - - - - - - + + + Submissions + + + Feed of payment and submission events for this service + + + + + ); }; diff --git a/editor.planx.uk/src/pages/FlowEditor/index.tsx b/editor.planx.uk/src/pages/FlowEditor/index.tsx index 5d3aa6cdfa..5f98b067f9 100644 --- a/editor.planx.uk/src/pages/FlowEditor/index.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/index.tsx @@ -3,6 +3,7 @@ import "./floweditor.scss"; import Box from "@mui/material/Box"; import { styled } from "@mui/material/styles"; +import { HEADER_HEIGHT } from "components/Header"; import React, { useRef } from "react"; import { rootFlowPath } from "../../routes/utils"; @@ -10,11 +11,13 @@ import Flow from "./components/Flow"; import Sidebar from "./components/Sidebar"; import { useStore } from "./lib/store"; import useScrollControlsAndRememberPosition from "./lib/useScrollControlsAndRememberPosition"; + const EditorContainer = styled(Box)(() => ({ display: "flex", alignItems: "stretch", overflow: "hidden", flexGrow: 1, + maxHeight: `calc(100vh - ${HEADER_HEIGHT}px)`, })); const FlowEditor: React.FC = ({ flow, breadcrumbs }) => { diff --git a/editor.planx.uk/src/pages/layout/FlowEditorLayout.tsx b/editor.planx.uk/src/pages/layout/FlowEditorLayout.tsx index 72813dbbd9..98a3ee97df 100644 --- a/editor.planx.uk/src/pages/layout/FlowEditorLayout.tsx +++ b/editor.planx.uk/src/pages/layout/FlowEditorLayout.tsx @@ -1,22 +1,14 @@ -import Box from "@mui/material/Box"; -import { styled } from "@mui/material/styles"; import EditorNavMenu, { flowLayoutRoutes } from "components/EditorNavMenu"; import ErrorFallback from "components/ErrorFallback"; import React, { PropsWithChildren } from "react"; import { ErrorBoundary } from "react-error-boundary"; - -const Root = styled(Box)(() => ({ - display: "flex", - alignItems: "stretch", - overflow: "hidden", - flexGrow: 1, -})); +import Dashboard from "ui/editor/Dashboard"; const FlowEditorLayout: React.FC = ({ children }) => ( - + {children} - + ); export default FlowEditorLayout; diff --git a/editor.planx.uk/src/routes/flow.tsx b/editor.planx.uk/src/routes/flow.tsx index f6d60051b1..ae657d0443 100644 --- a/editor.planx.uk/src/routes/flow.tsx +++ b/editor.planx.uk/src/routes/flow.tsx @@ -1,5 +1,4 @@ import { gql } from "@apollo/client"; -import Box from "@mui/material/Box"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import natsort from "natsort"; import { @@ -177,11 +176,7 @@ const nodeRoutes = mount({ "/:parent/nodes/:id/edit": editNode, }); -const SettingsContainer = () => ( - - - -); +const SettingsContainer = () => ; const routes = compose( withData((req) => ({