diff --git a/editor.planx.uk/src/components/Header.tsx b/editor.planx.uk/src/components/Header.tsx index 467af46ad1..fac5091100 100644 --- a/editor.planx.uk/src/components/Header.tsx +++ b/editor.planx.uk/src/components/Header.tsx @@ -37,6 +37,7 @@ import { LINE_HEIGHT_BASE, } from "theme"; import { ApplicationPath } from "types"; +import { PlatformAdminOnly } from "ui/editor/permissions/PlatformAdminOnly"; import Reset from "ui/icons/Reset"; import { useStore } from "../pages/FlowEditor/lib/store"; @@ -531,14 +532,14 @@ const EditorToolbar: React.FC<{ )} - {!user.isPlatformAdmin && ( + All teams - )} + {/* Only show team settings link if inside a team route */} {isTeamSettingsVisible && ( diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/index.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/index.tsx index 1b42dd65b0..3e8aae524e 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/index.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/index.tsx @@ -22,6 +22,7 @@ import { AxiosError } from "axios"; import { formatLastPublishMessage } from "pages/FlowEditor/utils"; import React, { useState } from "react"; import { useAsync } from "react-use"; +import { PlatformAdminOnly } from "ui/editor/permissions/PlatformAdminOnly"; import Input from "ui/shared/Input"; import Questions from "../../../Preview/Questions"; @@ -163,7 +164,6 @@ const Sidebar: React.FC<{ lastPublisher, validateAndDiffFlow, isFlowPublished, - isPlatformAdmin, ] = useStore((state) => [ state.id, state.flowAnalyticsLink, @@ -173,7 +173,6 @@ const Sidebar: React.FC<{ state.lastPublisher, state.validateAndDiffFlow, state.isFlowPublished, - state.user?.isPlatformAdmin, ]); const [key, setKey] = useState(false); const [lastPublishedTitle, setLastPublishedTitle] = useState( @@ -297,7 +296,7 @@ const Sidebar: React.FC<{ )} - {isPlatformAdmin && ( + - )} + = ({ + children, +}) => { + const isPlatformAdmin = useStore((state) => state.user?.isPlatformAdmin); + return isPlatformAdmin ? children : null; +};