import { useEffect, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' import { prefersReducedMotion } from '@shared/motion/reducedMotion' import { ButtonLink } from '@shared/ui/Button' import { useSession } from '../auth/session' import { useInView } from './effects/useInView' import '@features/landing/styles/sections.css' // A placeholder code, not a plausible real one — this types out a UI demo, not live data. const COMMAND = '%config load ••••••••' const TYPE_DELAY_MS = 60 /** Cloud configs, told through the one thing a player actually does: a command in the game chat. */ export function CommandHero() { const { t } = useTranslation('landing') const { status } = useSession() return (

{t('cloud.title')}

{t('cloud.subtitle')}

{status === 'authenticated' ? ( {t('cloud.ctaAuthenticated')} ) : ( {t('cloud.ctaAnonymous')} )} {t('cloud.ctaShowcase')}
) } function ChatBar() { const { t } = useTranslation('landing') const [typed, setTyped] = useState(() => (prefersReducedMotion() ? COMMAND.length : 0)) const done = typed >= COMMAND.length // Typing starts once the chat is on screen, so the player actually sees the command go in. const ref = useRef(null) const inView = useInView(ref, { once: true, rootMargin: '-80px' }) useEffect(() => { if (done || !inView) return const t = setInterval(() => setTyped((n) => Math.min(n + 1, COMMAND.length)), TYPE_DELAY_MS) return () => clearInterval(t) }, [done, inView]) return (
) }