diff --git a/app/components/ads/bottom.jsx b/app/components/ads/bottom.jsx new file mode 100755 index 0000000..e361ce8 --- /dev/null +++ b/app/components/ads/bottom.jsx @@ -0,0 +1,101 @@ +"use client"; +import React, { useEffect, useState } from "react"; +import { FaChevronUp, FaChevronDown } from "react-icons/fa"; + +const BottomAd = () => { + const [isClient, setIsClient] = useState(false); + const [minimized, setMinimized] = useState(false); + + useEffect(() => { + setIsClient(true); + + if (typeof window !== "undefined") { + // Load AdSense script once + const scriptId = "adsbygoogle-js"; + if (!document.getElementById(scriptId)) { + const script = document.createElement("script"); + script.id = scriptId; + script.async = true; + script.src = + "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4311738896428559"; + script.crossOrigin = "anonymous"; + document.head.appendChild(script); + } + } + }, []); + + useEffect(() => { + if (isClient) { + try { + (window.adsbygoogle = window.adsbygoogle || []).push({}); + } catch (e) { + console.warn("AdSense error:", e); + } + } + }, [isClient]); + + if (!isClient) return null; + + // Detect environment for test ads + const isDev = + window.location.hostname === "localhost" || + window.location.hostname === "127.0.0.1"; + + return ( +
+ + + {minimized ? ( +
+ Ad minimized — click ▲ to reopen +
+ ) : ( + + )} +
+ ); +}; + +export default BottomAd; \ No newline at end of file diff --git a/app/page.jsx b/app/page.jsx index 92b5ea1..18fb76f 100755 --- a/app/page.jsx +++ b/app/page.jsx @@ -6,6 +6,7 @@ import Review from "@/app/components/review"; import Testimonial from "@/app/components/testimonial"; import Faq from "@/app/components/faq"; import Footer from "@/app/components/footer"; +import BottomAd from "./components/ads/bottom"; export const metadata = { title: 'DSA Visualizer | Visualize & Learn DSA the Smart Way', @@ -42,27 +43,32 @@ export const metadata = { export default function Home() { return ( -
- -
- + <> +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
+ + {/* Floating Ad — always visible at bottom */} + + ); } \ No newline at end of file