diff --git a/client/apps/portal-administration/src/components/Portal/EditPortalForm.tsx b/client/apps/portal-administration/src/components/Portal/EditPortalForm.tsx index 3e79b2a1..4975d79b 100644 --- a/client/apps/portal-administration/src/components/Portal/EditPortalForm.tsx +++ b/client/apps/portal-administration/src/components/Portal/EditPortalForm.tsx @@ -104,7 +104,7 @@ export const EditPortalForm = (props: { const account = useCurrentAccount(); const canEdit = useMemo( - () => watch().admins?.some((admin) => admin.azureUniqueId === account?.localAccountId), //|| isAdmin, + () => watch().admins?.some((admin) => admin.azureUniqueId === account?.localAccountId) || isAdmin, [watch().admins, account, isAdmin] ); diff --git a/client/apps/portal-administration/src/components/Portals/PortalSideSheet.tsx b/client/apps/portal-administration/src/components/Portals/PortalSideSheet.tsx index 36f00146..b184f728 100644 --- a/client/apps/portal-administration/src/components/Portals/PortalSideSheet.tsx +++ b/client/apps/portal-administration/src/components/Portals/PortalSideSheet.tsx @@ -7,6 +7,7 @@ import { useGetContextTypes } from '../../hooks/use-context-type-query'; import { EditPortalForm } from '../Portal/EditPortalForm'; import { FormActionBar } from '../Portal/FormActionBar'; import { useState } from 'react'; +import { useGetPortal } from '../../hooks/use-portal-query'; const Style = { Wrapper: styled.div` @@ -28,8 +29,11 @@ const Style = { export function PortalSideSheet({ portal, onClose }: { portal?: Portal; onClose: VoidFunction }) { const { data: contextTypes } = useGetContextTypes(); + const { data: fullPortal } = useGetPortal(portal?.id); const [isDisabled, setOnDisabled] = useState(false); + if (!portal || !contextTypes) return null; + return ( diff --git a/client/apps/portal-administration/src/pages/LandingPage.tsx b/client/apps/portal-administration/src/pages/LandingPage.tsx index 1918838b..2956a70b 100644 --- a/client/apps/portal-administration/src/pages/LandingPage.tsx +++ b/client/apps/portal-administration/src/pages/LandingPage.tsx @@ -172,7 +172,7 @@ export const LandingPage = (): JSX.Element => { - {accessIsLoading ? null : !isAdmin ? ( + {accessIsLoading ? null : isAdmin ? ( <> - ) : ( - - )} + ) : null} diff --git a/client/apps/portal-administration/src/pages/PortalsList.tsx b/client/apps/portal-administration/src/pages/PortalsList.tsx index 9460a2e6..9d4d9009 100644 --- a/client/apps/portal-administration/src/pages/PortalsList.tsx +++ b/client/apps/portal-administration/src/pages/PortalsList.tsx @@ -2,6 +2,7 @@ import { styled } from 'styled-components'; import { Loading } from '../components/Loading'; import { PortalTable } from '../components/Portals/PortalTable'; import { usePortalsQuery } from '../hooks/use-portals-query'; +import { useAccess } from '../hooks/use-access'; const Style = { Wrapper: styled.div`