import React, { useState } from 'react'; export default function PreviewPanel({ code }) { const [gameUrl, setGameUrl] = useState(''); const [settings, setSettings] = useState(null); const [loadingSetup, setLoadingSetup] = useState(false); const fetchBoard = async () => { if (!gameUrl.trim()) return; setLoadingSetup(true); try { const res = await fetch( `/api/fetch-board?url=${encodeURIComponent(gameUrl.trim())}` ); if (!res.ok) throw new Error('Fetch board failed'); setSettings(await res.json()); } catch (err) { console.error(err); } finally { setLoadingSetup(false); } }; const gameId = gameUrl.trim().split('/').pop(); return (

🎯 Live Arena Output

setGameUrl(e.target.value)} style={{ width: '100%', padding: '0.5rem', marginBottom: '0.75rem', border: 'none', borderRadius: 4, background: 'transparent', color: '#fff', outline: 'none' }} />
{/*
*/}
{settings && gameId && (