recon for notification components

This commit is contained in:
zeppi 2021-07-19 22:02:09 -04:00 committed by jessopb
parent a12cd7c2bb
commit 006db3877c
2 changed files with 12 additions and 3 deletions

View file

@ -1,16 +1,19 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import { ENABLE_UI_NOTIFICATIONS } from 'config';
type Props = { type Props = {
unseenCount: number, unseenCount: number,
inline: boolean, inline: boolean,
user: ?User,
}; };
export default function NotificationHeaderButton(props: Props) { 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; return null;
} }

View file

@ -6,6 +6,7 @@ import Icon from 'component/common/icon';
import NotificationBubble from 'component/notificationBubble'; import NotificationBubble from 'component/notificationBubble';
import Button from 'component/button'; import Button from 'component/button';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import { ENABLE_UI_NOTIFICATIONS } from 'config';
type Props = { type Props = {
unseenCount: number, unseenCount: number,
@ -19,8 +20,9 @@ export default function NotificationHeaderButton(props: Props) {
// notifications, // notifications,
// fetching, // fetching,
doSeeAllNotifications, doSeeAllNotifications,
// user, user,
} = props; } = props;
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
const { push } = useHistory(); const { push } = useHistory();
function handleMenuClick() { function handleMenuClick() {
@ -31,6 +33,10 @@ export default function NotificationHeaderButton(props: Props) {
push(`/$/${PAGES.NOTIFICATIONS}`); push(`/$/${PAGES.NOTIFICATIONS}`);
} }
if (!notificationsEnabled) {
return null;
}
return ( return (
<Button <Button
onClick={handleMenuClick} onClick={handleMenuClick}