diff --git a/editor.planx.uk/src/components/Header.tsx b/editor.planx.uk/src/components/Header.tsx index 9e4862f178..ebc2b00313 100644 --- a/editor.planx.uk/src/components/Header.tsx +++ b/editor.planx.uk/src/components/Header.tsx @@ -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"; @@ -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"; @@ -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(); @@ -460,11 +466,35 @@ const EditorToolbar: React.FC<{ }} > - {/* - handleClick("/")}>Service settings - handleClick("/")}>My dashboard - */} - + + + + + + {user.email} + + + {(user.isPlatformAdmin || user.teams.length > 0) && ( + + + + + + {user.isPlatformAdmin ? `All teams` : user.teams.map((team) => team.team.name).join(", ")} + + + )} + {!user.isPlatformAdmin && ( + + + + + + All teams + + + )} + {/* only show flow settings link if inside a flow route */} {route.data.flow && (