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);
|
const adRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
try {
|
||||||
try {
|
// Ensure adsbygoogle is loaded
|
||||||
// Ensure adsbygoogle is loaded
|
if (typeof window !== 'undefined') {
|
||||||
if (typeof window !== 'undefined' && adRef.current) {
|
// @ts-ignore
|
||||||
// Check if element has width before initializing ad
|
(window.adsbygoogle = window.adsbygoogle || []).push({});
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}, 100); // Small delay to ensure DOM is rendered
|
} catch (error) {
|
||||||
|
console.error('AdSense initialization error:', error);
|
||||||
return () => clearTimeout(timer);
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const adStyle: React.CSSProperties = {
|
const adStyle: React.CSSProperties = {
|
||||||
@ -52,7 +42,7 @@ export default function AdSenseAd({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`adsense-wrapper ${className}`} ref={adRef} style={{ minWidth: '300px', minHeight: '250px' }}>
|
<div className={`adsense-wrapper ${className}`} ref={adRef}>
|
||||||
<ins
|
<ins
|
||||||
className="adsbygoogle"
|
className="adsbygoogle"
|
||||||
style={adStyle}
|
style={adStyle}
|
||||||
|
|||||||
@ -410,7 +410,7 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate
|
|||||||
{/* Scrollable video row - in container */}
|
{/* Scrollable video row - in container */}
|
||||||
<div
|
<div
|
||||||
ref={scrollRef}
|
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={{
|
style={{
|
||||||
scrollbarWidth: 'none',
|
scrollbarWidth: 'none',
|
||||||
msOverflowStyle: 'none',
|
msOverflowStyle: 'none',
|
||||||
@ -424,7 +424,7 @@ function CategoryRow({ category, onVideoClick, hideScrollButtons = false }: Cate
|
|||||||
{category.videos.map((video, index) => (
|
{category.videos.map((video, index) => (
|
||||||
<div
|
<div
|
||||||
key={video.id}
|
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={{
|
style={{
|
||||||
scrollSnapAlign: window.innerWidth < 768 ? 'start' : 'none'
|
scrollSnapAlign: window.innerWidth < 768 ? 'start' : 'none'
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -100,33 +100,18 @@ export class BunnyService {
|
|||||||
// No tags from Bunny.net - keeping tags empty
|
// No tags from Bunny.net - keeping tags empty
|
||||||
const tags: string[] = [];
|
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 {
|
return {
|
||||||
id: bunnyVideo.guid,
|
id: bunnyVideo.guid,
|
||||||
title: cleanTitle,
|
title: bunnyVideo.title || 'Untitled Video',
|
||||||
artist: null, // No artist data from Bunny.net
|
|
||||||
description: description,
|
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,
|
thumbnailUrl,
|
||||||
customThumbnailUrl: null,
|
customThumbnailUrl: null,
|
||||||
faceCenterPosition: null,
|
|
||||||
facesDetected: null,
|
|
||||||
faceConfidence: null,
|
|
||||||
videoUrl: hlsUrl, // Signed HLS URL
|
videoUrl: hlsUrl, // Signed HLS URL
|
||||||
videoUrlMp4: hlsUrl, // Use signed HLS URL for preview as well
|
videoUrlMp4: hlsUrl, // Use signed HLS URL for preview as well
|
||||||
videoUrlIframe: iframeUrl, // iframe fallback
|
videoUrlIframe: iframeUrl, // iframe fallback
|
||||||
duration: Math.floor(bunnyVideo.length || 0),
|
duration: Math.floor(bunnyVideo.length || 0),
|
||||||
views: bunnyVideo.views || 0,
|
views: bunnyVideo.views || 0,
|
||||||
category: category,
|
category: category,
|
||||||
contentType: "video" as const, // Default content type
|
|
||||||
genre: "other" as const, // Default genre
|
|
||||||
tags: tags,
|
tags: tags,
|
||||||
isPublic: true,
|
isPublic: true,
|
||||||
uploadStatus: "completed",
|
uploadStatus: "completed",
|
||||||
@ -136,6 +121,9 @@ export class BunnyService {
|
|||||||
resolution: null,
|
resolution: null,
|
||||||
format: null,
|
format: null,
|
||||||
encoding: null,
|
encoding: null,
|
||||||
|
faceCenterPosition: null,
|
||||||
|
facesDetected: null,
|
||||||
|
faceConfidence: null,
|
||||||
createdAt: new Date(bunnyVideo.dateUploaded),
|
createdAt: new Date(bunnyVideo.dateUploaded),
|
||||||
updatedAt: new Date(bunnyVideo.dateUploaded)
|
updatedAt: new Date(bunnyVideo.dateUploaded)
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user