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.
This commit is contained in:
@@ -633,7 +633,7 @@ GM_log('[TL] 🏁 Welcome to Binance Alpha Farm Agent.');
|
|||||||
statusDisplay = '▶️ Running';
|
statusDisplay = '▶️ Running';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
statusDisplay = '❓ Unknown';
|
statusDisplay = AppSettings.getBotStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get server info
|
// Get server info
|
||||||
@@ -663,13 +663,13 @@ GM_log('[TL] 🏁 Welcome to Binance Alpha Farm Agent.');
|
|||||||
<span id="debug-toggle-btn" style="color: ${AppSettings.getDebug() ? '#17a2b8' : '#6c757d'}; cursor: pointer; padding: 2px 4px; border-radius: 3px; border: 1px solid ${AppSettings.getDebug() ? '#17a2b8' : '#6c757d'}; background: ${AppSettings.getDebug() ? 'rgba(23, 162, 184, 0.1)' : 'rgba(108, 117, 125, 0.1)'}; transition: all 0.2s ease;" title="Click to toggle debug mode">🐛 Debug: ${AppSettings.getDebug() ? '✔️ ON' : '❌ OFF'}</span>
|
<span id="debug-toggle-btn" style="color: ${AppSettings.getDebug() ? '#17a2b8' : '#6c757d'}; cursor: pointer; padding: 2px 4px; border-radius: 3px; border: 1px solid ${AppSettings.getDebug() ? '#17a2b8' : '#6c757d'}; background: ${AppSettings.getDebug() ? 'rgba(23, 162, 184, 0.1)' : 'rgba(108, 117, 125, 0.1)'}; transition: all 0.2s ease;" title="Click to toggle debug mode">🐛 Debug: ${AppSettings.getDebug() ? '✔️ ON' : '❌ OFF'}</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 4px;">
|
<div style="margin-bottom: 4px;">
|
||||||
<span style="color: #007bff;">Bot Status: ${statusDisplay}</span>
|
<span id="bot-status-toggle-btn" style="color: #007bff; cursor: pointer; padding: 2px 4px; border-radius: 3px; border: 1px solid #007bff; background: rgba(0, 123, 255, 0.1); transition: all 0.2s ease;" title="Click to toggle bot status between idle and running">🤖 Bot Status: ${statusDisplay}</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 4px;">
|
<div style="margin-bottom: 4px;">
|
||||||
<span id="server-toggle-btn" style="color: #e83e8c; cursor: pointer; padding: 2px 4px; border-radius: 3px; border: 1px solid #e83e8c; background: rgba(232, 62, 140, 0.1); transition: all 0.2s ease;" title="Click to switch between local and prod servers">🌐 Server: ${serverLabel} ${serverConnected}</span>
|
<span id="server-toggle-btn" style="color: #e83e8c; cursor: pointer; padding: 2px 4px; border-radius: 3px; border: 1px solid #e83e8c; background: rgba(232, 62, 140, 0.1); transition: all 0.2s ease;" title="Click to switch between local and prod servers">🌐 Server: ${serverLabel} ${serverConnected}</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 4px;">
|
<div style="margin-bottom: 4px;">
|
||||||
<span style="color: #fd7e14;">👤 Login:${loginStatus}</span>
|
<span style="color: #fd7e14;">👤 Login: ${loginStatus}</span>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 4px;">
|
<div style="margin-bottom: 4px;">
|
||||||
<span style="color: #6f42c1;">Page: ${pageDisplay}</span>
|
<span style="color: #6f42c1;">Page: ${pageDisplay}</span>
|
||||||
@@ -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
|
// Add event listener for server toggle button
|
||||||
const serverToggleBtn = contentDiv.querySelector('#server-toggle-btn');
|
const serverToggleBtn = contentDiv.querySelector('#server-toggle-btn');
|
||||||
if (serverToggleBtn) {
|
if (serverToggleBtn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user