import { useEffect } from "react"; import { Outlet, useLocation } from "react-router"; import { ParticleBackground } from "@/components/particle-background"; import { Sidebar } from "@/components/sidebar"; import { useAuthStore } from "@/models/auth"; import { useInstanceStore } from "@/models/instance"; import { useSettingsStore } from "@/models/settings"; import { useGameStore } from "@/stores/game-store"; export function IndexPage() { const authStore = useAuthStore(); const settingsStore = useSettingsStore(); const instanceStore = useInstanceStore(); const initGameLifecycle = useGameStore((state) => state.initLifecycle); const location = useLocation(); useEffect(() => { authStore.init(); settingsStore.refresh(); instanceStore.refresh(); void initGameLifecycle().catch((error) => { console.error("Failed to initialize game lifecycle:", error); }); }, [authStore.init, settingsStore.refresh, instanceStore.refresh, initGameLifecycle]); return (
{settingsStore.config?.customBackgroundPath && ( <> Background console.error("Failed to load main background:", e) } /> {/* Dimming Overlay for readability */}
)} {!settingsStore.config?.customBackgroundPath && ( <> {settingsStore.theme === "dark" ? (
) : (
)} {location.pathname === "/" && }
)} {/* Subtle Grid Overlay */}
); }