Restored to 'fece380e79bc6a9f228eab122f91603a7f302684'
Replit-Restored-To: fece380e79
This commit is contained in:
@@ -18,25 +18,15 @@ export default function AdSenseAd({
|
||||
const adRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
try {
|
||||
// Ensure adsbygoogle is loaded
|
||||
if (typeof window !== 'undefined' && adRef.current) {
|
||||
// Check if element has width before initializing ad
|
||||
const elementWidth = adRef.current.offsetWidth;
|
||||
if (elementWidth > 0) {
|
||||
// @ts-ignore
|
||||
(window.adsbygoogle = window.adsbygoogle || []).push({});
|
||||
} else {
|
||||
console.warn('AdSense element has no width, skipping initialization');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('AdSense initialization error:', error);
|
||||
try {
|
||||
// Ensure adsbygoogle is loaded
|
||||
if (typeof window !== 'undefined') {
|
||||
// @ts-ignore
|
||||
(window.adsbygoogle = window.adsbygoogle || []).push({});
|
||||
}
|
||||
}, 100); // Small delay to ensure DOM is rendered
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
} catch (error) {
|
||||
console.error('AdSense initialization error:', error);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const adStyle: React.CSSProperties = {
|
||||
@@ -52,7 +42,7 @@ export default function AdSenseAd({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`adsense-wrapper ${className}`} ref={adRef} style={{ minWidth: '300px', minHeight: '250px' }}>
|
||||
<div className={`adsense-wrapper ${className}`} ref={adRef}>
|
||||
<ins
|
||||
className="adsbygoogle"
|
||||
style={adStyle}
|
||||
|
||||
@@ -410,7 +410,7 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate
|
||||
{/* Scrollable video row - in container */}
|
||||
<div
|
||||
ref={scrollRef}
|
||||
className="flex gap-2 md:gap-3 overflow-x-auto scrollbar-hide py-2 md:py-4 px-3 md:px-2"
|
||||
className="flex gap-0 md:gap-3 overflow-x-auto scrollbar-hide py-2 md:py-4 px-3 md:px-2"
|
||||
style={{
|
||||
scrollbarWidth: 'none',
|
||||
msOverflowStyle: 'none',
|
||||
@@ -424,7 +424,7 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate
|
||||
{category.videos.map((video, index) => (
|
||||
<div
|
||||
key={video.id}
|
||||
className="flex-shrink-0 w-[calc(100vw-2.5rem)] sm:w-[330px] relative hover:z-50"
|
||||
className="flex-shrink-0 w-[calc(100vw-1.5rem)] sm:w-[330px] relative hover:z-50"
|
||||
style={{
|
||||
scrollSnapAlign: window.innerWidth < 768 ? 'start' : 'none'
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user