|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import React, { useState, useEffect } from "react"; |
| 4 | + |
| 5 | +export const LoadingOverlay = () => { |
| 6 | + const [terminalText, setTerminalText] = useState(""); |
| 7 | + const fullText = "INITIALIZING_NEURAL_ENGINE... [OK]"; |
| 8 | + |
| 9 | + useEffect(() => { |
| 10 | + let i = 0; |
| 11 | + const interval = setInterval(() => { |
| 12 | + setTerminalText(fullText.slice(0, i)); |
| 13 | + i++; |
| 14 | + if (i > fullText.length) i = 0; |
| 15 | + }, 100); |
| 16 | + return () => clearInterval(interval); |
| 17 | + }, []); |
| 18 | + |
| 19 | + return ( |
| 20 | + <div className="fixed inset-0 z-100 flex flex-col items-center justify-center bg-[#050505] font-mono"> |
| 21 | + {/* BACKGROUND GRID EFFECT */} |
| 22 | + <div |
| 23 | + className="absolute inset-0 opacity-10" |
| 24 | + style={{ |
| 25 | + backgroundImage: |
| 26 | + "linear-gradient(#333 1px, transparent 1px), linear-gradient(90deg, #333 1px, transparent 1px)", |
| 27 | + backgroundSize: "40px 40px", |
| 28 | + }} |
| 29 | + ></div> |
| 30 | + |
| 31 | + {/* RING CONTAINER */} |
| 32 | + <div className="relative flex h-64 w-64 items-center justify-center"> |
| 33 | + {/* Chromatic Orbiting Rings */} |
| 34 | + <div className="absolute h-36 w-36 rounded-full border border-red-500/40 mix-blend-screen blur-[2px] animate-[ring-pulse_4s_linear_infinite] scale-110"></div> |
| 35 | + <div className="absolute h-36 w-36 rounded-full border border-emerald-400/40 mix-blend-screen blur-[2px] animate-[ring-pulse_4s_linear_infinite_1s] scale-105"></div> |
| 36 | + <div className="absolute h-36 w-36 rounded-full border border-indigo-500/40 mix-blend-screen blur-[2px] animate-[ring-pulse_4s_linear_infinite_2s] scale-110"></div> |
| 37 | + |
| 38 | + {/* Technical Inner Ring */} |
| 39 | + <div className="absolute h-28 w-28 rounded-full border border-dashed border-white/20 animate-spin-slow"></div> |
| 40 | + |
| 41 | + {/* Core White Ring */} |
| 42 | + <div className="absolute h-32 w-32 rounded-full border-2 border-white shadow-[0_0_30px_rgba(255,255,255,0.2)] animate-[ring-pulse_3s_ease-in-out_infinite]"></div> |
| 43 | + |
| 44 | + {/* Binary Data Bits (Decorative) */} |
| 45 | + <div className="absolute inset-0 flex items-center justify-center opacity-40 text-[8px] text-emerald-500 pointer-events-none"> |
| 46 | + <div className="animate-pulse">01011001</div> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + |
| 50 | + {/* CODING VIBE TEXT ELEMENTS */} |
| 51 | + <div className="mt-8 flex flex-col items-center gap-4 z-10"> |
| 52 | + <div className="flex flex-col items-center"> |
| 53 | + <p className="text-xs tracking-[0.5em] text-zinc-500 uppercase mb-1"> |
| 54 | + System Status |
| 55 | + </p> |
| 56 | + <div className="flex items-baseline gap-2"> |
| 57 | + <span className="h-2 w-2 rounded-full bg-emerald-500 animate-pulse"></span> |
| 58 | + <p className="text-xl font-bold tracking-tighter text-white"> |
| 59 | + {terminalText} |
| 60 | + <span className="animate-bounce">_</span> |
| 61 | + </p> |
| 62 | + </div> |
| 63 | + </div> |
| 64 | + |
| 65 | + {/* DATA METRICS FOOTER */} |
| 66 | + <div className="mt-4 grid grid-cols-3 gap-8 text-[10px] text-zinc-600 border-t border-zinc-800 pt-4 uppercase tracking-widest"> |
| 67 | + <div className="flex flex-col items-center"> |
| 68 | + <span>CPU</span> |
| 69 | + <span className="text-emerald-400">88.4%</span> |
| 70 | + </div> |
| 71 | + <div className="flex flex-col items-center border-x border-zinc-800 px-8"> |
| 72 | + <span>MEM</span> |
| 73 | + <span className="text-indigo-400">12GB</span> |
| 74 | + </div> |
| 75 | + <div className="flex flex-col items-center"> |
| 76 | + <span>PING</span> |
| 77 | + <span className="text-red-400">14MS</span> |
| 78 | + </div> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + |
| 82 | + <style |
| 83 | + dangerouslySetInnerHTML={{ |
| 84 | + __html: ` |
| 85 | + @keyframes ring-pulse { |
| 86 | + 0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.3; } |
| 87 | + 50% { transform: scale(1.1) rotate(180deg); opacity: 0.7; } |
| 88 | + } |
| 89 | + .animate-spin-slow { |
| 90 | + animation: spin 10s linear infinite; |
| 91 | + } |
| 92 | + @keyframes spin { |
| 93 | + from { transform: rotate(0deg); } |
| 94 | + to { transform: rotate(360deg); } |
| 95 | + } |
| 96 | + .mix-blend-screen { |
| 97 | + mix-blend-mode: screen; |
| 98 | + } |
| 99 | + `, |
| 100 | + }} |
| 101 | + /> |
| 102 | + </div> |
| 103 | + ); |
| 104 | +}; |
| 105 | + |
| 106 | +export default LoadingOverlay; |
0 commit comments