"use client"; import { useEffect, useState, useSyncExternalStore } from "react"; import { closeGameLaunch, getGameLaunchState, subscribeGameLaunch } from "@/components/providers/game-launch-store"; import { Button } from "@/components/ui/button"; import { X } from "lucide-react"; import { RobloxLogoIcon } from "@/components/roblox/RobloxIcons"; import Link from "next/link"; export function GameLaunchDialog() { const state = useSyncExternalStore( subscribeGameLaunch, getGameLaunchState, getGameLaunchState ); const [launchTimeouted, setLaunchTimeouted] = useState(false); useEffect(() => { if (!state.isOpen) { setLaunchTimeouted(false); return; } const timeout = setTimeout(() => { setLaunchTimeouted(true); }, 5000); // 5 seconds return () => clearTimeout(timeout); }, [state.isOpen]); if (!state.isOpen) return null; return (
event.stopPropagation()} >

{!launchTimeouted ? ( <> Roblox is now loading.
Get Ready! ) : ( <>Download Roblox to play millions of experiences! )}

); }