'use client'; import { useEffect, useState } from 'react'; interface SearchLoadingAnimationProps { currentSource?: string; checkedSources?: number; totalSources?: number; } export function SearchLoadingAnimation({ currentSource, checkedSources = 0, totalSources = 16, }: SearchLoadingAnimationProps) { const [dots, setDots] = useState(''); useEffect(() => { const dotInterval = setInterval(() => { setDots((prev) => (prev.length >= 3 ? '' : prev + '.')); }, 500); return () => clearInterval(dotInterval); }, []); // Calculate progress (0-100%) const progress = totalSources > 0 ? (checkedSources / totalSources) * 100 : 0; const statusText = `${checkedSources}/${totalSources} 个源`; return (
{/* Loading Message with Icon */}
{/* Spinning Icon */} 正在搜索视频源{dots}
{/* Progress Bar - Unified 0-100% */}
{/* Shimmer Effect - Optimized for GPU */}
{/* Progress Info - Real-time count */}
{statusText} {Math.round(progress)}%
); }