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

GH-1777 and GH-1776 Plus Promo modals #458

Merged
merged 26 commits into from Oct 16, 2019
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5102f35
Show plus promo modal on first view of Home view of each Hub session
wlycdgr Sep 16, 2019
e1c1f54
Stub out intro hub plus promo modal layout and implement its buttons
wlycdgr Sep 16, 2019
64869a5
Remove some unnecessary plus promo modal related CSS
wlycdgr Sep 17, 2019
5289bb9
Continue adding styling for plus promo modal
wlycdgr Sep 17, 2019
ce1fac9
Continue styling plus promo modal
wlycdgr Sep 18, 2019
361debe
Refactor plus promo modal CSS to improve alignment of elements
wlycdgr Sep 20, 2019
3c96366
Merge branch 'develop' into GH-1777/plus-intro-hub-promo
wlycdgr Sep 20, 2019
a60d6b4
Continue CSS work for plus promo modal
wlycdgr Sep 20, 2019
4f84229
Implement recommended gold banner in plus promo modal
wlycdgr Sep 23, 2019
3794709
Merge branch 'develop' into GH-1777/plus-intro-hub-promo
wlycdgr Sep 26, 2019
5cb13d5
Update and tweak plus promo modal design
wlycdgr Sep 27, 2019
f6d3298
Fix path bug in i18n-checker tool. Consolidate redundant entries in m…
wlycdgr Oct 1, 2019
4b16723
Additional consolidation of redundant and unused entries in messages
wlycdgr Oct 2, 2019
92d4923
Merge branch 'develop' into GH-1777/plus-intro-hub-promo
wlycdgr Oct 3, 2019
a1f102b
Merge branch 'develop' into GH-1777/plus-intro-hub-promo
wlycdgr Oct 3, 2019
569382e
Factor plus promo modal rendering out to shared component. Implement …
wlycdgr Oct 6, 2019
509f9eb
Move Plus Promo modal rendering to a PlusPromoModal shared component.…
wlycdgr Oct 7, 2019
833fdff
Create ModalPromos background class responsible for modal promo relat…
wlycdgr Oct 7, 2019
9e80640
Add local state to Panel to make sure component rerenders after user …
wlycdgr Oct 8, 2019
b03e312
Make PromoModals code more robust
wlycdgr Oct 8, 2019
a1270cc
Factor PlusPromoModal rendering out to helper in Panel. Extend condit…
wlycdgr Oct 8, 2019
cac56c1
Mark PromoModals methods as static. Refine PlusPromoModal implementat…
wlycdgr Oct 8, 2019
be05ce9
Add logic to hide plus promo modal from Insights subscribers. Cleanup…
wlycdgr Oct 9, 2019
ee361ad
Clean up. Finish string localization in PlusPromoModal
wlycdgr Oct 9, 2019
80d75fb
Pull non-shared upgrade version of plus promo modal out of shared Plu…
wlycdgr Oct 16, 2019
7c85e94
Remove debug console statement
wlycdgr Oct 16, 2019
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Move Plus Promo modal rendering to a PlusPromoModal shared component.…

… Begin to implement conditional panel display logic
  • Loading branch information
wlycdgr committed Oct 7, 2019
commit 509f9eb6e6dd787103a791eefb2c902bf4f4c90f
@@ -15,7 +15,8 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import QueryString from 'query-string';
import HomeView from './HomeView';
import { Modal } from '../../../shared-components';
import { PlusPromoModal } from '../../../shared-components';
import { sendMessage } from '../../utils';

/**
* @class Implement the Home View for the Ghostery Hub
@@ -30,7 +31,6 @@ class HomeViewContainer extends Component {
this.state = {
getUserResolved: false,
justInstalled: justInstalled === 'true',
plusPromoModalShown: props.home.plus_promo_modal_shown,
};

const title = t('hub_home_page_title');
@@ -62,17 +62,16 @@ class HomeViewContainer extends Component {
* Dismisses the Plus promo modal when user clicks either the Select Plus or Select Basic button
*/
_dismissModal = () => {
this.setState({
plusPromoModalShown: true,
});
this.props.actions.markPlusPromoModalShown();
sendMessage('SET_PLUS_PROMO_MODAL_SEEN', {});
}

