Skip to content

Commit

Permalink
chore: Remove old Settings component
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Jul 11, 2024
1 parent d9ffda6 commit 9587e55
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 345 deletions.
4 changes: 2 additions & 2 deletions editor.planx.uk/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ const EditorToolbar: React.FC<{
{isTeamSettingsVisible && (
<>
<MenuItem
onClick={() => navigate(`${rootTeamPath()}/settings`)}
onClick={() => navigate(`${rootTeamPath()}/general-settings`)}
>
Team Settings
</MenuItem>
Expand All @@ -559,7 +559,7 @@ const EditorToolbar: React.FC<{
<>
<MenuItem
onClick={() =>
navigate([rootFlowPath(true), "settings"].join("/"))
navigate([rootFlowPath(true), "service"].join("/"))
}
>
Flow Settings
Expand Down
163 changes: 0 additions & 163 deletions editor.planx.uk/src/pages/FlowEditor/components/Settings/index.tsx

This file was deleted.

1 change: 0 additions & 1 deletion editor.planx.uk/src/pages/FlowEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "./components/Settings";
import "./floweditor.scss";

import Box from "@mui/material/Box";
Expand Down
47 changes: 42 additions & 5 deletions editor.planx.uk/src/routes/flow.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { gql } from "@apollo/client";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
ComponentType as TYPES,
FlowStatus,
} from "@opensystemslab/planx-core/types";
import natsort from "natsort";
import {
compose,
lazy,
map,
Matcher,
mount,
NaviRequest,
redirect,
route,
withData,
Expand All @@ -26,8 +30,7 @@ import components from "../pages/FlowEditor/components/forms";
import FormModal from "../pages/FlowEditor/components/forms/FormModal";
import { SLUGS } from "../pages/FlowEditor/data/types";
import { useStore } from "../pages/FlowEditor/lib/store";
import type { Flow } from "../types";
import { getFlowSettings } from "./flowSettings";
import type { Flow, FlowSettings } from "../types";
import { makeTitle } from "./utils";
import { flowEditorView } from "./views/flowEditor";

Expand Down Expand Up @@ -178,6 +181,42 @@ const nodeRoutes = mount({

const SettingsContainer = () => <View />;

interface GetFlowSettings {
flows: {
id: string;
settings: FlowSettings;
status: FlowStatus;
}[];
}

export const getFlowSettings = async (req: NaviRequest) => {
const {
data: {
flows: [{ settings, status }],
},
} = await client.query<GetFlowSettings>({
query: gql`
query GetFlow($slug: String!, $team_slug: String!) {
flows(
limit: 1
where: { slug: { _eq: $slug }, team: { slug: { _eq: $team_slug } } }
) {
id
settings
status
}
}
`,
variables: {
slug: req.params.flow,
team_slug: req.params.team,
},
});

useStore.getState().setFlowSettings(settings);
useStore.getState().setFlowStatus(status);
};

const routes = compose(
withData((req) => ({
flow: req.params.flow.split(",")[0],
Expand Down Expand Up @@ -213,8 +252,6 @@ const routes = compose(
nodeRoutes,
),

"/settings": lazy(() => import("./flowSettings")),

"/service": compose(
withView(SettingsContainer),

Expand Down
109 changes: 0 additions & 109 deletions editor.planx.uk/src/routes/flowSettings.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions editor.planx.uk/src/routes/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ const routes = compose(
view: <Team />,
})),

"/settings": lazy(() => import("./teamSettings")),

"/:flow": lazy(async (req) => {
const [slug] = req.params.flow.split(",");

Expand Down
Loading

0 comments on commit 9587e55

Please sign in to comment.