From 746d655b73629dc60872120b1c930121793c20e3 Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 30 Oct 2026 05:24:29 +0000 Subject: [PATCH] Update static/js/12-calls.js --- static/js/12-calls.js | 51 ++++++++----------------------------------- 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/static/js/12-calls.js b/static/js/12-calls.js index b1b05d0..ad687f4 100644 --- a/static/js/12-calls.js +++ b/static/js/12-calls.js @@ -1,3 +1,4 @@ +// static/js/12-calls.js "use strict"; window.Glow = window.Glow || {}; Glow.calls = Glow.calls || {}; @@ -42,6 +43,7 @@ Glow.calls.ensureState = () => { state.makingOffer ||= new Map(); state.ignoreOffer ||= new Map(); state.isSettingRemoteAnswerPending ||= new Map(); + state.panelOpen ??= false; }; Glow.calls.scopeLabel = invite => { @@ -581,26 +583,6 @@ Glow.calls.renderParticipants = () => { } }; -Glow.calls.renderHeaderCallChip = () => { - if (!Glow.els.callStatusChip) return; - - Glow.calls.ensureState(); - const state = Glow.calls.state(); - const visible = Boolean(state.activeCall || state.joining || state.reconnecting); - - Glow.els.callStatusChip.classList.toggle("hidden", !visible); - - if (state.reconnecting) { - Glow.els.callStatusChip.textContent = "Call reconnecting"; - } else if (state.joining) { - Glow.els.callStatusChip.textContent = "Call joining"; - } else if (state.activeCall) { - Glow.els.callStatusChip.textContent = "Call active"; - } else { - Glow.els.callStatusChip.textContent = "Call"; - } -}; - Glow.calls.connectWebSocket = async () => { Glow.calls.ensureState(); const state = Glow.calls.state(); @@ -910,12 +892,14 @@ Glow.calls.resetAll = () => { can_end: false, can_invite: false }; + state.panelOpen = false; Glow.calls.debug("resetAll complete"); }; Glow.endLocalCallUi = async () => { Glow.calls.resetAll(); + Glow.state.calls.panelOpen = false; if (Glow.els.callParticipants) { Glow.els.callParticipants.replaceChildren(); @@ -1035,12 +1019,13 @@ Glow.renderCallUi = () => { const active = Boolean(state.activeCall); const busy = Boolean(state.activeCall || state.joining || state.reconnecting); + const overlayVisible = Boolean(state.panelOpen || busy); const scope = state.activeCall?.scope || state.scope || Glow.calls.getCurrentScope(); const peerCount = Glow.calls.listOtherPeers().length; if (!Glow.els.callStatus) return; - Glow.els.callOverlay?.classList.toggle("hidden", !busy); + Glow.els.callOverlay?.classList.toggle("hidden", !overlayVisible); Glow.els.callPeerLabel.textContent = scope?.label || @@ -1095,7 +1080,7 @@ Glow.renderCallUi = () => { } if (Glow.els.callParticipants) { - Glow.els.callParticipants.classList.toggle("hidden", !busy); + Glow.els.callParticipants.classList.toggle("hidden", !overlayVisible); } Glow.calls.renderParticipants(); @@ -1103,18 +1088,6 @@ Glow.renderCallUi = () => { Glow.calls.renderHeaderCallChip(); }; -Glow.openCallPanel = async () => { - Glow.calls.ensureState(); - Glow.els.callOverlay?.classList.remove("hidden"); - Glow.els.callParticipants?.classList.remove("hidden"); - - if (Glow.state.calls.activeCall?.groupSession?.id) { - await Glow.calls.refreshBackendParticipants(); - } - - Glow.renderCallUi(); -}; - Glow.startCall = async () => { Glow.calls.ensureState(); @@ -1153,6 +1126,7 @@ Glow.startCall = async () => { Glow.state.calls.makingOffer = new Map(); Glow.state.calls.ignoreOffer = new Map(); Glow.state.calls.isSettingRemoteAnswerPending = new Map(); + Glow.state.calls.panelOpen = true; Glow.openCallPanel(); Glow.calls.setStatusText("Connecting microphone…"); @@ -1379,6 +1353,7 @@ Glow.calls.openIncomingInviteDialog = async invite => { Glow.state.calls.makingOffer = new Map(); Glow.state.calls.ignoreOffer = new Map(); Glow.state.calls.isSettingRemoteAnswerPending = new Map(); + Glow.state.calls.panelOpen = true; Glow.openCallPanel(); Glow.calls.setStatusText("Connecting microphone…"); @@ -1453,12 +1428,4 @@ Glow.els.endCallButton?.addEventListener("click", () => { Glow.els.addToCallButton?.addEventListener("click", () => { Glow.openAddToCallDialog?.(); -}); - -Glow.els.closeCallPanelButton?.addEventListener("click", () => { - Glow.els.callOverlay?.classList.add("hidden"); -}); - -Glow.els.callStatusChip?.addEventListener("click", async () => { - await Glow.openCallPanel?.(); }); \ No newline at end of file