diff --git a/client/src/components/interstitial-ad.tsx b/client/src/components/interstitial-ad.tsx index 8dd5675..cd8c1a1 100644 --- a/client/src/components/interstitial-ad.tsx +++ b/client/src/components/interstitial-ad.tsx @@ -5,10 +5,15 @@ import AdSense from "./adsense"; const COUNTER_KEY = "folx-interstitial-count"; const DELAY_MS = 3000; -export default function InterstitialAd() { +export default function InterstitialAd({ forceShow }: { forceShow?: boolean } = {}) { const [visible, setVisible] = useState(false); useEffect(() => { + if (forceShow) { + const timer = setTimeout(() => setVisible(true), DELAY_MS); + return () => clearTimeout(timer); + } + const raw = sessionStorage.getItem(COUNTER_KEY); const count = raw ? parseInt(raw, 10) : 0; const next = count + 1; @@ -19,7 +24,7 @@ export default function InterstitialAd() { const timer = setTimeout(() => setVisible(true), DELAY_MS); return () => clearTimeout(timer); - }, []); + }, [forceShow]); useEffect(() => { if (visible) { diff --git a/client/src/pages/horoscope.tsx b/client/src/pages/horoscope.tsx index edb2c21..fd7bd25 100644 --- a/client/src/pages/horoscope.tsx +++ b/client/src/pages/horoscope.tsx @@ -21,6 +21,7 @@ import { } from "lucide-react"; import Header from "@/components/header"; import Footer from "@/components/footer"; +import InterstitialAd from "@/components/interstitial-ad"; import { InArticleAd, PageSideAds } from "@/components/adsense"; import { SIGNS, @@ -395,6 +396,7 @@ export default function HoroscopePage() { return (