import React from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; import urljoin from 'url-join'; import { createSubscribedElement } from '../../UnstatedUtils'; import AppContainer from '../../../services/AppContainer'; import AdminNotificationContainer from '../../../services/AdminNotificationContainer'; import NotificationDeleteModal from './NotificationDeleteModal'; class GlobalNotificationList extends React.Component { constructor(props) { super(props); this.state = { isNotificationDeleteModalShown: false, }; this.toggleDeleteModal = this.toggleDeleteModal.bind(this); } toggleDeleteModal() { this.setState({ isNotificationDeleteModalShown: !this.state.isNotificationDeleteModalShown }); } render() { const { t, adminNotificationContainer } = this.props; const { globalNotifications } = adminNotificationContainer.state; return ( {globalNotifications.map((notification) => { return ( {/* GW-807 switch enable notification */} {notification.triggerPath} {notification.triggerEvents.includes('pageCreate') && ( CREATE )} {notification.triggerEvents.includes('pageEdit') && ( EDIT )} {notification.triggerEvents.includes('pageMove') && ( MOVE )} {notification.triggerEvents.includes('pageDelete') && ( DELETE )} {notification.triggerEvents.includes('pageLike') && ( LIKE )} {notification.triggerEvents.includes('comment') && ( POST )} {notification.__t === 'mail' && {notification.toEmail}} {notification.__t === 'slack' && {notification.slackChannels}}
); })} ;
); } } const GlobalNotificationListWrapper = (props) => { return createSubscribedElement(GlobalNotificationList, props, [AppContainer, AdminNotificationContainer]); }; GlobalNotificationList.propTypes = { t: PropTypes.func.isRequired, // i18next appContainer: PropTypes.instanceOf(AppContainer).isRequired, adminNotificationContainer: PropTypes.instanceOf(AdminNotificationContainer).isRequired, }; export default withTranslation()(GlobalNotificationListWrapper);