import { Styles, createElement } from '../ui_styles.js'; import { WindowManager } from '../overlays/window_manager.js'; export const Visualizers = { init(container) { const MB = window.MagicBot; this.createLogOverlay(); const wrapper = createElement('div', 'margin-top: 10px; border-top: 1px solid #444; padding-top: 10px;'); // Logs and HUDs const btnRow = createElement('div', 'display: flex; gap: 5px; margin-bottom: 5px;'); const btnLogs = createElement('button', Styles.button + 'flex: 1; background: #5c6bc0;', { textContent: 'Logs', onclick: () => { const el = document.getElementById('magic-bot-logs'); if (el) el.style.display = el.style.display === 'none' ? 'flex' : 'none'; } }); const btnState = createElement('button', Styles.button + 'flex: 1; background: #ab47bc;', { textContent: 'All HUDs', onclick: () => { if (window.MagicBot_Overlays) { window.MagicBot_Overlays.openAll(); } } }); btnRow.appendChild(btnLogs); btnRow.appendChild(btnState); wrapper.appendChild(btnRow); // Individual toggles for specific useful overlays const extraRow = createElement('div', 'display: flex; gap: 5px;'); const btnPets = createElement('button', Styles.button + 'flex: 1; background: #ffa726; color: #222;', { textContent: 'Pets', onclick: () => { if (window.MagicBot_Overlays && window.MagicBot_Overlays.openPets) { window.MagicBot_Overlays.openPets(); } } }); const btnModel = createElement('button', Styles.button + 'flex: 1; background: #26a69a; color: #eee;', { textContent: 'Model', onclick: () => { if (window.MagicBot_Overlays && window.MagicBot_Overlays.openModel) { window.MagicBot_Overlays.openModel(); } } }); extraRow.appendChild(btnPets); extraRow.appendChild(btnModel); wrapper.appendChild(extraRow); container.appendChild(wrapper); // Bind Status Indicator MB.on('socket_connected', (connected) => { const el = document.getElementById('mb-status-ind'); if (el) { el.textContent = connected ? '● Connected' : '● Disconnected'; el.style.color = connected ? Styles.colors.success : Styles.colors.danger; } }); MB.on('log', (msg) => { this.logToOverlay(msg.type, msg.data); }); }, createLogOverlay() { if (document.getElementById('magic-bot-logs')) return; const logOverlay = createElement('div', ` display: none; position: fixed; bottom: 20px; left: 20px; width: 600px; height: 300px; background: rgba(10, 10, 15, 0.95); border: 1px solid #444; border-radius: 8px; z-index: 9999999; font-family: 'Consolas', 'Monaco', monospace; font-size: 11px; color: #eee; flex-direction: column; box-shadow: 0 4px 15px rgba(0,0,0,0.6); resize: both; overflow: hidden; `, { id: 'magic-bot-logs' }); logOverlay.innerHTML = `