Skip to content

Commit

Permalink
Update RampUnit.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
xHomu committed Sep 10, 2024
1 parent 4826f58 commit 6a9b955
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/routes/_site+/_components/RampUnit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,21 @@ export function AdUnit({
const [startDetect, setStartDetect] = useState(true);
const [detected, setDetected] = useState(false);

// Run Adblock detection
useEffect(() => {
if (startDetect) {
if (startDetect && enableAds && process.env.NODE_ENV === "production") {
detectAdblock((enable) => {
setStartDetect(false);
setDetected(enable);
});
}
}, [startDetect]);
}, [startDetect, enableAds]);

if (!enableAds) return <></>;

className = className + " h-[250px] tablet:h-[90px]"; // set Default height to fix ad cls
// set Default height to fix ad cls, only in production when adblock is not detected
if (!detected && process.env.NODE_ENV === "production")
className = className + " h-[250px] tablet:h-[90px]";

return (
<ClientOnly fallback={<div className={className} />}>
Expand Down

0 comments on commit 6a9b955

Please sign in to comment.