import { cn } from "@/lib/utils" import { Loader } from "./loader" import { ProgressBar } from "./progress-bar" import { useEffect, useRef } from "react" import anime from "animejs" import Image from "next/image" interface OverlayLoaderProps { text?: string className?: string show: boolean showProgress?: boolean duration?: number extra_info?: string onProgressComplete?: () => void } export const OverlayLoader = ({ text, className, show, showProgress = false, duration = 10, onProgressComplete, extra_info }: OverlayLoaderProps) => { const overlayRef = useRef(null); const contentRef = useRef(null); useEffect(() => { if (show && overlayRef.current && contentRef.current) { // Animate overlay fade in anime({ targets: overlayRef.current, opacity: [0, 1], duration: 300, easing: 'easeInOutQuad' }); // Animate content scale and fade in anime({ targets: contentRef.current, scale: [0.9, 1], opacity: [0, 1], duration: 400, easing: 'easeOutQuad' }); } }, [show]); if (!show) return null; return (
loading {showProgress ? (
{text && (

{text}

{extra_info &&

{extra_info}

}
)}
) : ( <>

{text}

{extra_info &&

{extra_info}

} //
//
//
// //
//
)}
) }