import { Clock, Info } from "lucide-react"; import { useScoreAnalytics } from "./ScoreAnalyticsProvider"; import { useState, useEffect } from "react"; import { SamplingDetailsHoverCard } from "./SamplingDetailsHoverCard"; export function ScoreAnalyticsNoticeBanner() { const { isEstimating, estimate, isLoading, data } = useScoreAnalytics(); const [showLoadingBanner, setShowLoadingBanner] = useState(false); // Track when estimation starts and set delay for showing loading banner useEffect(() => { if (isEstimating || (estimate && isLoading)) { // Start timer - show banner after 1.5 seconds const timer = setTimeout(() => { setShowLoadingBanner(true); }, 1500); return () => clearTimeout(timer); } else { // Reset when loading completes setShowLoadingBanner(false); } }, [isEstimating, estimate, isLoading]); // Don't show anything if we haven't started if (!isEstimating && !estimate) return null; // State 1: Estimating (loading) if (isEstimating || (estimate && isLoading)) { const showLargeDataset = estimate && estimate.estimatedMatchedCount > 100_000; // Only show banner if: // 1. Delay has passed, OR // 2. We have estimate data showing it's a large dataset if (!showLoadingBanner && !showLargeDataset) { return null; } return (