From 2d175e571ffb2c709463e9ad26f16302ad9ceff2 Mon Sep 17 00:00:00 2001 From: thuanle Date: Sun, 3 Aug 2025 01:37:39 +0700 Subject: [PATCH] Implement bot status toggle functionality in agent.user.js, allowing users to switch between idle and running states. Update UI elements for better interaction and clarity, including improved status display and event handling for the toggle button. --- agent.user.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/agent.user.js b/agent.user.js index 2f0f1d1..fa5d052 100644 --- a/agent.user.js +++ b/agent.user.js @@ -633,7 +633,7 @@ GM_log('[TL] 🏁 Welcome to Binance Alpha Farm Agent.'); statusDisplay = '▶️ Running'; break; default: - statusDisplay = '❓ Unknown'; + statusDisplay = AppSettings.getBotStatus(); } // Get server info @@ -663,13 +663,13 @@ GM_log('[TL] 🏁 Welcome to Binance Alpha Farm Agent.'); 🐛 Debug: ${AppSettings.getDebug() ? '✔️ ON' : '❌ OFF'}
- Bot Status: ${statusDisplay} + 🤖 Bot Status: ${statusDisplay}
🌐 Server: ${serverLabel} ${serverConnected}
- 👤 Login:${loginStatus} + 👤 Login: ${loginStatus}
Page: ${pageDisplay} @@ -714,6 +714,18 @@ GM_log('[TL] 🏁 Welcome to Binance Alpha Farm Agent.'); }; } + // Add event listener for bot status toggle button + const botStatusToggleBtn = contentDiv.querySelector('#bot-status-toggle-btn'); + if (botStatusToggleBtn) { + botStatusToggleBtn.onclick = () => { + const currentBotStatus = AppSettings.getBotStatus(); + const newBotStatus = currentBotStatus === AppEnums.BOT_STATUS.IDLE ? AppEnums.BOT_STATUS.RUNNING : AppEnums.BOT_STATUS.IDLE; + AppSettings.setBotStatus(newBotStatus); + // Update the content to reflect the change + AppUi.dashboardOverlay.updateContent(); + }; + } + // Add event listener for server toggle button const serverToggleBtn = contentDiv.querySelector('#server-toggle-btn'); if (serverToggleBtn) {