Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WV-2829 outage adjustments #4715

Merged
merged 4 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};