import { useEffect, useState } from "react"; import { BottomBar } from "@/components/bottom-bar"; import type { SaturnEffect } from "@/lib/effects/SaturnEffect"; import { useGameStore } from "../stores/game-store"; import { useReleasesStore } from "../stores/releases-store"; export function HomeView() { const gameStore = useGameStore(); const releasesStore = useReleasesStore(); const [mouseX, setMouseX] = useState(0); const [mouseY, setMouseY] = useState(0); useEffect(() => { releasesStore.loadReleases(); }, [releasesStore.loadReleases]); const handleMouseMove = (e: React.MouseEvent) => { const x = (e.clientX / window.innerWidth) * 2 - 1; const y = (e.clientY / window.innerHeight) * 2 - 1; setMouseX(x); setMouseY(y); // Forward mouse move to SaturnEffect (if available) for parallax/rotation interactions try { const saturn = ( window as unknown as { getSaturnEffect?: () => SaturnEffect; } ).getSaturnEffect?.(); if (saturn?.handleMouseMove) { saturn.handleMouseMove(e.clientX); } } catch { /* best-effort, ignore errors from effect */ } }; const handleSaturnMouseDown = (e: React.MouseEvent) => { try { const saturn = (window as any).getSaturnEffect?.(); if (saturn?.handleMouseDown) { saturn.handleMouseDown(e.clientX); } } catch { /* ignore */ } }; const handleSaturnMouseUp = () => { try { const saturn = (window as any).getSaturnEffect?.(); if (saturn?.handleMouseUp) { saturn.handleMouseUp(); } } catch { /* ignore */ } }; const handleSaturnMouseLeave = () => { // Treat leaving the area as mouse-up for the effect try { const saturn = (window as any).getSaturnEffect?.(); if (saturn?.handleMouseUp) { saturn.handleMouseUp(); } } catch { /* ignore */ } }; const handleSaturnTouchStart = (e: React.TouchEvent) => { if (e.touches && e.touches.length === 1) { try { const clientX = e.touches[0].clientX; const saturn = (window as any).getSaturnEffect?.(); if (saturn?.handleTouchStart) { saturn.handleTouchStart(clientX); } } catch { /* ignore */ } } }; const handleSaturnTouchMove = (e: React.TouchEvent) => { if (e.touches && e.touches.length === 1) { try { const clientX = e.touches[0].clientX; const saturn = (window as any).getSaturnEffect?.(); if (saturn?.handleTouchMove) { saturn.handleTouchMove(clientX); } } catch { /* ignore */ } } }; const handleSaturnTouchEnd = () => { try { const saturn = (window as any).getSaturnEffect?.(); if (saturn?.handleTouchEnd) { saturn.handleTouchEnd(); } } catch { /* ignore */ } }; return (