From 831d254261280289b9489877f991b5f4fb8e779d Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Sun, 28 Sep 2025 13:14:57 +0000 Subject: [PATCH] Add a header ad component to various pages across the platform Introduce a new `HeaderAd` component for displaying AdSense ads on multiple pages, including `FolxStadlPage`, `GeschichteLiedPage`, `GipfelstammtischPage`, `Impressum`, `LivePage`, `PrivacyPolicy`, `TermsOfService`, `VideoPage`, `admin`, `home`, and `not-found`. This component is implemented in `client/src/components/HeaderAd.tsx` and integrated into the respective page components. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 45a1dcfc-f8a2-475a-a6b9-96fbb841dc27 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/60d372ff-2c10-46c7-b01b-10c3435136b0/45a1dcfc-f8a2-475a-a6b9-96fbb841dc27/HUI2eAX --- .replit | 4 --- client/src/components/HeaderAd.tsx | 34 +++++++++++++++++++++++ client/src/pages/FolxStadlPage.tsx | 4 +++ client/src/pages/GeschichteLiedPage.tsx | 4 +++ client/src/pages/GipfelstammtischPage.tsx | 4 +++ client/src/pages/Impressum.tsx | 4 +++ client/src/pages/LivePage.tsx | 4 +++ client/src/pages/PrivacyPolicy.tsx | 4 +++ client/src/pages/TermsOfService.tsx | 4 +++ client/src/pages/VideoPage.tsx | 4 +++ client/src/pages/admin.tsx | 4 +++ client/src/pages/home.tsx | 4 +++ client/src/pages/not-found.tsx | 4 +++ 13 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 client/src/components/HeaderAd.tsx diff --git a/.replit b/.replit index 25d8e76..cd990cf 100644 --- a/.replit +++ b/.replit @@ -23,10 +23,6 @@ externalPort = 3001 localPort = 35637 externalPort = 3000 -[[ports]] -localPort = 41551 -externalPort = 3002 - [env] PORT = "5000" diff --git a/client/src/components/HeaderAd.tsx b/client/src/components/HeaderAd.tsx new file mode 100644 index 0000000..52804af --- /dev/null +++ b/client/src/components/HeaderAd.tsx @@ -0,0 +1,34 @@ +import { useEffect, useRef } from 'react'; + +export default function HeaderAd() { + const adRef = useRef(null); + + useEffect(() => { + const initializeAd = () => { + const insElement = adRef.current?.querySelector('ins'); + if (!insElement || insElement.dataset.adsbygoogleStatus === 'done') return; + + try { + // @ts-ignore + (window.adsbygoogle = window.adsbygoogle || []).push({}); + } catch (error) { + console.error('Header AdSense initialization error:', error); + } + }; + + // Initialize the ad immediately + initializeAd(); + }, []); + + return ( +
+ {/* Fixed Header/Footer Ad */} + +
+ ); +} \ No newline at end of file diff --git a/client/src/pages/FolxStadlPage.tsx b/client/src/pages/FolxStadlPage.tsx index 248c65f..191b508 100644 --- a/client/src/pages/FolxStadlPage.tsx +++ b/client/src/pages/FolxStadlPage.tsx @@ -9,6 +9,7 @@ import type { Video } from '@shared/schema'; import { Input } from '@/components/ui/input'; import { Search } from 'lucide-react'; import AdSenseAd from '@/components/adsense-ad'; +import HeaderAd from '@/components/HeaderAd'; export default function FolxStadlPage() { const [selectedVideo, setSelectedVideo] = useState