summaryrefslogtreecommitdiffstats
path: root/browser/components/asrouter/content-src/components
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/asrouter/content-src/components')
-rw-r--r--browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx25
-rw-r--r--browser/components/asrouter/content-src/components/ASRouterAdmin/CopyButton.jsx2
-rw-r--r--browser/components/asrouter/content-src/components/ConditionalWrapper/ConditionalWrapper.jsx9
-rw-r--r--browser/components/asrouter/content-src/components/ImpressionsWrapper/ImpressionsWrapper.jsx76
4 files changed, 12 insertions, 100 deletions
diff --git a/browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx b/browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx
index f16dbacbd8..befce707ef 100644
--- a/browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx
+++ b/browser/components/asrouter/content-src/components/ASRouterAdmin/ASRouterAdmin.jsx
@@ -258,7 +258,7 @@ export class ASRouterAdminInner extends React.PureComponent {
ASRouterUtils.sendMessage({ type: "RESET_PROVIDER_PREF" });
}
- resetGroups(id, value) {
+ resetGroups() {
ASRouterUtils.sendMessage({
type: "RESET_GROUPS_STATE",
}).then(this.setStateFromParent);
@@ -387,7 +387,7 @@ export class ASRouterAdminInner extends React.PureComponent {
}
// Simulate a copy event that sets to clipboard all targeting paramters and values
- onCopyTargetingParams(event) {
+ onCopyTargetingParams() {
const stringTargetingParameters = {
...this.state.stringTargetingParameters,
};
@@ -507,7 +507,7 @@ export class ASRouterAdminInner extends React.PureComponent {
isBlocked ? null : isModified ? (
<button
className="button restore"
- onClick={e => this.resetJSON(msg)}
+ onClick={() => this.resetJSON(msg)}
>
Reset
</button>
@@ -523,7 +523,7 @@ export class ASRouterAdminInner extends React.PureComponent {
{isBlocked ? null : (
<button
className="button modify"
- onClick={e => this.modifyJson(msg)}
+ onClick={() => this.modifyJson(msg)}
>
Modify
</button>
@@ -557,7 +557,7 @@ export class ASRouterAdminInner extends React.PureComponent {
name={msg.id}
className="general-textarea"
disabled={isBlocked}
- onChange={e => this.handleChange(msg.id)}
+ onChange={() => this.handleChange(msg.id)}
>
{JSON.stringify(msg, null, 2)}
</textarea>
@@ -647,7 +647,7 @@ export class ASRouterAdminInner extends React.PureComponent {
</button>
<button
className="ASRouterButton slim button"
- onClick={e => this.resetPBJSON(msg)}
+ onClick={() => this.resetPBJSON(msg)}
>
Reset JSON
</button>
@@ -698,7 +698,7 @@ export class ASRouterAdminInner extends React.PureComponent {
<div>
<button
className="ASRouterButton slim"
- onClick={e => this.toggleAllMessages(messagesToShow)}
+ onClick={() => this.toggleAllMessages(messagesToShow)}
>
Collapse/Expand All
</button>
@@ -1046,7 +1046,7 @@ export class ASRouterAdminInner extends React.PureComponent {
});
}
- setAttribution(e) {
+ setAttribution() {
ASRouterUtils.sendMessage({
type: "FORCE_ATTRIBUTION",
data: this.state.attributionParameters,
@@ -1307,7 +1307,7 @@ export class ASRouterAdminInner extends React.PureComponent {
<h2>Messages</h2>
<button
className="ASRouterButton slim button"
- onClick={e => this.toggleAllMessages(messagesToShow)}
+ onClick={() => this.toggleAllMessages(messagesToShow)}
>
Collapse/Expand All
</button>
@@ -1359,10 +1359,7 @@ export class ASRouterAdminInner extends React.PureComponent {
<tbody>
{this.state.groups &&
this.state.groups.map(
- (
- { id, enabled, frequency, userPreferences = [] },
- index
- ) => (
+ ({ id, enabled, frequency, userPreferences = [] }) => (
<Row key={id}>
<td>
<TogglePrefCheckbox
@@ -1473,7 +1470,7 @@ export class ASRouterAdminInner extends React.PureComponent {
Need help using these tools? Check out our{" "}
<a
target="blank"
- href="https://firefox-source-docs.mozilla.org/browser/components/newtab/content-src/asrouter/docs/debugging-docs.html"
+ href="https://firefox-source-docs.mozilla.org/browser/components/asrouter/docs/debugging-docs.html"
>
documentation
</a>
diff --git a/browser/components/asrouter/content-src/components/ASRouterAdmin/CopyButton.jsx b/browser/components/asrouter/content-src/components/ASRouterAdmin/CopyButton.jsx
index 6739d38b97..3233b42032 100644
--- a/browser/components/asrouter/content-src/components/ASRouterAdmin/CopyButton.jsx
+++ b/browser/components/asrouter/content-src/components/ASRouterAdmin/CopyButton.jsx
@@ -26,7 +26,7 @@ export const CopyButton = ({
timeout.current = setTimeout(() => setCopied(false), 1500);
}, [inputSelector, transformer]);
return (
- <button className={className} onClick={e => onClick()} {...props}>
+ <button className={className} onClick={() => onClick()} {...props}>
{(copied && copiedLabel) || label}
</button>
);
diff --git a/browser/components/asrouter/content-src/components/ConditionalWrapper/ConditionalWrapper.jsx b/browser/components/asrouter/content-src/components/ConditionalWrapper/ConditionalWrapper.jsx
deleted file mode 100644
index e4b0812f26..0000000000
--- a/browser/components/asrouter/content-src/components/ConditionalWrapper/ConditionalWrapper.jsx
+++ /dev/null
@@ -1,9 +0,0 @@
-/* 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/. */
-
-// lifted from https://gist.github.com/kitze/23d82bb9eb0baabfd03a6a720b1d637f
-const ConditionalWrapper = ({ condition, wrap, children }) =>
- condition && wrap ? wrap(children) : children;
-
-export default ConditionalWrapper;
diff --git a/browser/components/asrouter/content-src/components/ImpressionsWrapper/ImpressionsWrapper.jsx b/browser/components/asrouter/content-src/components/ImpressionsWrapper/ImpressionsWrapper.jsx
deleted file mode 100644
index 8498bde03b..0000000000
--- a/browser/components/asrouter/content-src/components/ImpressionsWrapper/ImpressionsWrapper.jsx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* 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 from "react";
-
-export const VISIBLE = "visible";
-export const VISIBILITY_CHANGE_EVENT = "visibilitychange";
-
-/**
- * Component wrapper used to send telemetry pings on every impression.
- */
-export class ImpressionsWrapper extends React.PureComponent {
- // This sends an event when a user sees a set of new content. If content
- // changes while the page is hidden (i.e. preloaded or on a hidden tab),
- // only send the event if the page becomes visible again.
- sendImpressionOrAddListener() {
- if (this.props.document.visibilityState === VISIBLE) {
- this.props.sendImpression({ id: this.props.id });
- } else {
- // We should only ever send the latest impression stats ping, so remove any
- // older listeners.
- if (this._onVisibilityChange) {
- this.props.document.removeEventListener(
- VISIBILITY_CHANGE_EVENT,
- this._onVisibilityChange
- );
- }
-
- // When the page becomes visible, send the impression stats ping if the section isn't collapsed.
- this._onVisibilityChange = () => {
- if (this.props.document.visibilityState === VISIBLE) {
- this.props.sendImpression({ id: this.props.id });
- this.props.document.removeEventListener(
- VISIBILITY_CHANGE_EVENT,
- this._onVisibilityChange
- );
- }
- };
- this.props.document.addEventListener(
- VISIBILITY_CHANGE_EVENT,
- this._onVisibilityChange
- );
- }
- }
-
- componentWillUnmount() {
- if (this._onVisibilityChange) {
- this.props.document.removeEventListener(
- VISIBILITY_CHANGE_EVENT,
- this._onVisibilityChange
- );
- }
- }
-
- componentDidMount() {
- if (this.props.sendOnMount) {
- this.sendImpressionOrAddListener();
- }
- }
-
- componentDidUpdate(prevProps) {
- if (this.props.shouldSendImpressionOnUpdate(this.props, prevProps)) {
- this.sendImpressionOrAddListener();
- }
- }
-
- render() {
- return this.props.children;
- }
-}
-
-ImpressionsWrapper.defaultProps = {
- document: global.document,
- sendOnMount: true,
-};