Fix Bluetooth device container - use btDeviceListContent instead of output

The Bluetooth mode uses its own layout container (btLayoutContainer) which
contains btDeviceListContent for device cards. The output element is hidden
for Bluetooth mode. Also adds device count updates and clears placeholder
when scanning starts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-01-21 17:01:21 +00:00
parent 4bc4983cba
commit 13ed363ff6
+21 -2
View File
@@ -28,7 +28,7 @@ const BluetoothMode = (function() {
startBtn = document.getElementById('startBtBtn');
stopBtn = document.getElementById('stopBtBtn');
messageContainer = document.getElementById('btMessageContainer');
deviceContainer = document.getElementById('output');
deviceContainer = document.getElementById('btDeviceListContent');
adapterSelect = document.getElementById('btAdapterSelect');
scanModeSelect = document.getElementById('btScanMode');
transportSelect = document.getElementById('btTransport');
@@ -213,6 +213,14 @@ const BluetoothMode = (function() {
if (startBtn) startBtn.style.display = scanning ? 'none' : 'block';
if (stopBtn) stopBtn.style.display = scanning ? 'block' : 'none';
// Clear placeholder when starting scan
if (scanning && deviceContainer) {
const placeholder = deviceContainer.querySelector('div[style*="text-align: center"]');
if (placeholder && placeholder.textContent.includes('Start scanning')) {
deviceContainer.innerHTML = '';
}
}
// Update global status if available
const statusDot = document.getElementById('statusDot');
const statusText = document.getElementById('statusText');
@@ -288,6 +296,17 @@ const BluetoothMode = (function() {
console.log('[BT] Device update received:', device);
devices.set(device.device_id, device);
renderDevice(device);
updateDeviceCount();
}
/**
* Update device count display
*/
function updateDeviceCount() {
const countEl = document.getElementById('btDeviceListCount');
if (countEl) {
countEl.textContent = devices.size;
}
}
/**
@@ -298,7 +317,7 @@ const BluetoothMode = (function() {
if (!deviceContainer) {
console.warn('[BT] No device container found!');
// Try to find it again
deviceContainer = document.getElementById('output');
deviceContainer = document.getElementById('btDeviceListContent');
if (!deviceContainer) {
console.error('[BT] Still no container - cannot render');
return;