From 90d133435bb7666dafa55ca1188caa06687d281c Mon Sep 17 00:00:00 2001 From: wlycdgr Date: Mon, 28 Oct 2019 15:45:03 -0400 Subject: [PATCH] Display notification when user opts out of promos from a promo --- _locales/en/messages.json | 7 +++++++ app/panel/components/Panel.jsx | 13 +++++++++++-- app/panel/components/Settings.jsx | 5 ++++- app/scss/partials/_callout.scss | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 72acad9af..a85e9156f 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2163,5 +2163,12 @@ "already_subscribed_sign_in": { "message": "Already subscribed? Sign In", "description": "Character limit: 28." + }, + "promos_turned_off_notification": { + "message": "Promos turned off. You can turn them back on in", + "description": "translation must take into account that 'Settings' is appended to this string" + }, + "settings": { + "message": "Settings" } } diff --git a/app/panel/components/Panel.jsx b/app/panel/components/Panel.jsx index 6c322b7a9..ab6483fca 100644 --- a/app/panel/components/Panel.jsx +++ b/app/panel/components/Panel.jsx @@ -12,8 +12,9 @@ */ import React from 'react'; +import { NavLink } from 'react-router-dom'; import Header from '../containers/HeaderContainer'; -import { PlusPromoModal, Modal } from '../../shared-components'; +import { PlusPromoModal } from '../../shared-components'; import InsightsPromoModal from './InsightsPromoModal'; import PlusUpgradePromoModal from './PlusUpgradePromoModal'; import { DynamicUIPortContext } from '../contexts/DynamicUIPortContext'; @@ -151,7 +152,6 @@ class Panel extends React.Component { } } - /** * Helper render function for the notification callout * @return {JSX} JSX for the notification callout @@ -163,6 +163,9 @@ class Panel extends React.Component { return ( + {this.props.notificationText === t('promos_turned_off_notification') && ( + {t('settings')} + )} {needsReload && (
{ t('alert_reload') }
)} @@ -201,6 +204,12 @@ class Panel extends React.Component { // TODO metrics ping this.props.actions.togglePromoModal(); sendMessage('promoModals.turnOffPromos', {}); + + this.props.actions.showNotification({ + classes: 'warning', + reload: false, + text: t('promos_turned_off_notification'), + }); }; _handlePromoSignInClick = (modal) => { diff --git a/app/panel/components/Settings.jsx b/app/panel/components/Settings.jsx index d8837b28d..48884d790 100644 --- a/app/panel/components/Settings.jsx +++ b/app/panel/components/Settings.jsx @@ -50,7 +50,10 @@ class Settings extends React.Component { * Lifecycle event. Default sub view is set here. */ UNSAFE_componentWillMount() { - this.props.history.push('/settings/globalblocking'); + // Do not redirect to the default if we are trying to access a specific other subview + if (this.props.history[this.props.history.length - 1] === '/settings') { + this.props.history.push('/settings/globalblocking'); + } } /** diff --git a/app/scss/partials/_callout.scss b/app/scss/partials/_callout.scss index d0f63d4db..fc259c4bd 100644 --- a/app/scss/partials/_callout.scss +++ b/app/scss/partials/_callout.scss @@ -63,6 +63,7 @@ .needs-reload-link, .filter-link, .sign-in-link, + .settings-link, .verify-account-link { @extend %pointer; margin-left: 5px;