blob: 4f80cb069e64ad7002ff877978c1df9b95ca31c2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
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 (
<div
className="relative z-10 h-full overflow-y-auto custom-scrollbar scroll-smooth"
style={{
overflow: releasesStore.isLoading ? "hidden" : "auto",
}}
>
{/* Hero Section (Full Height) - Interactive area */}
<div
role="tab"
className="min-h-full flex flex-col justify-end p-12 pb-32 cursor-grab active:cursor-grabbing select-none"
onMouseDown={handleSaturnMouseDown}
onMouseMove={handleMouseMove}
onMouseUp={handleSaturnMouseUp}
onMouseLeave={handleSaturnMouseLeave}
onTouchStart={handleSaturnTouchStart}
onTouchMove={handleSaturnTouchMove}
onTouchEnd={handleSaturnTouchEnd}
tabIndex={0}
>
{/* 3D Floating Hero Text */}
<div
className="transition-transform duration-200 ease-out origin-bottom-left"
style={{
transform: `perspective(1000px) rotateX(${mouseY * -1}deg) rotateY(${mouseX * 1}deg)`,
}}
>
<div className="flex items-center gap-3 mb-6">
<div className="h-px w-12 bg-white/50"></div>
<span className="text-xs font-mono font-bold tracking-[0.2em] text-white/50 uppercase">
Launcher Active
</span>
</div>
<h1 className="text-8xl font-black tracking-tighter text-white mb-6 leading-none">
MINECRAFT
</h1>
<div className="flex items-center gap-4">
<div className="bg-white/10 backdrop-blur-md border border-white/10 px-3 py-1 rounded-sm text-xs font-bold uppercase tracking-widest text-white shadow-sm">
Java Edition
</div>
<div className="h-4 w-px bg-white/20"></div>
<div className="text-sm text-zinc-400">
Latest Release{" "}
<span className="text-white font-medium">
{gameStore.latestRelease?.id || "..."}
</span>
</div>
</div>
</div>
{/* Action Area */}
<div className="mt-8 flex gap-4">
<div className="text-zinc-500 text-sm font-mono">
> Ready to launch session.
</div>
</div>
<BottomBar />
</div>
</div>
);
}
|