chore: normalize line endings
This commit is contained in:
@@ -1,59 +1,59 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useSession } from 'next-auth/react';
|
||||
|
||||
interface AdBannerProps {
|
||||
dataAdSlot: string;
|
||||
dataAdFormat?: string;
|
||||
fullWidthResponsive?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default function AdBanner({
|
||||
dataAdSlot,
|
||||
dataAdFormat = 'auto',
|
||||
fullWidthResponsive = true,
|
||||
className = '',
|
||||
}: AdBannerProps) {
|
||||
const { data: session, status } = useSession();
|
||||
|
||||
// Check if user has a paid plan
|
||||
// Adjust 'pro' or 'premium' based on your actual plan values
|
||||
const isPaidUser = session?.user && (
|
||||
session.user.plan === 'PRO' ||
|
||||
session.user.plan === 'PREMIUM' ||
|
||||
session.user.plan === 'LIFETIME'
|
||||
);
|
||||
|
||||
const [adLoaded, setAdLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// Don't load if loading session or if user is paid
|
||||
if (status === 'loading' || isPaidUser) return;
|
||||
|
||||
try {
|
||||
// @ts-ignore
|
||||
(window.adsbygoogle = window.adsbygoogle || []).push({});
|
||||
setAdLoaded(true);
|
||||
} catch (err) {
|
||||
console.error('AdSense error:', err);
|
||||
}
|
||||
}, [isPaidUser, status]);
|
||||
|
||||
// Don't render anything if paid user
|
||||
if (status === 'authenticated' && isPaidUser) return null;
|
||||
|
||||
return (
|
||||
<div className={`ad-container my-8 flex justify-center items-center overflow-hidden ${className}`} aria-hidden={true}>
|
||||
<ins
|
||||
className="adsbygoogle"
|
||||
style={{ display: 'block', minWidth: '300px', minHeight: '50px', width: '100%' }}
|
||||
data-ad-client="ca-pub-2782770414424875"
|
||||
data-ad-slot={dataAdSlot}
|
||||
data-ad-format={dataAdFormat}
|
||||
data-full-width-responsive={fullWidthResponsive}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useSession } from 'next-auth/react';
|
||||
|
||||
interface AdBannerProps {
|
||||
dataAdSlot: string;
|
||||
dataAdFormat?: string;
|
||||
fullWidthResponsive?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default function AdBanner({
|
||||
dataAdSlot,
|
||||
dataAdFormat = 'auto',
|
||||
fullWidthResponsive = true,
|
||||
className = '',
|
||||
}: AdBannerProps) {
|
||||
const { data: session, status } = useSession();
|
||||
|
||||
// Check if user has a paid plan
|
||||
// Adjust 'pro' or 'premium' based on your actual plan values
|
||||
const isPaidUser = session?.user && (
|
||||
session.user.plan === 'PRO' ||
|
||||
session.user.plan === 'PREMIUM' ||
|
||||
session.user.plan === 'LIFETIME'
|
||||
);
|
||||
|
||||
const [adLoaded, setAdLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// Don't load if loading session or if user is paid
|
||||
if (status === 'loading' || isPaidUser) return;
|
||||
|
||||
try {
|
||||
// @ts-ignore
|
||||
(window.adsbygoogle = window.adsbygoogle || []).push({});
|
||||
setAdLoaded(true);
|
||||
} catch (err) {
|
||||
console.error('AdSense error:', err);
|
||||
}
|
||||
}, [isPaidUser, status]);
|
||||
|
||||
// Don't render anything if paid user
|
||||
if (status === 'authenticated' && isPaidUser) return null;
|
||||
|
||||
return (
|
||||
<div className={`ad-container my-8 flex justify-center items-center overflow-hidden ${className}`} aria-hidden={true}>
|
||||
<ins
|
||||
className="adsbygoogle"
|
||||
style={{ display: 'block', minWidth: '300px', minHeight: '50px', width: '100%' }}
|
||||
data-ad-client="ca-pub-2782770414424875"
|
||||
data-ad-slot={dataAdSlot}
|
||||
data-ad-format={dataAdFormat}
|
||||
data-full-width-responsive={fullWidthResponsive}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user