"use client";
import { useEffect, useState } from "react";
import Image from "next/image";
export function LoadingScreen() {
const [isVisible, setIsVisible] = useState(true);
useEffect(() => {
// Hide loading screen after a short delay to ensure everything is ready
const timer = setTimeout(() => {
setIsVisible(false);
}, 1000);
return () => clearTimeout(timer);
}, []);
if (!isVisible) return null;
return (
{/* Background pattern */}
{/* Loading content */}
{/* Logo with animation */}
{/* Loading text - closer to logo */}
not everyone gets blcklsted
{/* Loading dots */}
{/* Progress bar */}
);
}
export function PageWrapper({ children }: { children: React.ReactNode }) {
const [isLoading, setIsLoading] = useState(true);
const [showContent, setShowContent] = useState(false);
useEffect(() => {
// Check if page is ready
const checkReady = () => {
if (document.readyState === 'complete') {
setTimeout(() => {
setIsLoading(false);
setTimeout(() => setShowContent(true), 100);
}, 800);
}
};
if (document.readyState === 'complete') {
checkReady();
} else {
window.addEventListener('load', checkReady);
}
return () => {
window.removeEventListener('load', checkReady);
};
}, []);
return (
<>
{isLoading && }
{children}
>
);
}