Skip to content

Commit

Permalink
chore: pnpm lint:fix in editor.planx.uk [skip pizza] (#2647)
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr authored Jan 10, 2024
1 parent 9763e76 commit 9d3b8a4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 45 deletions.
8 changes: 2 additions & 6 deletions editor.planx.uk/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,8 @@ const EditorToolbar: React.FC<{
)}

{/* Only show team settings link if inside a team route */}
{(route.data.team && !route.data.flow) &&(
<MenuItem
onClick={() =>
navigate(`${rootTeamPath()}/settings`)
}
>
{route.data.team && !route.data.flow && (
<MenuItem onClick={() => navigate(`${rootTeamPath()}/settings`)}>
Team Settings
</MenuItem>
)}
Expand Down
20 changes: 10 additions & 10 deletions editor.planx.uk/src/pages/FlowEditor/components/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import { styled } from "@mui/material/styles";
import Tab from "@mui/material/Tab";
import Tabs from "@mui/material/Tabs";
import { HEADER_HEIGHT } from "components/Header";
import React from "react";
import React from "react";
import { Link, useNavigation } from "react-navi";

interface SettingsProps {
currentTab: string,
currentTab: string;
tabs: {
route: string,
name: string,
Component: React.FC,
}[]
route: string;
name: string;
Component: React.FC;
}[];
}

interface TabPanelProps {
Expand Down Expand Up @@ -131,14 +131,14 @@ const Settings: React.FC<SettingsProps> = ({ currentTab, tabs }) => {
indicator: classes.tabIndicator,
}}
>
{tabs.map(({ name, route }, index) =>
{tabs.map(({ name, route }, index) => (
<LinkTab
key={`${name}-LinkTab`}
label={name}
href={`./${route}`}
{...a11yProps(index)}
/>
)}
))}
</Tabs>
</Grid>
<Grid item>
Expand All @@ -153,11 +153,11 @@ const Settings: React.FC<SettingsProps> = ({ currentTab, tabs }) => {
</Grid>
</Grid>
</AppBar>
{tabs.map(({ name, Component }, index) =>
{tabs.map(({ name, Component }, index) => (
<TabPanel value={value} index={index} key={`${name}-TabPanel`}>
<Component />
</TabPanel>
)}
))}
</Root>
);
};
Expand Down
42 changes: 22 additions & 20 deletions editor.planx.uk/src/routes/flowSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,28 @@ const flowSettingsRoutes = compose(
title: makeTitle(
[req.params.team, req.params.flow, "Flow Settings"].join("/"),
),
view: <Settings
currentTab={req.params.tab}
tabs={[
{
name: "Service",
route: "service",
Component: ServiceSettings,
},
{
name: "Service Flags",
route: "flags",
Component: ServiceFlags,
},
{
name: "Data",
route: "data-manager",
Component: DataManagerSettings,
},
]}
/>,
view: (
<Settings
currentTab={req.params.tab}
tabs={[
{
name: "Service",
route: "service",
Component: ServiceSettings,
},
{
name: "Service Flags",
route: "flags",
Component: ServiceFlags,
},
{
name: "Data",
route: "data-manager",
Component: DataManagerSettings,
},
]}
/>
),
};
}),
}),
Expand Down
15 changes: 7 additions & 8 deletions editor.planx.uk/src/routes/teamSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { compose, mount, redirect, route, withData } from "navi";
import DesignSettings from "pages/FlowEditor/components/Settings/DesignSettings";
import TeamSettings from "pages/FlowEditor/components/Settings/TeamSettings";
Expand All @@ -9,16 +8,15 @@ import { makeTitle } from "./utils";

const flowSettingsRoutes = compose(
withData((req) => ({
mountpath: req.mountpath
mountpath: req.mountpath,
})),

mount({
"/": redirect("./team"),
"/:tab": route(async (req) => ({
title: makeTitle(
[req.params.team, "Team Settings"].join("/"),
),
view: <Settings
title: makeTitle([req.params.team, "Team Settings"].join("/")),
view: (
<Settings
currentTab={req.params.tab}
tabs={[
{
Expand All @@ -32,8 +30,9 @@ const flowSettingsRoutes = compose(
Component: DesignSettings,
},
]}
/>,
}))
/>
),
})),
}),
);

Expand Down
3 changes: 2 additions & 1 deletion editor.planx.uk/src/routes/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const rootFlowPath = (includePortals = false) => {
return includePortals ? path : path.split(",")[0];
};

export const rootTeamPath = () => window.location.pathname.split("/").slice(0, 2).join("/");
export const rootTeamPath = () =>
window.location.pathname.split("/").slice(0, 2).join("/");

export const isSaveReturnFlow = (flowData: Record<string, any>): boolean =>
Boolean(
Expand Down

0 comments on commit 9d3b8a4

Please sign in to comment.