recon for notification components
This commit is contained in:
parent
a12cd7c2bb
commit
006db3877c
2 changed files with 12 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 (
|
||||
<Button
|
||||
onClick={handleMenuClick}
|
||||
|
|
Loading…
Reference in a new issue