@littlepartytime/dev-kit 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/webapp/pages/Preview.tsx +38 -11
- package/package.json +1 -1
|
@@ -160,10 +160,28 @@ export default function Preview() {
|
|
|
160
160
|
}
|
|
161
161
|
}, [playerCount, playerIndex]);
|
|
162
162
|
|
|
163
|
+
// Resizable split panel
|
|
164
|
+
const [splitRatio, setSplitRatio] = useState(0.6); // left column gets 60%
|
|
165
|
+
const panelRef = useRef<HTMLDivElement>(null);
|
|
166
|
+
const dragging = useRef(false);
|
|
167
|
+
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
const onMove = (e: MouseEvent) => {
|
|
170
|
+
if (!dragging.current || !panelRef.current) return;
|
|
171
|
+
const rect = panelRef.current.getBoundingClientRect();
|
|
172
|
+
const ratio = (e.clientX - rect.left) / rect.width;
|
|
173
|
+
setSplitRatio(Math.min(0.8, Math.max(0.2, ratio)));
|
|
174
|
+
};
|
|
175
|
+
const onUp = () => { dragging.current = false; document.body.style.cursor = ''; document.body.style.userSelect = ''; };
|
|
176
|
+
window.addEventListener('mousemove', onMove);
|
|
177
|
+
window.addEventListener('mouseup', onUp);
|
|
178
|
+
return () => { window.removeEventListener('mousemove', onMove); window.removeEventListener('mouseup', onUp); };
|
|
179
|
+
}, []);
|
|
180
|
+
|
|
163
181
|
return (
|
|
164
182
|
<div className="flex gap-4 h-[calc(100vh-80px)]">
|
|
165
|
-
{/* Renderer —
|
|
166
|
-
<div className="shrink-0 h-full">
|
|
183
|
+
{/* Renderer — fixed width matching the phone body */}
|
|
184
|
+
<div className="shrink-0 h-full" style={{ width: 420 }}>
|
|
167
185
|
<PhoneFrame>
|
|
168
186
|
{GameRenderer && platform && viewState ? (
|
|
169
187
|
<GameRenderer platform={platform} state={viewState} />
|
|
@@ -175,10 +193,10 @@ export default function Preview() {
|
|
|
175
193
|
</PhoneFrame>
|
|
176
194
|
</div>
|
|
177
195
|
|
|
178
|
-
{/* Control Panel — fills remaining width, two-column
|
|
179
|
-
<div className="flex-1 min-w-0
|
|
196
|
+
{/* Control Panel — fills remaining width, resizable two-column */}
|
|
197
|
+
<div ref={panelRef} className="flex-1 min-w-0 flex h-full">
|
|
180
198
|
{/* Left column: Players & Controls */}
|
|
181
|
-
<div className="flex flex-col gap-4">
|
|
199
|
+
<div className="flex flex-col gap-4 overflow-auto pr-1" style={{ width: `${splitRatio * 100}%` }}>
|
|
182
200
|
{/* Player Count */}
|
|
183
201
|
<div className="bg-zinc-900 rounded-lg p-3">
|
|
184
202
|
<h3 className="text-sm font-bold text-zinc-400 mb-2">Player Count</h3>
|
|
@@ -200,9 +218,10 @@ export default function Preview() {
|
|
|
200
218
|
const isActive = i === playerIndex;
|
|
201
219
|
const hue = (i * 137) % 360; // deterministic color per player
|
|
202
220
|
const playerState = fullState?.players?.find((ps: any) => ps.id === p.id);
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
221
|
+
const ROLE_KEYS = ['role', 'character', 'team', 'class', 'job', 'faction', 'type'];
|
|
222
|
+
const roleEntry = playerState
|
|
223
|
+
? Object.entries(playerState).find(([k]) => ROLE_KEYS.includes(k.toLowerCase()))
|
|
224
|
+
: undefined;
|
|
206
225
|
return (
|
|
207
226
|
<button
|
|
208
227
|
key={p.id}
|
|
@@ -227,9 +246,9 @@ export default function Preview() {
|
|
|
227
246
|
<span className="text-[10px] text-amber-400 shrink-0">HOST</span>
|
|
228
247
|
)}
|
|
229
248
|
</div>
|
|
230
|
-
{
|
|
249
|
+
{roleEntry && (
|
|
231
250
|
<div className="text-[10px] text-zinc-500 truncate">
|
|
232
|
-
{
|
|
251
|
+
{String(roleEntry[1])}
|
|
233
252
|
</div>
|
|
234
253
|
)}
|
|
235
254
|
</div>
|
|
@@ -268,8 +287,16 @@ export default function Preview() {
|
|
|
268
287
|
)}
|
|
269
288
|
</div>
|
|
270
289
|
|
|
290
|
+
{/* Drag handle */}
|
|
291
|
+
<div
|
|
292
|
+
className="shrink-0 w-2 cursor-col-resize flex items-center justify-center group"
|
|
293
|
+
onMouseDown={() => { dragging.current = true; document.body.style.cursor = 'col-resize'; document.body.style.userSelect = 'none'; }}
|
|
294
|
+
>
|
|
295
|
+
<div className="w-0.5 h-8 bg-zinc-700 rounded group-hover:bg-zinc-500 transition-colors" />
|
|
296
|
+
</div>
|
|
297
|
+
|
|
271
298
|
{/* Right column: State & Logs */}
|
|
272
|
-
<div className="flex flex-col gap-4">
|
|
299
|
+
<div className="flex flex-col gap-4 overflow-auto pl-1" style={{ width: `${(1 - splitRatio) * 100}%` }}>
|
|
273
300
|
{/* State Editor */}
|
|
274
301
|
<div className="bg-zinc-900 rounded-lg p-3 flex-1 flex flex-col min-h-0">
|
|
275
302
|
<h3 className="text-sm font-bold text-zinc-400 mb-2">Game State (Full)</h3>
|