_render() {
const { justInstalled, plusPromoModalShown } = this.state;
const { justInstalled } = this.state;
const { home, user } = this.props;
const isPlus = user && user.subscriptionsPlus || false;
const {
plus_promo_modal_shown,
setup_complete,
tutorial_complete,
enable_metrics,
@@ -89,9 +88,11 @@ class HomeViewContainer extends Component {

return (
<div className="full-height">
<Modal show={!isPlus && !plusPromoModalShown}>
{Modal.renderPlusPromo('inHub', this._dismissModal)}
</Modal>
<PlusPromoModal
show={!isPlus && !plus_promo_modal_shown}
location="hub"
clickHandler={this._dismissModal}
/>
<HomeView {...childProps} />
</div>
);
@@ -14,10 +14,14 @@

// Imports utilities from elsewhere in the codebase to reduce duplicate code
import { log } from '../../../src/utils/common';
import { sendMessageInPromise as importedSMIP } from '../../panel/utils/msg';
import { sendMessage as importedSM, sendMessageInPromise as importedSMIP } from '../../panel/utils/msg';

const sendMessageInPromise = function(name, message) {
return importedSMIP(name, message, 'ghostery-hub');
};

export { log, sendMessageInPromise };
const sendMessage = function(name, message) {
return importedSM(name, message, 'ghostery-hub');
};

export { log, sendMessage, sendMessageInPromise };
@@ -13,7 +13,7 @@

import React from 'react';
import Header from '../containers/HeaderContainer';
import Modal from '../../shared-components/Modal';
import { PlusPromoModal } from '../../shared-components';
import { DynamicUIPortContext } from '../contexts/DynamicUIPortContext';
import { sendMessage } from '../utils/msg';
import { setTheme } from '../utils/utils';
@@ -195,7 +195,7 @@ class Panel extends React.Component {
}

_plusPromoClickHandlerPlaceholder = () => {
console.error('IVZ Panfel#_plusPromoClickHandlerPlaceholder');
console.error('IVZ Panel#_plusPromoClickHandlerPlaceholder');
}

/**
@@ -210,11 +210,15 @@ class Panel extends React.Component {

const notificationText = this.props.notificationShown && this.renderNotification();

const { plusPromoModalSeen } = this.props;

return (
<div id="panel">
<Modal show>
{Modal.renderPlusPromo('inPanel', this._plusPromoClickHandlerPlaceholder)}
</Modal>
<PlusPromoModal
show={!plusPromoModalSeen}
location="panel"
clickHandler={this._plusPromoClickHandlerPlaceholder}
/>
<div className="callout-container">
<div className={`${(!notificationText ? 'hide ' : '') + this.props.notificationClasses} callout`}>
<svg onClick={this.closeNotification} width="15px" height="15px" viewBox="0 0 15 15" className="close-button">
@@ -76,6 +76,7 @@ html, body, #root {
// Imports from ../shared-components directory
@import '../shared-components/ExitButton/ExitButton.scss';
@import '../shared-components/Modal/Modal.scss';
@import '../shared-components/PlusPromoModal/PlusPromoModal.scss';
@import '../shared-components/SteppedNavigation/SteppedNavigation.scss';
@import '../shared-components/ToastMessage/ToastMessage.scss';
@import '../shared-components/ToggleCheckbox/ToggleCheckbox.scss';
@@ -76,3 +76,4 @@ html body {

// Imports from ../shared-components directory
@import '../shared-components/Modal/Modal.scss';
@import '../shared-components/PlusPromoModal/PlusPromoModal.scss';
@@ -13,7 +13,6 @@

import React from 'react';
import PropTypes from 'prop-types';
import ClassNames from 'classnames';

/**
* A Functional React component for a Modal
@@ -33,104 +32,6 @@ const Modal = props => (
</div>
);

Modal.renderPlusPromo = (location, clickHandler) => {
const isInHub = location === 'inHub';
const isInPanel = location === 'inPanel';

const locationClassName = {
'in-hub': isInHub,
'in-panel': isInPanel
};
const contentClassNames = ClassNames(
'PlusPromoModal__content',
'flex-container',
'flex-dir-column',
'align-middle',
locationClassName
);
const chooseYourPlanClassNames = ClassNames(
'PlusPromoModal__choose-your-plan',
locationClassName
);
const recommendedBannerClassNames = ClassNames(
'PlusPromoModal__recommended-banner',
locationClassName
);
const optionDescriptionBoxClassNames = ClassNames(
'PlusPromoModal__option-description-box',
locationClassName
);

return (
<div className={contentClassNames}>
<div className="PlusPromoModal__buttons-background" />
{isInHub && (
<div className="PlusPromoModal__thanks-for-download">
{t('thanks_for_downloading_ghostery')}
</div>
)}
<div className={chooseYourPlanClassNames}>
{isInHub ? t('choose_your_privacy_plan') : t('choose_your_ghostery_privacy_plan')}
</div>
<div className="PlusPromoModal__options-container full-width">
<div className="PlusPromoModal__option-container">
<div className={`${optionDescriptionBoxClassNames} basic`}>
<div className="PlusPromoModal__option-header basic">{t('ghostery_basic')}</div>
<div className="PlusPromoModal__price-text basic">
<span className="PlusPromoModal__currency-sign">{t('locale_appropriate_currency_icon')}</span>
<span className="PlusPromoModal__amount">0</span>
<span> </span>
<span className="PlusPromoModal__per-month">{t('per_month')}</span>
</div>
<div className="PlusPromoModal__option-description">
<div className="PlusPromoModal__option-description-item no-capitalize">{t('protection_for_this_browser')}</div>
<div className="PlusPromoModal__option-description-item">{t('blocks_ads')}</div>
<div className="PlusPromoModal__option-description-item">{t('blocks_trackers')}</div>
<div className="PlusPromoModal__option-description-item">{t('fast_browsing')}</div>
</div>
</div>
<div className="PlusPromoModal__button basic button" onClick={clickHandler}>
<span>{t('select_basic')}</span>
</div>
</div>
<div className="PlusPromoModal__option-container">
<div className={`${optionDescriptionBoxClassNames} plus`}>
<div className={recommendedBannerClassNames}>
<img src="/app/images/hub/home/recommended-banner.svg" />
<div className="PlusPromoModal__recommended-banner-text">{t('recommended')}</div>
</div>
<div className="PlusPromoModal__option-header plus">Ghostery Plus</div>
<div className="PlusPromoModal__price-text plus">
<span className="PlusPromoModal__currency-sign">{t('locale_appropriate_currency_icon')}</span>
<span className="PlusPromoModal__amount">{t('plus_monthly_subscription_price_number')}</span>
<span> </span>
<span className="PlusPromoModal__per-month">per month</span>
</div>
<div className="PlusPromoModal__option-description">
<div className="PlusPromoModal__option-description-item italic">All basic features, plus:</div>
<div className="PlusPromoModal__plus-option-description-item-container">
<img className="PlusPromoModal__check-icon" src="/app/images/hub/home/check-icon.svg" />
<div className="PlusPromoModal__option-description-item">Historical Tracker Stats</div>
</div>
<div className="PlusPromoModal__plus-option-description-item-container">
<img className="PlusPromoModal__check-icon" src="/app/images/hub/home/check-icon.svg" />
<div className="PlusPromoModal__option-description-item">Priority Support</div>
</div>
<div className="PlusPromoModal__plus-option-description-item-container">
<img className="PlusPromoModal__check-icon" src="/app/images/hub/home/check-icon.svg" />
<div className="PlusPromoModal__option-description-item">New Color Themes</div>
</div>
</div>
</div>
<a href="http://signon.ghostery.com/en/subscribe/" target="_blank" rel="noopener noreferrer" className="PlusPromoModal__button plus button" onClick={clickHandler}>
<span>Select Plus</span>
</a>
</div>
</div>
</div>
);
};

// PropTypes ensure we pass required props of the correct type
Modal.propTypes = {
show: PropTypes.bool.isRequired,
ProTip! Use n and p to navigate between commits in a pull request.