Skip to content

Commit

Permalink
wip: Menu settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ianjon3s committed May 24, 2024
1 parent 7e31698 commit 05f24b6
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ function GlobalMenu() {
{
title: "Admin panel",
Icon: AdminPanelSettingsIcon,
route: "/admin-panel",
route: "admin-panel",
},
{
title: "Global settings",
Icon: TuneIcon,
route: "/global-settings",
route: "global-settings",
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ import TableHead from "@mui/material/TableHead";
import TableRow from "@mui/material/TableRow";
import Typography from "@mui/material/Typography";
import { Role, User } from "@opensystemslab/planx-core/types";
import { Dashboard, DashboardWrap } from "pages/Teams";
import React from "react";
import { FONT_WEIGHT_SEMI_BOLD } from "theme";
import EditorRow from "ui/editor/EditorRow";

import TeamMenu from "../TeamMenu";

const StyledAvatar = styled(Avatar)(({ theme }) => ({
background: theme.palette.background.dark,
color: theme.palette.common.white,
Expand Down Expand Up @@ -127,39 +130,44 @@ export const TeamMembers: React.FC<Props> = ({ teamMembersByRole }) => {
);

return (
<Container maxWidth="contentWrap">
<Box py={7}>
<EditorRow>
<Typography variant="h2" component="h3" gutterBottom>
Team editors
</Typography>
<Typography variant="body1">
Editors have access to edit your services.
</Typography>
<MembersTable members={activeMembers} />
</EditorRow>
<EditorRow>
<Typography variant="h2" component="h3" gutterBottom>
Admins
</Typography>
<Typography variant="body1">
Admins have editor access across all teams.
</Typography>
<MembersTable members={platformAdmins} />
</EditorRow>
{archivedMembers.length > 0 && (
<EditorRow>
<Typography variant="h2" component="h3" gutterBottom>
Archived team editors
</Typography>
<Typography variant="body1">
Past team members who no longer have access to the Editor, but may
be part of the edit history of your services.
</Typography>
<MembersTable members={archivedMembers} />
</EditorRow>
)}
</Box>
</Container>
<DashboardWrap>
<Dashboard>
<TeamMenu />
<Container maxWidth="contentWrap">
<Box py={3}>
<EditorRow>
<Typography variant="h2" component="h3" gutterBottom>
Team editors
</Typography>
<Typography variant="body1">
Editors have access to edit your services.
</Typography>
<MembersTable members={activeMembers} />
</EditorRow>
<EditorRow>
<Typography variant="h2" component="h3" gutterBottom>
Admins
</Typography>
<Typography variant="body1">
Admins have editor access across all teams.
</Typography>
<MembersTable members={platformAdmins} />
</EditorRow>
{archivedMembers.length > 0 && (
<EditorRow>
<Typography variant="h2" component="h3" gutterBottom>
Archived team editors
</Typography>
<Typography variant="body1">
Past team members who no longer have access to the Editor, but
may be part of the edit history of your services.
</Typography>
<MembersTable members={archivedMembers} />
</EditorRow>
)}
</Box>
</Container>
</Dashboard>
</DashboardWrap>
);
};
40 changes: 29 additions & 11 deletions editor.planx.uk/src/pages/PlatformAdminPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import Accordion from "@mui/material/Accordion";
import AccordionDetails from "@mui/material/AccordionDetails";
import AccordionSummary from "@mui/material/AccordionSummary";
import Box from "@mui/material/Box";
import Container from "@mui/material/Container";
import Grid from "@mui/material/Grid";
import { styled } from "@mui/material/styles";
import Typography from "@mui/material/Typography";
import { SummaryListTable } from "@planx/components/shared/Preview/SummaryList";
import GlobalMenu from "pages/FlowEditor/components/GlobalMenu";
import { useStore } from "pages/FlowEditor/lib/store";
import { Dashboard, DashboardWrap } from "pages/Teams";
import React from "react";
import useSWR from "swr";
import { AdminPanelData } from "types";
Expand All @@ -34,15 +37,24 @@ function Component() {
const adminPanelData = useStore((state) => state.adminPanelData);

return (
<Box p={3}>
<Typography variant="h1">Platform Admin Panel</Typography>
<Typography variant="body1" mb={3}>
{`This is an overview of each team's integrations and settings for the `}
<strong>{process.env.REACT_APP_ENV}</strong>
{` environment`}
</Typography>
{adminPanelData?.map((team) => <TeamData key={team.id} data={team} />)}
</Box>
<DashboardWrap>
<Dashboard>
<GlobalMenu />
<Container maxWidth={false}>
<Box py={3}>
<Typography variant="h1">Platform Admin Panel</Typography>
<Typography variant="body1" mb={3}>
{`This is an overview of each team's integrations and settings for the `}
<strong>{process.env.REACT_APP_ENV}</strong>
{` environment`}
</Typography>
{adminPanelData?.map((team) => (
<TeamData key={team.id} data={team} />
))}
</Box>
</Container>
</Dashboard>
</DashboardWrap>
);
}

Expand All @@ -58,7 +70,7 @@ const TeamData: React.FC<TeamData> = ({ data }) => {
const a4Endpoint = `${process.env.REACT_APP_API_URL}/gis/${data.slug}/article4-schema`;
const fetcher = (url: string) => fetch(url).then((r) => r.json());
const { data: a4Check, isValidating } = useSWR(
() => data.slug ? a4Endpoint : null,
() => (data.slug ? a4Endpoint : null),
fetcher,
);

Expand Down Expand Up @@ -123,7 +135,13 @@ const TeamData: React.FC<TeamData> = ({ data }) => {
</>
<>
<Box component="dt">{"Article 4s (API)"}</Box>
<Box component="dd">{!isValidating && a4Check?.status ? <Configured /> : <NotConfigured />}</Box>
<Box component="dd">
{!isValidating && a4Check?.status ? (
<Configured />
) : (
<NotConfigured />
)}
</Box>
</>
<>
<Box component="dt">{"Reference code"}</Box>
Expand Down
5 changes: 0 additions & 5 deletions editor.planx.uk/src/pages/Team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ import SimpleMenu from "../ui/editor/SimpleMenu";
import TeamMenu from "./FlowEditor/components/TeamMenu";
import { useStore } from "./FlowEditor/lib/store";

interface TeamTheme {
slug: string;
primaryColour: string;
}

const Root = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.background.default,
width: "100%",
Expand Down
13 changes: 7 additions & 6 deletions editor.planx.uk/src/pages/Teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ interface Props {
teamTheme: Array<TeamTheme>;
}

const Root = styled(Box)(({ theme }) => ({
export const DashboardWrap = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.background.default,
width: "100%",
flex: 1,
display: "flex",
justifyContent: "flex-start",
alignItems: "center",
alignItems: "flex-start",
}));

const Dashboard = styled(Box)(() => ({
export const Dashboard = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.background.default,
width: "100%",
display: "flex",
flexDirection: "row",
Expand Down Expand Up @@ -94,7 +95,7 @@ const Teams: React.FC<Props> = ({ teams, teamTheme }) => {
});

return (
<Root>
<DashboardWrap>
<Dashboard>
<GlobalMenu />
<Container maxWidth="formWrap">
Expand Down Expand Up @@ -122,7 +123,7 @@ const Teams: React.FC<Props> = ({ teams, teamTheme }) => {
</Box>
</Container>
</Dashboard>
</Root>
</DashboardWrap>
);
};

Expand Down

0 comments on commit 05f24b6

Please sign in to comment.