import React from 'react'; import { useSelector } from 'react-redux'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { Icon } from '@edx/paragon'; import { ArrowBackIos, Close } from '@edx/paragon/icons'; import messages from './messages'; import { useModel } from '../../generic/model-store'; import useWindowSize, { responsiveBreakpoints } from '../../generic/tabs/useWindowSize'; import UpgradeNotification from '../../generic/upgrade-notification/UpgradeNotification'; function NotificationTray({ intl, toggleNotificationTray, }) { const { courseId, } = useSelector(state => state.courseware); const course = useModel('coursewareMeta', courseId); const { accessExpiration, contentTypeGatingEnabled, offer, org, timeOffsetMillis, userTimezone, verifiedMode, } = course; const shouldDisplayFullScreen = useWindowSize().width < responsiveBreakpoints.large.minWidth; return (
{shouldDisplayFullScreen ? (
{ toggleNotificationTray(); }} onKeyDown={() => { toggleNotificationTray(); }} role="button" tabIndex="0" alt={intl.formatMessage(messages.responsiveCloseNotificationTray)}> {intl.formatMessage(messages.responsiveCloseNotificationTray)}
) : null}
{intl.formatMessage(messages.notificationTitle)} {shouldDisplayFullScreen ? null : { toggleNotificationTray(); }} onKeyDown={() => { toggleNotificationTray(); }} role="button" tabIndex="0" alt={intl.formatMessage(messages.closeNotificationTrigger)} />}
{verifiedMode ? ( ) :

{intl.formatMessage(messages.noNotificationsMessage)}

}
); } NotificationTray.propTypes = { intl: intlShape.isRequired, toggleNotificationTray: PropTypes.func, }; NotificationTray.defaultProps = { toggleNotificationTray: null, }; export default injectIntl(NotificationTray);