From 74ea05efc6f67eff8373ffb42e9bd06f5f6c618f Mon Sep 17 00:00:00 2001 From: Mike <36415632+Mike-Heneghan@users.noreply.github.com> Date: Wed, 13 Mar 2024 13:26:37 +0000 Subject: [PATCH] feat: add tab for submissions view to flowSettings (#2884) --- .../Settings/DataManagerSettings.tsx | 22 ++++---- .../components/Settings/ServiceFlags.tsx | 24 ++++---- .../components/Settings/Submissions/index.tsx | 22 ++++++++ editor.planx.uk/src/routes/flowSettings.tsx | 56 +++++++++++-------- 4 files changed, 77 insertions(+), 47 deletions(-) create mode 100644 editor.planx.uk/src/pages/FlowEditor/components/Settings/Submissions/index.tsx diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/DataManagerSettings.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/DataManagerSettings.tsx index a4aabe041f..04aa4f159c 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/DataManagerSettings.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/DataManagerSettings.tsx @@ -5,19 +5,17 @@ import { FeaturePlaceholder } from "ui/editor/FeaturePlaceholder"; const DataManagerSettings: React.FC = () => { return ( - <> - - - Data Manager - - - Manage the data that your service uses and makes available via its API - - - - + + + Data Manager + + + Manage the data that your service uses and makes available via its API + + + - + ); }; export default DataManagerSettings; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceFlags.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceFlags.tsx index 5dc2aa5856..6c4c92ffc5 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceFlags.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/ServiceFlags.tsx @@ -5,20 +5,18 @@ import { FeaturePlaceholder } from "ui/editor/FeaturePlaceholder"; const ServiceFlags: React.FC = () => { return ( - <> - - - Service flags - - - Manage the flag sets that this service uses. Flags at the top of a set - override flags below. - - - - + + + Service flags + + + Manage the flag sets that this service uses. Flags at the top of a set + override flags below. + + + - + ); }; export default ServiceFlags; 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 new file mode 100644 index 0000000000..cf8cafe475 --- /dev/null +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/Submissions/index.tsx @@ -0,0 +1,22 @@ +import Box from "@mui/material/Box"; +import Typography from "@mui/material/Typography"; +import React from "react"; +import { FeaturePlaceholder } from "ui/editor/FeaturePlaceholder"; + +const Submissions: React.FC = () => { + return ( + + + Submissions + + + View data on the user submitted applications for this service. + + + + + + ); +}; + +export default Submissions; diff --git a/editor.planx.uk/src/routes/flowSettings.tsx b/editor.planx.uk/src/routes/flowSettings.tsx index a6e154c55c..de66efe0da 100644 --- a/editor.planx.uk/src/routes/flowSettings.tsx +++ b/editor.planx.uk/src/routes/flowSettings.tsx @@ -1,4 +1,5 @@ import gql from "graphql-tag"; +import { hasFeatureFlag } from "lib/featureFlags"; import { publicClient } from "lib/graphql"; import { compose, @@ -12,6 +13,7 @@ import { import DataManagerSettings from "pages/FlowEditor/components/Settings/DataManagerSettings"; import ServiceFlags from "pages/FlowEditor/components/Settings/ServiceFlags"; import ServiceSettings from "pages/FlowEditor/components/Settings/ServiceSettings"; +import Submissions from "pages/FlowEditor/components/Settings/Submissions"; import { useStore } from "pages/FlowEditor/lib/store"; import React from "react"; @@ -19,6 +21,30 @@ import Settings from "../pages/FlowEditor/components/Settings"; import type { FlowSettings } from "../types"; import { makeTitle } from "./utils"; +const standardTabs = [ + { + name: "Service", + route: "service", + Component: ServiceSettings, + }, + { + name: "Service Flags", + route: "flags", + Component: ServiceFlags, + }, + { + name: "Data", + route: "data-manager", + Component: DataManagerSettings, + }, +]; + +const submissionsTab = { + name: "Submissions", + route: "submissions", + Component: Submissions, +}; + const flowSettingsRoutes = compose( withData((req) => ({ mountpath: req.mountpath, @@ -58,32 +84,18 @@ const flowSettingsRoutes = compose( const settings: FlowSettings = data.flows[0].settings; useStore.getState().setFlowSettings(settings); + function getTabs() { + const isUsingFeatureFlag = hasFeatureFlag("SUBMISSION_VIEW"); + return isUsingFeatureFlag + ? [...standardTabs, submissionsTab] + : standardTabs; + } + return { title: makeTitle( [req.params.team, req.params.flow, "Flow Settings"].join("/"), ), - view: ( - - ), + view: , }; }); }),