-
{ t('panel_help_panel_header') }
-
-
-
+ return (
+
+
+
+
{ t('panel_help_panel_header') }
+
+
{t('panel_help_setup')}
+
+
+
- );
- }
-}
+
+ );
+};
export default Help;
diff --git a/app/panel/components/Subscribe.jsx b/app/panel/components/Subscribe.jsx
index b1cfc6834..62797e8e2 100644
--- a/app/panel/components/Subscribe.jsx
+++ b/app/panel/components/Subscribe.jsx
@@ -12,8 +12,10 @@
*/
import React from 'react';
import { NavLink } from 'react-router-dom';
+import PanelToTabLink from './BuildingBlocks/PanelToTabLink';
import { sendMessage, openSubscriptionPage } from '../utils/msg';
+
/**
* Helper function to handle clicking on the Become a Subscriber button
*/
@@ -34,9 +36,9 @@ const Subscribe = (props) => {
-
+
{t('subscribe_pitch_learn_more')}
-
+
{t('subscribe_pitch_button_label')}
diff --git a/app/panel/utils/msg.js b/app/panel/utils/msg.js
index 3ac8904dd..c417f1194 100644
--- a/app/panel/utils/msg.js
+++ b/app/panel/utils/msg.js
@@ -140,6 +140,24 @@ export function sendRewardMessage(name, message, callback = defaultCallback()) {
}, callback);
}
+/**
+ * Handle clicks on links with a fixed destination
+ */
+export function handleClickOnNewTabLink(e) {
+ e.preventDefault();
+
+ let linkTag = e.target;
+ while (!linkTag.href) {
+ linkTag = linkTag.parentElement;
+ }
+ const { href } = linkTag;
+
+ sendMessage('openNewTab', {
+ url: href,
+ become_active: true,
+ });
+}
+
/**
* Send a message to open a Subscription or Subscribe tab.
* Which one is determined in background based on the current user state.
@@ -157,7 +175,8 @@ export function openSubscriptionPage() {
* This should be used for messages that don't require a callback.
* @memberOf PanelUtils
*/
-export function openSupportPage() {
+export function openSupportPage(e) {
+ e.preventDefault();
sendMessage('account.openSupportPage');
window.close();
}
diff --git a/app/shared-components/I18nWithLink/I18nWithLink.jsx b/app/shared-components/I18nWithLink/I18nWithLink.jsx
new file mode 100644
index 000000000..16f60e996
--- /dev/null
+++ b/app/shared-components/I18nWithLink/I18nWithLink.jsx
@@ -0,0 +1,52 @@
+/**
+ * I18nWithLink Component
+ *
+ * Ghostery Browser Extension
+ * https://www.ghostery.com/
+ *
+ * Copyright 2019 Ghostery, Inc. All rights reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0
+ */
+
+import React, { Component, createRef } from 'react';
+import PropTypes from 'prop-types';
+
+import { handleClickOnNewTabLink } from '../../panel/utils/msg';
+
+/**
+ * A React component for i18n strings that need to include links
+ * @return {JSX} JSX for rendering an i18n string with embedded links
+ * @memberof SharedComponents
+ */
+class I18nWithLink extends Component {
+ constructor(props) {
+ super(props);
+ this.containerRef = createRef();
+ }
+
+ componentDidMount() {
+ const { current: { children } } = this.containerRef;
+ for (let i = 0; i < children.length; i++) {
+ const ele = children[i];
+ if (ele.nodeName.toLowerCase() === 'a') {
+ ele.onclick = e => handleClickOnNewTabLink(e);
+ }
+ }
+ }
+
+ render() {
+ const { value } = this.props;
+ return (
+
+ );
+ }
+}
+
+export default I18nWithLink;
+
+I18nWithLink.propTypes = {
+ value: PropTypes.string.isRequired,
+};
diff --git a/app/shared-components/I18nWithLink/index.js b/app/shared-components/I18nWithLink/index.js
new file mode 100644
index 000000000..c8dfa5de1
--- /dev/null
+++ b/app/shared-components/I18nWithLink/index.js
@@ -0,0 +1,16 @@
+/**
+ * Point of entry index.js file for I18nWithLink
+ *
+ * Ghostery Browser Extension
+ * https://www.ghostery.com/
+ *
+ * Copyright 2019 Ghostery, Inc. All rights reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0
+ */
+
+import I18nWithLink from './I18nWithLink';
+
+export default I18nWithLink;