From ff618956b5d9cf933d867ea979b612c3d8a6f30b Mon Sep 17 00:00:00 2001 From: sct Date: Tue, 15 Dec 2020 05:15:45 +0000 Subject: [PATCH] fix(frontend): only show alpha notice to admins --- src/components/Layout/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index a581b6674..799a32579 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -6,6 +6,7 @@ import Notifications from './Notifications'; import LanguagePicker from './LanguagePicker'; import { useRouter } from 'next/router'; import { defineMessages, FormattedMessage } from 'react-intl'; +import { Permission, useUser } from '../../hooks/useUser'; const messages = defineMessages({ alphawarning: @@ -14,6 +15,7 @@ const messages = defineMessages({ const Layout: React.FC = ({ children }) => { const [isSidebarOpen, setSidebarOpen] = useState(false); + const { hasPermission } = useUser(); const router = useRouter(); return ( @@ -57,7 +59,7 @@ const Layout: React.FC = ({ children }) => { >
- {router.pathname === '/' && ( + {router.pathname === '/' && hasPermission(Permission.ADMIN) && (
@@ -85,7 +87,7 @@ const Layout: React.FC = ({ children }) => { target="_blank" rel="noreferrer" > - Github → + GitHub →