Skip to content

Commit

Permalink
WV-2829 outage adjustments (#4715)
Browse files Browse the repository at this point in the history
* Only notify OUTAGES on initial WV load

* Disable auto-notification when EIC mode is active

* Removed unnecessary overrides

* Disable auto-notification when in kiosk mode

---------

Co-authored-by: Thomas Cariello <thomas.m.cariello@nasa.gov>
  • Loading branch information
Tomcariello and Thomas Cariello authored Oct 11, 2023
1 parent b9ccb10 commit d4f4f7a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
10 changes: 7 additions & 3 deletions web/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ class App extends React.Component {

componentDidUpdate(prevProps) {
// Check if the numberUnseen prop has changed
const { numberOutagesUnseen, object } = this.props;
const { kioskModeEnabled, numberOutagesUnseen, object } = this.props;
if (numberOutagesUnseen !== prevProps.numberOutagesUnseen) {
if (numberOutagesUnseen > 0) {
this.openNotification(object, numberOutagesUnseen);
if (numberOutagesUnseen > 0 && !kioskModeEnabled) {
this.openNotification(object.outages, numberOutagesUnseen);
}
}
}
Expand Down Expand Up @@ -190,8 +190,10 @@ function mapStateToProps(state) {
const {
numberOutagesUnseen, numberUnseen, type, object,
} = notifications;
const kioskModeEnabled = (state.ui.eic !== null && state.ui.eic !== '') || state.ui.isKioskModeActive;
return {
state,
kioskModeEnabled,
isAnimationWidgetActive: state.animation.isActive,
isEmbedModeActive: state.embed.isEmbedModeActive,
isMobile: state.screenSize.isMobileDevice,
Expand Down Expand Up @@ -219,6 +221,7 @@ const mapDispatchToProps = (dispatch) => ({
openCustomContent('NOTIFICATION_LIST_MODAL', {
headerText: 'Notifications',
bodyComponent: Notifications,
source: 'outage-alert',
onClose: () => {
if (numberOutagesUnseen > 0) {
dispatch(outageNotificationsSeenAction());
Expand All @@ -236,6 +239,7 @@ export default connect(

App.propTypes = {
isAnimationWidgetActive: PropTypes.bool,
kioskModeEnabled: PropTypes.bool,
isEmbedModeActive: PropTypes.bool,
isMobile: PropTypes.bool,
isTourActive: PropTypes.bool,
Expand Down
21 changes: 18 additions & 3 deletions web/js/containers/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@ import NotificationBlock from '../components/notifications/notification-block';
import { getNumberOfTypeNotSeen } from '../modules/notifications/util';

function Notifications(props) {
const { object } = props;
const { kioskModeEnabled, numberOutagesUnseen, object } = props;
const {
messages, outages, alerts,
} = object;

if (numberOutagesUnseen > 0 && !kioskModeEnabled) {
return (
<div className="wv-notify-modal">
<NotificationBlock
arr={outages}
type="outage"
numberNotSeen={getNumberOfTypeNotSeen('outage', outages)}
/>
</div>
);
}
return (
<div className="wv-notify-modal">
<NotificationBlock
Expand All @@ -30,9 +42,11 @@ function Notifications(props) {
);
}
function mapStateToProps(state) {
const { object } = state.notifications;

const { object, numberOutagesUnseen } = state.notifications;
const kioskModeEnabled = (state.ui.eic !== null && state.ui.eic !== '') || state.ui.isKioskModeActive;
return {
kioskModeEnabled,
numberOutagesUnseen,
object,
};
}
Expand All @@ -44,4 +58,5 @@ export default connect(

Notifications.propTypes = {
object: PropTypes.object,
numberOutagesUnseen: PropTypes.number,
};

0 comments on commit d4f4f7a

Please sign in to comment.