import clsx from "clsx"; import { useInView } from "framer-motion"; import React from "react"; import { LandingHeroBeamGlowSvg, LandingHeroBeamSvg, } from "./icons/landing-hero-beam"; import { LandingHeroCenterSvg } from "./icons/landing-hero-center"; import { LandingHeroGridSvg } from "./icons/landing-hero-grid"; import { LandingHeroAntdIcon } from "./icons/landing-hero/antd"; import { LandingHeroAppwriteIcon } from "./icons/landing-hero/appwrite"; import { LandingHeroAuth0Icon } from "./icons/landing-hero/auth0"; import { LandingHeroChakraUIIcon } from "./icons/landing-hero/chakra"; import { LandingHeroGoogleIcon } from "./icons/landing-hero/google"; import { LandingHeroMaterialUIIcon } from "./icons/landing-hero/material-ui"; import { LandingHeroNestjsIcon } from "./icons/landing-hero/nestjs"; import { LandingHeroNextjsIcon } from "./icons/landing-hero/nextjs"; import { LandingHeroOktaIcon } from "./icons/landing-hero/okta"; import { LandingHeroRemixIcon } from "./icons/landing-hero/remix"; import { LandingHeroSupabaseIcon } from "./icons/landing-hero/supabase"; import { LandingHeroViteIcon } from "./icons/landing-hero/vite"; import { LandingHeroAnimationItem } from "./landing-hero-animation-item"; type ItemType = { icon: React.ComponentType>; name: string; color: string; rayClassName?: string; }; const platformItems: ItemType[] = [ { name: "OpenPanel", icon: (props: React.SVGProps) => ( ), color: "#ffa800", }, { name: "OpenAdmin", icon: (props: React.SVGProps) => ( ), color: "#ffffff", rayClassName: "!text-gray-1000 dark:!text-gray-0", }, { name: "OpenCLI", icon: (props: React.SVGProps) => ( ), color: "#ffffff", rayClassName: "!text-gray-1000 dark:!text-gray-0", }, ]; const uiItems: ItemType[] = [ { name: "WordPress", icon: (props: React.SVGProps) => ( ), color: "#007FFF", }, { name: "NodeJS", icon: (props: React.SVGProps) => ( ), color: "#148EFF", }, { name: "Python", icon: (props: React.SVGProps) => ( ), color: "#29C6B7", }, ]; const backendItems: ItemType[] = [ { name: "Nginx", icon: (props: React.SVGProps) => ( ), color: "#3ECF8E", }, { name: "Apache", icon: (props: React.SVGProps) => ( ), color: "#E0234E", }, { name: "LiteSpeed", icon: (props: React.SVGProps) => ( ), color: "#FD366E", }, ]; const authItems: ItemType[] = [ { name: "ModSecurity", icon: (props: React.SVGProps) => ( ), color: "#EA4335", }, { name: "Docker", icon: (props: React.SVGProps) => ( ), color: "#EB5424", }, { name: "BIND9", icon: (props: React.SVGProps) => (
), color: "#ffffff", rayClassName: "!text-gray-1000 dark:!text-gray-0", }, ]; export const LandingHeroAnimation = React.memo(function HeroAnimation() { const ref = React.useRef(null); const inView = useInView(ref); const [activePlatform, setActivePlatform] = React.useState(0); const [activeUI, setActiveUI] = React.useState(0); const [activeBackend, setActiveBackend] = React.useState(0); const [activeAuth, setActiveAuth] = React.useState(0); React.useEffect(() => { if (inView) { let t1: NodeJS.Timeout | null = null; let t2: NodeJS.Timeout | null = null; let t3: NodeJS.Timeout | null = null; const interval = setInterval(() => { if (t1) clearTimeout(t1); if (t2) clearTimeout(t2); if (t3) clearTimeout(t3); setActivePlatform((prev) => (prev + 1) % platformItems.length); t1 = setTimeout(() => { setActiveUI((prev) => (prev + 1) % uiItems.length); }, 2000); t2 = setTimeout(() => { setActiveBackend( (prev) => (prev + 1) % backendItems.length, ); }, 4000); t3 = setTimeout(() => { setActiveAuth((prev) => (prev + 1) % authItems.length); }, 6000); }, 8000); return () => { clearInterval(interval); if (t1) clearTimeout(t1); if (t2) clearTimeout(t2); if (t3) clearTimeout(t3); }; } }, [inView]); return (
); });