Skip to content

Commit 4a5e804

Browse files
committed
Disconnect button functionality added
1 parent 04296e6 commit 4a5e804

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

templates/index.html

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ <h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-1">${app.ti
460460
// Poll connection status
461461
async function pollConnectionStatus() {
462462
let attempts = 0;
463-
const maxAttempts = 30; // 30 seconds timeout
463+
const maxAttempts = 5; // 5 seconds timeout
464464

465465
const checkStatus = async () => {
466466
attempts++;
@@ -489,7 +489,7 @@ <h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-1">${app.ti
489489
}
490490
} catch (error) {
491491
console.error('Connection polling error:', error);
492-
showStatus(`Connection failed: ${error.message}`, 'fa-times-circle', 'text-red-500');
492+
showStatus(`Connection failed: Try again`, 'fa-times-circle', 'text-red-500');
493493
// Return to connect state
494494
connectingBtn.classList.add('hidden');
495495
connectBtn.classList.remove('hidden');
@@ -587,7 +587,11 @@ <h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-1">${app.ti
587587

588588
// Stop recording if active
589589
if (isRecording) {
590-
toggleRecording();
590+
isRecording = false; // Force set to false since we're disconnecting
591+
recordBtn.innerHTML = 'Start Recording';
592+
recordBtn.classList.remove('bg-gray-500');
593+
recordBtn.classList.add('bg-red-500', 'hover:bg-red-600');
594+
recordingStatus.classList.add('hidden');
591595
}
592596

593597
// Stop console updates
@@ -601,6 +605,7 @@ <h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-1">${app.ti
601605
// Return to disconnect state if disconnection failed
602606
connectingBtn.classList.add('hidden');
603607
disconnectBtn.classList.remove('hidden');
608+
showStatus(`Disconnection failed: ${error.message}`, 'fa-times-circle', 'text-red-500');
604609
}
605610
});
606611

@@ -723,9 +728,13 @@ <h3 class="text-lg font-semibold text-gray-800 dark:text-gray-200 mb-1">${app.ti
723728
// Re-enable protocol buttons
724729
setProtocolButtonsDisabled(false);
725730

726-
// Stop recording if active
731+
// Stop recording if active and update button
727732
if (isRecording) {
728-
toggleRecording();
733+
isRecording = false;
734+
recordBtn.innerHTML = 'Start Recording';
735+
recordBtn.classList.remove('bg-gray-500');
736+
recordBtn.classList.add('bg-red-500', 'hover:bg-red-600');
737+
recordingStatus.classList.add('hidden');
729738
}
730739

731740
// Stop console updates

0 commit comments

Comments
 (0)