Werbung
This commit is contained in:
parent
702e2710de
commit
54c3652c99
|
|
@ -1,4 +1,5 @@
|
||||||
import type { Metadata } from 'next';
|
import type { Metadata } from 'next';
|
||||||
|
import AdBanner from '@/components/ads/AdBanner';
|
||||||
import '@/styles/globals.css';
|
import '@/styles/globals.css';
|
||||||
import { Providers } from '@/components/Providers';
|
import { Providers } from '@/components/Providers';
|
||||||
import MarketingLayout from './MarketingLayout';
|
import MarketingLayout from './MarketingLayout';
|
||||||
|
|
@ -61,6 +62,15 @@ export default function MarketingGroupLayout({
|
||||||
<MarketingLayout>
|
<MarketingLayout>
|
||||||
{children}
|
{children}
|
||||||
</MarketingLayout>
|
</MarketingLayout>
|
||||||
|
{/* Global Marketing Ad - Exclusions handled in AdBanner */}
|
||||||
|
<div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-7xl pb-8">
|
||||||
|
<AdBanner
|
||||||
|
dataAdSlot="2607110637"
|
||||||
|
dataAdFormat="auto"
|
||||||
|
fullWidthResponsive={true}
|
||||||
|
className="bg-slate-50 rounded-xl p-4 border border-slate-100"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export default function ToolsLayout({
|
||||||
{/* AdBanner handles its own visibility - only shows when an ad is filled */}
|
{/* AdBanner handles its own visibility - only shows when an ad is filled */}
|
||||||
<div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-7xl pb-8">
|
<div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-7xl pb-8">
|
||||||
<AdBanner
|
<AdBanner
|
||||||
dataAdSlot="1234567890" // Placeholder
|
dataAdSlot="2607110637" // Anzeige 1
|
||||||
dataAdFormat="auto"
|
dataAdFormat="auto"
|
||||||
fullWidthResponsive={true}
|
fullWidthResponsive={true}
|
||||||
className="bg-slate-50 rounded-xl p-4 border border-slate-100"
|
className="bg-slate-50 rounded-xl p-4 border border-slate-100"
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ export const metadata: Metadata = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
import AdBanner from '@/components/ads/AdBanner'; // Import AdBanner
|
||||||
|
|
||||||
export default function MarketingDeGroupLayout({
|
export default function MarketingDeGroupLayout({
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
|
|
@ -72,6 +74,16 @@ export default function MarketingDeGroupLayout({
|
||||||
/>
|
/>
|
||||||
<MarketingDeLayout>
|
<MarketingDeLayout>
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
|
{/* Global Marketing Ad - Exclusions handled in AdBanner */}
|
||||||
|
<div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-7xl pb-8">
|
||||||
|
<AdBanner
|
||||||
|
dataAdSlot="2607110637"
|
||||||
|
dataAdFormat="auto"
|
||||||
|
fullWidthResponsive={true}
|
||||||
|
className="bg-slate-50 rounded-xl p-4 border border-slate-100"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</MarketingDeLayout>
|
</MarketingDeLayout>
|
||||||
</Providers>
|
</Providers>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
import { useEffect, useState, useRef } from 'react';
|
import { useEffect, useState, useRef } from 'react';
|
||||||
import { useSession } from 'next-auth/react';
|
import { useSession } from 'next-auth/react';
|
||||||
|
|
||||||
|
import { usePathname } from 'next/navigation';
|
||||||
|
|
||||||
interface AdBannerProps {
|
interface AdBannerProps {
|
||||||
dataAdSlot: string;
|
dataAdSlot: string;
|
||||||
dataAdFormat?: string;
|
dataAdFormat?: string;
|
||||||
|
|
@ -17,9 +19,30 @@ export default function AdBanner({
|
||||||
className = '',
|
className = '',
|
||||||
}: AdBannerProps) {
|
}: AdBannerProps) {
|
||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
|
const pathname = usePathname();
|
||||||
const adRef = useRef<HTMLModElement>(null);
|
const adRef = useRef<HTMLModElement>(null);
|
||||||
const [adFilled, setAdFilled] = useState(false);
|
const [adFilled, setAdFilled] = useState(false);
|
||||||
|
|
||||||
|
// Paths where ads should NOT be shown
|
||||||
|
const excludedPaths = [
|
||||||
|
'/', // English Home
|
||||||
|
'/de', // German Home
|
||||||
|
'/qr-code-erstellen', // German Landing
|
||||||
|
'/contact', // Contact
|
||||||
|
'/about', // About
|
||||||
|
'/legal', // Legal pages
|
||||||
|
'/privacy',
|
||||||
|
'/terms',
|
||||||
|
'/cookie-policy',
|
||||||
|
'/impressum',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Check if current path matches strictly or starts with excluded path (for nested legal/blog pages if needed, though mostly exact matches here)
|
||||||
|
const shouldExclude = excludedPaths.some(path => {
|
||||||
|
if (path === '/') return pathname === '/';
|
||||||
|
return pathname === path || pathname?.startsWith(`${path}/`);
|
||||||
|
});
|
||||||
|
|
||||||
// Check if user has a paid plan
|
// Check if user has a paid plan
|
||||||
const isPaidUser = session?.user && (
|
const isPaidUser = session?.user && (
|
||||||
session.user.plan === 'PRO' ||
|
session.user.plan === 'PRO' ||
|
||||||
|
|
@ -27,6 +50,8 @@ export default function AdBanner({
|
||||||
session.user.plan === 'LIFETIME'
|
session.user.plan === 'LIFETIME'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (shouldExclude) return null;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Don't load if loading session or if user is paid
|
// Don't load if loading session or if user is paid
|
||||||
if (status === 'loading' || isPaidUser) return;
|
if (status === 'loading' || isPaidUser) return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue