Spaces:
Paused
Paused
feat: complete HUBAPI overhaul (Security, i18n RTL, Dark/Light Mode, A11y & Performance fixes)
587459d Download components/WaitlistSocialProofTicker.tsx from samirhosninet/HubAPI: direct link, hf CLI and curl.
- Browser
- Download file 4.45 kB
-
https://huggingface.co/spaces/samirhosninet/HubAPI/resolve/main/components/WaitlistSocialProofTicker.tsx
- Command line
-
hf download hf://spaces/samirhosninet/HubAPI/components/WaitlistSocialProofTicker.tsx
-
curl -L -o WaitlistSocialProofTicker.tsx https://huggingface.co/spaces/samirhosninet/HubAPI/resolve/main/components/WaitlistSocialProofTicker.tsx
4.45 kB
| "use client"; | |
| import React, { useState, useEffect } from "react"; | |
| import { motion, AnimatePresence } from "framer-motion"; | |
| import { X, ArrowRight } from "lucide-react"; | |
| import { useLanguage } from "@/components/LanguageContext"; | |
| export function WaitlistSocialProofTicker() { | |
| const { t, language } = useLanguage(); | |
| const [isVisible, setIsVisible] = useState(false); | |
| const [isDismissed, setIsDismissed] = useState(false); | |
| const [queueCount, setQueueCount] = useState(2147); | |
| useEffect(() => { | |
| if (isDismissed) return; | |
| // Show initial notification after a brief delay | |
| const initialDelay = setTimeout(() => { | |
| setIsVisible(true); | |
| }, 2000); | |
| // Simulate occasional live queue increments | |
| const interval = setInterval(() => { | |
| if (Math.random() > 0.5) { | |
| setQueueCount((prev) => prev + Math.floor(Math.random() * 3) + 1); | |
| } | |
| }, 8500); | |
| return () => { | |
| clearTimeout(initialDelay); | |
| clearInterval(interval); | |
| }; | |
| }, [isDismissed]); | |
| if (isDismissed) return null; | |
| return ( | |
| <AnimatePresence> | |
| {isVisible && ( | |
| <motion.div | |
| initial={{ opacity: 0, y: 50, scale: 0.95 }} | |
| animate={{ opacity: 1, y: 0, scale: 1 }} | |
| exit={{ opacity: 0, y: 30, scale: 0.95 }} | |
| transition={{ duration: 0.5, ease: "easeOut" }} | |
| className="group fixed bottom-6 left-1/2 -translate-x-1/2 z-50 w-max max-w-[calc(100vw-3rem)] bg-black/90 dark:bg-black/95 backdrop-blur-md border border-primary/20 px-4 sm:px-5 py-3 shadow-[0_10px_30px_rgba(255,170,64,0.06)] flex items-center gap-3 sm:gap-4 text-left font-mono text-[10px] sm:text-xs select-none rounded-full cursor-pointer hover:border-primary/40 hover:bg-black transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-black" | |
| role="status" | |
| aria-live="polite" | |
| onClick={() => { | |
| // Focus on waitlist form or scroll to it | |
| document.getElementById('email-input')?.scrollIntoView({ behavior: 'smooth', block: 'center' }); | |
| setTimeout(() => { | |
| document.getElementById('email-input')?.focus(); | |
| }, 500); | |
| }} | |
| > | |
| {/* Glowing Green Signal Pulse */} | |
| <div className="shrink-0 flex items-center justify-center"> | |
| <span className="relative flex h-2 w-2"> | |
| <span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span> | |
| <span className="relative inline-flex rounded-full h-2 w-2 bg-emerald-500"></span> | |
| </span> | |
| </div> | |
| {/* Event Content */} | |
| <div className="flex items-center gap-2 sm:gap-3 overflow-hidden text-ellipsis whitespace-nowrap"> | |
| <span className="text-amber-400 font-bold uppercase tracking-widest text-[9px] sm:text-[10px]">{t("tickerLive")}</span> | |
| <span className="text-white/45">•</span> | |
| <span className="text-zinc-300 font-medium"> | |
| {language === "ar" ? ( | |
| <> | |
| هناك <span className="font-bold text-white">{queueCount.toLocaleString()}</span> {t("tickerDevelopers")} | |
| </> | |
| ) : ( | |
| <> | |
| <span className="font-bold text-white">{queueCount.toLocaleString()}</span> {t("tickerDevelopers")} | |
| </> | |
| )} | |
| </span> | |
| <span className="hidden sm:inline text-white/45">•</span> | |
| <span className="hidden sm:flex items-center gap-1.5 text-amber-400/80 font-semibold group-hover:text-amber-400 transition-colors"> | |
| {t("tickerClaim")} <ArrowRight className="w-3 h-3 transition-transform group-hover:translate-x-0.5 rtl:rotate-180" /> | |
| </span> | |
| </div> | |
| {/* Close Action */} | |
| <button | |
| onClick={(e) => { | |
| e.stopPropagation(); | |
| setIsVisible(false); | |
| setTimeout(() => setIsDismissed(true), 500); | |
| }} | |
| className="ml-auto text-zinc-500 hover:text-white transition-colors p-1 rounded-full cursor-pointer focus:outline-none focus:ring-1 focus:ring-amber-500 shrink-0" | |
| aria-label={t("tickerDismiss")} | |
| > | |
| <X className="w-3.5 h-3.5" /> | |
| </button> | |
| </motion.div> | |
| )} | |
| </AnimatePresence> | |
| ); | |
| } | |