Clear badge only if setting for all badge count is false (fixes #7)
This commit is contained in:
parent
6cde355870
commit
ad7b4c798a
|
@ -11,7 +11,7 @@ import GroupIcon from '@material-ui/icons/Group';
|
|||
import SettingsIcon from '@material-ui/icons/Settings';
|
||||
import InfoIcon from '@material-ui/icons/Info';
|
||||
import EditIcon from '@material-ui/icons/Edit';
|
||||
import SupervisedUserCircleIcon from '@material-ui/icons/SupervisedUserCircle';
|
||||
//import SupervisedUserCircleIcon from '@material-ui/icons/SupervisedUserCircle';
|
||||
import ExitToAppIcon from '@material-ui/icons/ExitToApp';
|
||||
import {styles} from './AppLayout.styles';
|
||||
import { UAccount } from '../../types/Account';
|
||||
|
@ -52,6 +52,7 @@ export class AppLayout extends Component<any, IAppLayoutState> {
|
|||
|
||||
this.toggleDrawerOnMobile = this.toggleDrawerOnMobile.bind(this);
|
||||
this.toggleAcctMenu = this.toggleAcctMenu.bind(this);
|
||||
this.clearBadge = this.clearBadge.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
@ -162,6 +163,12 @@ export class AppLayout extends Component<any, IAppLayoutState> {
|
|||
}
|
||||
}
|
||||
|
||||
clearBadge() {
|
||||
if (!getUserDefaultBool('displayAllOnNotificationBadge')) {
|
||||
this.setState({ notificationCount: 0 });
|
||||
}
|
||||
}
|
||||
|
||||
titlebar() {
|
||||
const { classes } = this.props;
|
||||
if (this.state.developerMode || process.env.NODE_ENV === "development") {
|
||||
|
@ -288,7 +295,7 @@ export class AppLayout extends Component<any, IAppLayoutState> {
|
|||
<div className={classes.appBarFlexGrow}/>
|
||||
<div className={classes.appBarActionButtons}>
|
||||
<Tooltip title="Notifications">
|
||||
<LinkableIconButton color="inherit" to="/notifications" onClick={() => this.setState({ notificationCount: 0 })}>
|
||||
<LinkableIconButton color="inherit" to="/notifications" onClick={this.clearBadge}>
|
||||
<Badge badgeContent={this.state.notificationCount > 0? this.state.notificationCount: ""} color="secondary">
|
||||
<NotificationsIcon />
|
||||
</Badge>
|
||||
|
|
Loading…
Reference in New Issue