Restored to 'fece380e79bc6a9f228eab122f91603a7f302684'
Replit-Restored-To: fece380e79
This commit is contained in:
parent
7d11140852
commit
1185bfc3af
@ -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'
|
||||
}}
|
||||
|
||||
@ -100,33 +100,18 @@ export class BunnyService {
|
||||
// No tags from Bunny.net - keeping tags empty
|
||||
const tags: string[] = [];
|
||||
|
||||
// Clean up title by removing .mp4 extension if present
|
||||
let cleanTitle = bunnyVideo.title || 'Untitled Video';
|
||||
if (cleanTitle.toLowerCase().endsWith('.mp4')) {
|
||||
cleanTitle = cleanTitle.slice(0, -4);
|
||||
}
|
||||
|
||||
return {
|
||||
id: bunnyVideo.guid,
|
||||
title: cleanTitle,
|
||||
artist: null, // No artist data from Bunny.net
|
||||
title: bunnyVideo.title || 'Untitled Video',
|
||||
description: description,
|
||||
filename: null, // No filename data from Bunny.net
|
||||
episodeNumber: null, // No episode number from Bunny.net
|
||||
episodeTitle: null, // No episode title from Bunny.net
|
||||
thumbnailUrl,
|
||||
customThumbnailUrl: null,
|
||||
faceCenterPosition: null,
|
||||
facesDetected: null,
|
||||
faceConfidence: null,
|
||||
videoUrl: hlsUrl, // Signed HLS URL
|
||||
videoUrlMp4: hlsUrl, // Use signed HLS URL for preview as well
|
||||
videoUrlIframe: iframeUrl, // iframe fallback
|
||||
duration: Math.floor(bunnyVideo.length || 0),
|
||||
views: bunnyVideo.views || 0,
|
||||
category: category,
|
||||
contentType: "video" as const, // Default content type
|
||||
genre: "other" as const, // Default genre
|
||||
tags: tags,
|
||||
isPublic: true,
|
||||
uploadStatus: "completed",
|
||||
@ -136,6 +121,9 @@ export class BunnyService {
|
||||
resolution: null,
|
||||
format: null,
|
||||
encoding: null,
|
||||
faceCenterPosition: null,
|
||||
facesDetected: null,
|
||||
faceConfidence: null,
|
||||
createdAt: new Date(bunnyVideo.dateUploaded),
|
||||
updatedAt: new Date(bunnyVideo.dateUploaded)
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user