feat: add clear/limpiar button to sandbox toolbar

Stops audio and removes all modules and connections from the canvas.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jose Luis
2026-03-21 05:13:42 +01:00
parent 589fbcf533
commit 4517e49ea6

View File

@@ -243,6 +243,12 @@ export default function App({ onSwitchToGame }) {
emit();
};
const handleClearCanvas = () => {
if (state.isRunning) stopAudio();
deserialize({ modules: [], connections: [] });
emit();
};
return (
<div className="app">
{/* Toolbar */}
@@ -269,6 +275,9 @@ export default function App({ onSwitchToGame }) {
<button className="toolbar-btn" onClick={handleLoadDemo} style={{ color: 'var(--yellow)' }}>
🎮 Chiptune Demo
</button>
<button className="toolbar-btn" onClick={handleClearCanvas}>
🗑 Limpiar
</button>
<div className="toolbar-sep" />
<span className="toolbar-label" style={{ color: state.isRunning ? 'var(--green)' : 'var(--text2)' }}>
{state.isRunning ? '● LIVE' : '○ OFF'}