Skip to content

Commit

Permalink
feat: add email and roles summary to editor menu (#2238)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak authored Sep 26, 2023
1 parent cf1e311 commit acd43c3
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions editor.planx.uk/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Edit from "@mui/icons-material/Edit";
import KeyboardArrowDown from "@mui/icons-material/KeyboardArrowDown";
import MenuOpenIcon from "@mui/icons-material/MenuOpen";
import Person from "@mui/icons-material/Person";
import Visibility from "@mui/icons-material/Visibility";
import AppBar from "@mui/material/AppBar";
import Avatar from "@mui/material/Avatar";
Expand All @@ -9,10 +10,12 @@ import ButtonBase from "@mui/material/ButtonBase";
import Container from "@mui/material/Container";
import IconButton from "@mui/material/IconButton";
import Link from "@mui/material/Link";
import ListItemIcon from "@mui/material/ListItemIcon";
import ListItemText from "@mui/material/ListItemText";
import MenuItem from "@mui/material/MenuItem";
import Paper from "@mui/material/Paper";
import Popover from "@mui/material/Popover";
import { styled,Theme } from "@mui/material/styles";
import { styled, Theme } from "@mui/material/styles";
import MuiToolbar from "@mui/material/Toolbar";
import Typography from "@mui/material/Typography";
import useMediaQuery from "@mui/material/useMediaQuery";
Expand Down Expand Up @@ -390,7 +393,10 @@ const EditorToolbar: React.FC<{
route: Route;
}> = ({ headerRef, route }) => {
const [open, setOpen] = useState(false);
const togglePreview = useStore((state) => state.togglePreview);
const [ togglePreview, user ] = useStore((state) => [
state.togglePreview,
state.getUser(),
]);

const { navigate } = useNavigation();

Expand Down Expand Up @@ -460,11 +466,35 @@ const EditorToolbar: React.FC<{
}}
>
<StyledPaper>
{/*
<MenuItem onClick={() => handleClick("/")}>Service settings</MenuItem>
<MenuItem onClick={() => handleClick("/")}>My dashboard</MenuItem>
*/}

<MenuItem disabled>
<ListItemIcon>
<Person fontSize="small" />
</ListItemIcon>
<ListItemText>
{user.email}
</ListItemText>
</MenuItem>
{(user.isPlatformAdmin || user.teams.length > 0) && (
<MenuItem disabled>
<ListItemIcon>
<Edit />
</ListItemIcon>
<ListItemText>
{user.isPlatformAdmin ? `All teams` : user.teams.map((team) => team.team.name).join(", ")}
</ListItemText>
</MenuItem>
)}
{!user.isPlatformAdmin && (
<MenuItem disabled divider>
<ListItemIcon>
<Visibility />
</ListItemIcon>
<ListItemText>
All teams
</ListItemText>
</MenuItem>
)}

{/* only show flow settings link if inside a flow route */}
{route.data.flow && (
<MenuItem
Expand Down

0 comments on commit acd43c3

Please sign in to comment.