Skip to content

Commit

Permalink
[docs] Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jul 4, 2020
1 parent 3559d71 commit decb376
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions docs/src/modules/components/Ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ function Ad(props) {

const [adblock, setAdblock] = React.useState(null);
const [carbonOut, setCarbonOut] = React.useState(null);
const [codeFundOut, setCodeFundOut] = React.useState(null);

let children;

Expand All @@ -134,7 +133,7 @@ function Ad(props) {
}

if (!children) {
if (carbonOut || codeFundOut) {
if (carbonOut) {
children = <AdInHouse ad={inHouseAds[Math.floor(inHouseAds.length * randomInHouse)]} />;
} else {
children = <AdCarbon />;
Expand All @@ -147,9 +146,7 @@ function Ad(props) {
if (children.type === AdCarbon) {
label = 'carbon';
} else if (children.type === AdInHouse) {
if (!adblock && codeFundOut) {
label = 'in-house-codefund';
} else if (!adblock && carbonOut) {
if (!adblock && carbonOut) {
label = 'in-house-carbon';
} else {
label = 'in-house';
Expand All @@ -171,7 +168,6 @@ function Ad(props) {
if (
document.querySelector('.cf-wrapper') ||
document.querySelector('#carbonads') ||
codeFundOut ||
carbonOut
) {
if (
Expand All @@ -196,7 +192,7 @@ function Ad(props) {
setAdblock(true);
}
},
[codeFundOut, carbonOut],
[carbonOut],
);

React.useEffect(() => {
Expand All @@ -210,18 +206,6 @@ function Ad(props) {
};
}, [checkAdblock]);

React.useEffect(() => {
const handler = (nativeEvent) => {
if (nativeEvent.detail.status === 'no-advertiser') {
setCodeFundOut(true);
}
};
window.addEventListener('codefund', handler);
return () => {
window.removeEventListener('codefund', handler);
};
}, []);

React.useEffect(() => {
// Avoid an exceed on the Google Analytics quotas.
if (Math.random() < 0.9) {
Expand Down

0 comments on commit decb376

Please sign in to comment.