From 006db3877c36e584aedc5054db1be7e9ef0a290c Mon Sep 17 00:00:00 2001 From: zeppi Date: Mon, 19 Jul 2021 22:02:09 -0400 Subject: [PATCH] recon for notification components --- ui/component/notificationBubble/view.jsx | 7 +++++-- ui/component/notificationHeaderButton/view.jsx | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ui/component/notificationBubble/view.jsx b/ui/component/notificationBubble/view.jsx index f3d060030..9da6b1659 100644 --- a/ui/component/notificationBubble/view.jsx +++ b/ui/component/notificationBubble/view.jsx @@ -1,16 +1,19 @@ // @flow import React from 'react'; import classnames from 'classnames'; +import { ENABLE_UI_NOTIFICATIONS } from 'config'; type Props = { unseenCount: number, inline: boolean, + user: ?User, }; export default function NotificationHeaderButton(props: Props) { - const { unseenCount, inline = false } = props; + const { unseenCount, inline = false, user } = props; + const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui); - if (unseenCount === 0) { + if (unseenCount === 0 || !notificationsEnabled) { return null; } diff --git a/ui/component/notificationHeaderButton/view.jsx b/ui/component/notificationHeaderButton/view.jsx index 9c19e4116..74c581888 100644 --- a/ui/component/notificationHeaderButton/view.jsx +++ b/ui/component/notificationHeaderButton/view.jsx @@ -6,6 +6,7 @@ import Icon from 'component/common/icon'; import NotificationBubble from 'component/notificationBubble'; import Button from 'component/button'; import { useHistory } from 'react-router'; +import { ENABLE_UI_NOTIFICATIONS } from 'config'; type Props = { unseenCount: number, @@ -19,8 +20,9 @@ export default function NotificationHeaderButton(props: Props) { // notifications, // fetching, doSeeAllNotifications, - // user, + user, } = props; + const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui); const { push } = useHistory(); function handleMenuClick() { @@ -31,6 +33,10 @@ export default function NotificationHeaderButton(props: Props) { push(`/$/${PAGES.NOTIFICATIONS}`); } + if (!notificationsEnabled) { + return null; + } + return (