"use client"; import { useState, useEffect } from "react"; import { X, ArrowRight } from 'lucide-react'; import { Button } from "@/components/ui/button"; export function GeyserFundAlertOverlay() { const [isVisible, setIsVisible] = useState(false); // Check if the feature is enabled via environment variable const showGeyserFund = process.env.NEXT_PUBLIC_SHOW_GEYSER_FUND === 'true'; // Show the alert after a short delay for better UX, but only if enabled useEffect(() => { if (!showGeyserFund) return; const timer = setTimeout(() => { setIsVisible(true); }, 1000); return () => clearTimeout(timer); }, [showGeyserFund]); // Store dismissal in localStorage to avoid showing again in the same session const handleDismiss = () => { setIsVisible(false); localStorage.setItem("geyserAlertDismissed", "true"); }; // Check if user has already dismissed useEffect(() => { const isDismissed = localStorage.getItem("geyserAlertDismissed") === "true"; if (isDismissed) { setIsVisible(false); } }, []); // Don't render anything if the feature is disabled or not visible if (!showGeyserFund || !isVisible) return null; return (
Join our community initiative to preserve natural geysers. Every donation helps protect these natural wonders for future generations.