Add on-air toggle for phone call routing
When off air, callers hear a message and get disconnected. When on air, calls route normally. Toggle button added to frontend header with pulsing red ON AIR indicator. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,27 @@ header button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.on-air-btn {
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.on-air-btn.off {
|
||||
background: #666 !important;
|
||||
}
|
||||
|
||||
.on-air-btn.on {
|
||||
background: #cc2222 !important;
|
||||
animation: on-air-pulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes on-air-pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.7; }
|
||||
}
|
||||
|
||||
.new-session-btn {
|
||||
background: var(--accent) !important;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<header>
|
||||
<h1>Luke at The Roost</h1>
|
||||
<div class="header-buttons">
|
||||
<button id="on-air-btn" class="on-air-btn off">OFF AIR</button>
|
||||
<button id="new-session-btn" class="new-session-btn">New Session</button>
|
||||
<button id="settings-btn">Settings</button>
|
||||
</div>
|
||||
|
||||
@@ -57,6 +57,24 @@ function initEventListeners() {
|
||||
// New Session
|
||||
document.getElementById('new-session-btn')?.addEventListener('click', newSession);
|
||||
|
||||
// On-Air toggle
|
||||
const onAirBtn = document.getElementById('on-air-btn');
|
||||
if (onAirBtn) {
|
||||
fetch('/api/on-air').then(r => r.json()).then(data => {
|
||||
updateOnAirBtn(onAirBtn, data.on_air);
|
||||
});
|
||||
onAirBtn.addEventListener('click', async () => {
|
||||
const isOn = onAirBtn.classList.contains('on');
|
||||
const res = await safeFetch('/api/on-air', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ on_air: !isOn }),
|
||||
});
|
||||
updateOnAirBtn(onAirBtn, res.on_air);
|
||||
log(res.on_air ? 'Show is ON AIR — accepting calls' : 'Show is OFF AIR — calls get off-air message');
|
||||
});
|
||||
}
|
||||
|
||||
// Server controls
|
||||
document.getElementById('restart-server-btn')?.addEventListener('click', restartServer);
|
||||
document.getElementById('stop-server-btn')?.addEventListener('click', stopServer);
|
||||
@@ -772,6 +790,12 @@ function log(text) {
|
||||
addMessage('System', text);
|
||||
}
|
||||
|
||||
function updateOnAirBtn(btn, isOn) {
|
||||
btn.classList.toggle('on', isOn);
|
||||
btn.classList.toggle('off', !isOn);
|
||||
btn.textContent = isOn ? 'ON AIR' : 'OFF AIR';
|
||||
}
|
||||
|
||||
|
||||
function showStatus(text) {
|
||||
const status = document.getElementById('status');
|
||||
|
||||
Reference in New Issue
Block a user