notifications: hdie all (visual) notifications for SIP gateways

This commit is contained in:
Saúl Ibarra Corretgé 2020-02-25 11:47:37 +01:00 committed by Saúl Ibarra Corretgé
parent 8fd0f56be7
commit cdbc5976a0
1 changed files with 31 additions and 2 deletions

View File

@ -6,12 +6,20 @@ import React from 'react';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
import AbstractNotificationsContainer, { import AbstractNotificationsContainer, {
_abstractMapStateToProps as _mapStateToProps, _abstractMapStateToProps,
type Props type Props as AbstractProps
} from '../AbstractNotificationsContainer'; } from '../AbstractNotificationsContainer';
import Notification from './Notification'; import Notification from './Notification';
type Props = AbstractProps & {
/**
* Whther we are a SIP gateway or not.
*/
_iAmSipGateway: boolean
};
/** /**
* Implements a React {@link Component} which displays notifications and handles * Implements a React {@link Component} which displays notifications and handles
* automatic dismissmal after a notification is shown for a defined timeout * automatic dismissmal after a notification is shown for a defined timeout
@ -28,6 +36,10 @@ class NotificationsContainer extends AbstractNotificationsContainer<Props> {
* @returns {ReactElement} * @returns {ReactElement}
*/ */
render() { render() {
if (this.props._iAmSipGateway) {
return null;
}
return ( return (
<FlagGroup onDismissed = { this._onDismissed }> <FlagGroup onDismissed = { this._onDismissed }>
{ this._renderFlags() } { this._renderFlags() }
@ -65,4 +77,21 @@ class NotificationsContainer extends AbstractNotificationsContainer<Props> {
} }
} }
/**
* Maps (parts of) the Redux state to the associated props for this component.
*
* @param {Object} state - The Redux state.
* @private
* @returns {Props}
*/
function _mapStateToProps(state) {
const { iAmSipGateway } = state['features/base/config'];
return {
..._abstractMapStateToProps(state),
_iAmSipGateway: Boolean(iAmSipGateway)
};
}
export default connect(_mapStateToProps)(NotificationsContainer); export default connect(_mapStateToProps)(NotificationsContainer);