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

Next

Show plus promo modal on first view of Home view of each Hub session

  • Loading branch information
wlycdgr committed Sep 16, 2019
commit 5102f35dc2c4add89076b3a90da8923b9ad69686
@@ -12,7 +12,7 @@
*/

import { log, sendMessageInPromise } from '../../utils';
import { GET_HOME_PROPS, SET_METRICS } from './HomeViewConstants';
import { GET_HOME_PROPS, MARK_PLUS_PROMO_MODAL_SHOWN, SET_METRICS } from './HomeViewConstants';

export function getHomeProps() {
return function(dispatch) {
@@ -39,3 +39,9 @@ export function setMetrics(actionData) {
});
};
}

export function markPlusPromoModalShown() {
return {
type: MARK_PLUS_PROMO_MODAL_SHOWN,
};
}
@@ -13,4 +13,5 @@

// Home View
export const GET_HOME_PROPS = 'GET_HOME_PROPS';
export const MARK_PLUS_PROMO_MODAL_SHOWN = 'MARK_PLUS_PROMO_MODAL_SHOWN';
export const SET_METRICS = 'SET_METRICS';
@@ -14,7 +14,9 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import QueryString from 'query-string';
import { NavLink } from 'react-router-dom';
import HomeView from './HomeView';
import { Modal } from '../../../shared-components';

/**
* @class Implement the Home View for the Ghostery Hub
@@ -28,6 +30,7 @@ class HomeViewContainer extends Component {
const { justInstalled } = QueryString.parse(window.location.search);
this.state = {
justInstalled: justInstalled === 'true',
showPlusPromoModal: !props.home.plus_promo_modal_shown,
};

const title = t('hub_home_page_title');
@@ -45,12 +48,38 @@ class HomeViewContainer extends Component {
this.props.actions.setMetrics({ enable_metrics });
}

_dismissModal = () => {
this.setState({
showPlusPromoModal: false,
});
this.props.actions.markPlusPromoModalShown();
}

_renderModalChildren = () => (
<div className="SetupModal__content flex-container flex-dir-column align-middle">
<div className="SetupModal__image" />
<div className="SetupModal__text flex-child-grow">
{t('hub_setup_enter_modal_text')}
</div>
<div className="button success hollow" onClick={this._dismissModal}>
<span>Select Basic</span>
</div>
<div className="SetupModal__buttonContainer full-width">
<div className="full-width flex-container align-justify">
<NavLink to="/" className="button success hollow">
{t('hub_setup_modal_button_no')}
</NavLink>
</div>
</div>
</div>
);

/**
* React's required render function. Returns JSX
* @return {JSX} JSX for rendering the Home View of the Hub app
*/
render() {
const { justInstalled } = this.state;
const { justInstalled, showPlusPromoModal } = this.state;
const { home, user } = this.props;
const {
setup_complete,
@@ -67,35 +96,45 @@ class HomeViewContainer extends Component {
isPlus: user && user.subscriptionsPlus || false,
};

return <HomeView {...childProps} />;
return (
<div className="full-height">
<Modal show={showPlusPromoModal}>
{this._renderModalChildren()}
</Modal>
<HomeView {...childProps} />
</div>
);
}
}

// PropTypes ensure we pass required props of the correct type
// Note: isRequired is not needed when a prop has a default value
HomeViewContainer.propTypes = {
home: PropTypes.shape({
enable_metrics: PropTypes.bool,
plus_promo_modal_shown: PropTypes.bool,
setup_complete: PropTypes.bool,
tutorial_complete: PropTypes.bool,
enable_metrics: PropTypes.bool,
}),
user: PropTypes.shape({
email: PropTypes.string,
subscriptionsPlus: PropTypes.bool,
}),
actions: PropTypes.shape({
getHomeProps: PropTypes.func.isRequired,
setMetrics: PropTypes.func.isRequired,
getUser: PropTypes.func.isRequired,
markPlusPromoModalShown: PropTypes.func.isRequired,
setMetrics: PropTypes.func.isRequired,
}).isRequired,
};

// Default props used on the Home View
HomeViewContainer.defaultProps = {
home: {
enable_metrics: false,
plus_promo_modal_shown: false,
setup_complete: false,
tutorial_complete: false,
enable_metrics: false,
},
user: {
email: '',
@@ -11,7 +11,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0
*/

import { GET_HOME_PROPS, SET_METRICS } from './HomeViewConstants';
import { GET_HOME_PROPS, MARK_PLUS_PROMO_MODAL_SHOWN, SET_METRICS } from './HomeViewConstants';

const initialState = {};

@@ -31,6 +31,13 @@ function HomeViewReducer(state = initialState, action) {
}),
});
}
case MARK_PLUS_PROMO_MODAL_SHOWN: {
return Object.assign({}, state, {
home: Object.assign({}, state.home, {
plus_promo_modal_shown: true,
})
});
}
case SET_METRICS: {
const { enable_metrics } = action.data;
return Object.assign({}, state, {
ProTip! Use n and p to navigate between commits in a pull request.