From 65df03f76f6886c5500e23742c281cabd6463577 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 18 Sep 2019 17:54:43 -0400 Subject: [PATCH 1/5] Remove feature listing for ghostery rewards on Cliqz browser --- .../SideNavigationView/SideNavigationViewContainer.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx b/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx index a738680f8..5425a231c 100644 --- a/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx +++ b/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx @@ -16,6 +16,7 @@ import PropTypes from 'prop-types'; import SideNavigationView from './SideNavigationView'; import globals from '../../../../src/classes/Globals'; +const { IS_CLIQZ } = globals; /** * @class Implement the Side Navigation View for the Ghostery Hub * @extends Component @@ -46,7 +47,7 @@ class SideNavigationViewContainer extends Component { const { user, location } = this.props; const disableRegEx = /^(\/setup(?!\/4$))|(\/tutorial(?!\/6$))/; - const menuItems = [ + let menuItems = [ { href: '/', icon: 'home', text: t('hub_side_navigation_home') }, { href: '/setup', icon: 'setup', text: t('hub_side_navigation_setup') }, { href: '/tutorial', icon: 'tutorial', text: t('hub_side_navigation_tutorial') }, @@ -55,6 +56,10 @@ class SideNavigationViewContainer extends Component { { href: '/products', icon: 'products', text: t('hub_side_navigation_products') } ]; + if (IS_CLIQZ) { + menuItems = menuItems.filter(item => item.href !== '/rewards'); + } + const bottomItems = user ? [ { id: 'email', href: `https://account.${globals.GHOSTERY_DOMAIN}.com/`, text: user.email }, { id: 'logout', text: t('hub_side_navigation_log_out'), clickHandler: this._handleLogoutClick }, From 62b92e32f8e563de0739aee88e21a1849de0a223 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 18 Sep 2019 18:30:42 -0400 Subject: [PATCH 2/5] Refactored menu items to a constant --- .../SideNavigationViewContainer.jsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx b/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx index 5425a231c..8156b156d 100644 --- a/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx +++ b/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx @@ -47,19 +47,14 @@ class SideNavigationViewContainer extends Component { const { user, location } = this.props; const disableRegEx = /^(\/setup(?!\/4$))|(\/tutorial(?!\/6$))/; - let menuItems = [ + const menuItems = [ { href: '/', icon: 'home', text: t('hub_side_navigation_home') }, { href: '/setup', icon: 'setup', text: t('hub_side_navigation_setup') }, { href: '/tutorial', icon: 'tutorial', text: t('hub_side_navigation_tutorial') }, { href: '/plus', icon: 'plus', text: t('hub_side_navigation_supporter') }, - { href: '/rewards', icon: 'rewards', text: t('hub_side_navigation_rewards') }, - { href: '/products', icon: 'products', text: t('hub_side_navigation_products') } + ...(IS_CLIQZ ? [] : [{ href: '/rewards', icon: 'rewards', text: t('hub_side_navigation_rewards') }]), + ...[{ href: '/products', icon: 'products', text: t('hub_side_navigation_products') }] ]; - - if (IS_CLIQZ) { - menuItems = menuItems.filter(item => item.href !== '/rewards'); - } - const bottomItems = user ? [ { id: 'email', href: `https://account.${globals.GHOSTERY_DOMAIN}.com/`, text: user.email }, { id: 'logout', text: t('hub_side_navigation_log_out'), clickHandler: this._handleLogoutClick }, From b37308e69d44c0d4da210c974ba74917c5d28a71 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 20 Sep 2019 11:50:30 -0400 Subject: [PATCH 3/5] Refactored menuItems. Removed Ghostery Rewards reference in Cliqz browser Hub --- _locales/en/messages.json | 3 +++ app/hub/Views/HomeView/HomeView.jsx | 19 ++++++++++++++++--- .../SideNavigationViewContainer.jsx | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 960ddf419..dd184536f 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1395,6 +1395,9 @@ "hub_home_header_info": { "message": "New users are opted in to participating in Human Web and Ghostery Rewards. You may change these settings in custom setup or in the extension. " }, + "hub_home_header_info_cliqz": { + "message": "New users are opted in to participating in Human Web. You may change these settings in custom setup or in the extension. " + }, "hub_home_header_info_link": { "message": "Learn More." }, diff --git a/app/hub/Views/HomeView/HomeView.jsx b/app/hub/Views/HomeView/HomeView.jsx index 7369d40a6..81cb6d6eb 100644 --- a/app/hub/Views/HomeView/HomeView.jsx +++ b/app/hub/Views/HomeView/HomeView.jsx @@ -34,9 +34,22 @@ const HomeView = (props) => { isPlus, } = props; const accountHref = `https://account.${globals.GHOSTERY_DOMAIN}.com`; - const headerInfoText = (globals.BROWSER_INFO && globals.BROWSER_INFO.name === 'firefox') - ? t('hub_home_header_info_opted_out') - : t('hub_home_header_info'); + const browserName = globals.BROWSER_INFO.name; + + let headerInfoText; + if (globals.BROWSER_INFO) { + switch (browserName) { + case 'firefox': + headerInfoText = t('hub_home_header_info_opted_out'); + break; + case 'cliqz': + headerInfoText = t('hub_home_header_info_cliqz'); + break; + default: + headerInfoText = t('hub_home_header_info'); + } + } + const tutorialFeatureClassNames = ClassNames('HomeView__onboardingFeature columns flex-container align-middle flex-dir-column', { 'feature-tutorial-complete': tutorial_complete, 'feature-tutorial': !tutorial_complete, diff --git a/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx b/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx index 8156b156d..f3526640f 100644 --- a/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx +++ b/app/hub/Views/SideNavigationView/SideNavigationViewContainer.jsx @@ -53,7 +53,7 @@ class SideNavigationViewContainer extends Component { { href: '/tutorial', icon: 'tutorial', text: t('hub_side_navigation_tutorial') }, { href: '/plus', icon: 'plus', text: t('hub_side_navigation_supporter') }, ...(IS_CLIQZ ? [] : [{ href: '/rewards', icon: 'rewards', text: t('hub_side_navigation_rewards') }]), - ...[{ href: '/products', icon: 'products', text: t('hub_side_navigation_products') }] + { href: '/products', icon: 'products', text: t('hub_side_navigation_products') } ]; const bottomItems = user ? [ { id: 'email', href: `https://account.${globals.GHOSTERY_DOMAIN}.com/`, text: user.email }, From bb92e844f67aa38e78bcb38e59e803c2b8ea0db6 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 20 Sep 2019 11:53:45 -0400 Subject: [PATCH 4/5] Refactored to remove a variable --- app/hub/Views/HomeView/HomeView.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/hub/Views/HomeView/HomeView.jsx b/app/hub/Views/HomeView/HomeView.jsx index 81cb6d6eb..54f3d2d26 100644 --- a/app/hub/Views/HomeView/HomeView.jsx +++ b/app/hub/Views/HomeView/HomeView.jsx @@ -34,11 +34,10 @@ const HomeView = (props) => { isPlus, } = props; const accountHref = `https://account.${globals.GHOSTERY_DOMAIN}.com`; - const browserName = globals.BROWSER_INFO.name; let headerInfoText; if (globals.BROWSER_INFO) { - switch (browserName) { + switch (globals.BROWSER_INFO.name) { case 'firefox': headerInfoText = t('hub_home_header_info_opted_out'); break; From 511345293cf2334b8c2b2e2b2768010d79a9b340 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 20 Sep 2019 14:55:29 -0400 Subject: [PATCH 5/5] Refactor switch to if/else. Modify language. --- _locales/en/messages.json | 2 +- app/hub/Views/HomeView/HomeView.jsx | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index dd184536f..c3659b390 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1396,7 +1396,7 @@ "message": "New users are opted in to participating in Human Web and Ghostery Rewards. You may change these settings in custom setup or in the extension. " }, "hub_home_header_info_cliqz": { - "message": "New users are opted in to participating in Human Web. You may change these settings in custom setup or in the extension. " + "message": "New users are opted in to participating in Human Web. You may change this setting in custom setup or in the extension. " }, "hub_home_header_info_link": { "message": "Learn More." diff --git a/app/hub/Views/HomeView/HomeView.jsx b/app/hub/Views/HomeView/HomeView.jsx index 54f3d2d26..b22261ce3 100644 --- a/app/hub/Views/HomeView/HomeView.jsx +++ b/app/hub/Views/HomeView/HomeView.jsx @@ -35,17 +35,12 @@ const HomeView = (props) => { } = props; const accountHref = `https://account.${globals.GHOSTERY_DOMAIN}.com`; - let headerInfoText; + let headerInfoText = t('hub_home_header_info'); if (globals.BROWSER_INFO) { - switch (globals.BROWSER_INFO.name) { - case 'firefox': - headerInfoText = t('hub_home_header_info_opted_out'); - break; - case 'cliqz': - headerInfoText = t('hub_home_header_info_cliqz'); - break; - default: - headerInfoText = t('hub_home_header_info'); + if (globals.BROWSER_INFO.name === 'firefox') { + headerInfoText = t('hub_home_header_info_opted_out'); + } else if (globals.BROWSER_INFO.name === 'cliqz') { + headerInfoText = t('hub_home_header_info_cliqz'); } }