fix: only show 'ON' badge when connected to a room with a target tab

This commit is contained in:
Timo
2026-04-22 12:01:27 +02:00
parent 8d28691030
commit 465a34837d
+3 -1
View File
@@ -259,7 +259,7 @@ function updateBadgeStatus() {
} else if (status === 'connecting') {
chrome.action.setBadgeText({ text: '...' });
chrome.action.setBadgeBackgroundColor({ color: '#fbbf24' });
} else if (currentTabId) {
} else if (status === 'connected' && currentTabId) {
chrome.action.setBadgeText({ text: 'ON' });
chrome.action.setBadgeBackgroundColor({ color: '#22c55e' });
} else {
@@ -531,7 +531,9 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
} else if (message.type === 'LEAVE_ROOM') {
emit(EVENTS.LEAVE_ROOM, { peerId });
currentRoom = null;
currentTabId = null;
stopHeartbeat();
updateBadgeStatus();
if (storageInitialized) chrome.storage.session.set({ currentRoom: null });
addLog('Left Room', 'info');
chrome.runtime.sendMessage({ type: 'PEER_UPDATE', peers: [] }).catch(() => {});