Revert "Move sensors vertical between cam and calendar in bottom strip"
This reverts commit 10524d5d9b.
This commit is contained in:
parent
10524d5d9b
commit
de4224ead4
76
index.html
76
index.html
|
|
@ -14,7 +14,7 @@ body { background: #0a0a0a; color: #e0ddd5; font-family: 'Sora', sans-serif; ove
|
||||||
#right { width: 42%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 12px; }
|
#right { width: 42%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 12px; }
|
||||||
|
|
||||||
/* Camera */
|
/* Camera */
|
||||||
#cam-wrap { flex: 1; min-width: 0; border-radius: 8px; overflow: hidden; border: 1px solid #222; flex-shrink: 0; }
|
#cam-wrap { width: 70%; border-radius: 8px; overflow: hidden; border: 1px solid #222; flex-shrink: 0; }
|
||||||
#pulse-cam { width: 100%; display: block; background: #111; }
|
#pulse-cam { width: 100%; display: block; background: #111; }
|
||||||
|
|
||||||
/* Clock */
|
/* Clock */
|
||||||
|
|
@ -23,19 +23,16 @@ canvas#clock { width: 180px; height: 180px; }
|
||||||
#digital-time { text-align: center; color: #c8b273; font-size: 21px; font-weight: 300; letter-spacing: 2px; margin-top: 6px; font-variant-numeric: tabular-nums; }
|
#digital-time { text-align: center; color: #c8b273; font-size: 21px; font-weight: 300; letter-spacing: 2px; margin-top: 6px; font-variant-numeric: tabular-nums; }
|
||||||
#digital-date { text-align: center; color: #666; font-size: 13px; font-weight: 400; letter-spacing: 1px; margin-top: 2px; }
|
#digital-date { text-align: center; color: #666; font-size: 13px; font-weight: 400; letter-spacing: 1px; margin-top: 2px; }
|
||||||
|
|
||||||
/* Bottom strip: cam | sensors | calendar */
|
|
||||||
#bottom-strip { display: flex; align-items: center; gap: 16px; width: 100%; }
|
|
||||||
|
|
||||||
/* Room sensors */
|
/* Room sensors */
|
||||||
#room-sensors { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
|
#room-sensors { display: flex; gap: 20px; justify-content: center; width: 100%; max-width: 280px; padding: 8px 0; }
|
||||||
#room-sensors .sensor { text-align: center; }
|
#room-sensors .sensor { text-align: center; }
|
||||||
#room-sensors .sensor-val { font-size: 20px; font-weight: 300; color: #e0ddd5; font-variant-numeric: tabular-nums; line-height: 1.2; }
|
#room-sensors .sensor-val { font-size: 22px; font-weight: 300; color: #e0ddd5; font-variant-numeric: tabular-nums; }
|
||||||
#room-sensors .sensor-label { font-size: 9px; color: #555; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
|
#room-sensors .sensor-label { font-size: 10px; color: #555; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
|
||||||
#room-sensors .sensor-val.warn { color: #d4a050; }
|
#room-sensors .sensor-val.warn { color: #d4a050; }
|
||||||
#room-sensors .sensor-val.crit { color: #c45; }
|
#room-sensors .sensor-val.crit { color: #c45; }
|
||||||
|
|
||||||
/* Calendar */
|
/* Calendar */
|
||||||
#calendar { flex-shrink: 0; width: 180px; }
|
#calendar { width: 100%; max-width: 280px; }
|
||||||
#cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
|
#cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
|
||||||
#cal-nav button { background: none; border: 1px solid #333; color: #c8b273; font-family: 'Sora'; font-size: 15px; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
|
#cal-nav button { background: none; border: 1px solid #333; color: #c8b273; font-family: 'Sora'; font-size: 15px; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
|
||||||
#cal-nav button:hover { background: #1a1a1a; border-color: #c8b273; }
|
#cal-nav button:hover { background: #1a1a1a; border-color: #c8b273; }
|
||||||
|
|
@ -83,26 +80,24 @@ canvas#clock { width: 180px; height: 180px; }
|
||||||
<div id="alerts-header"><span class="dot"></span> STATUS</div>
|
<div id="alerts-header"><span class="dot"></span> STATUS</div>
|
||||||
<div id="alert-list"></div>
|
<div id="alert-list"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="cam-wrap"><img id="pulse-cam" alt="Pulse-Ox"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="right">
|
<div id="right">
|
||||||
<div id="clock-wrap"><canvas id="clock" width="440" height="440"></canvas></div>
|
<div id="clock-wrap"><canvas id="clock" width="440" height="440"></canvas></div>
|
||||||
<div id="digital-time"></div>
|
<div id="digital-time"></div>
|
||||||
<div id="digital-date"></div>
|
<div id="digital-date"></div>
|
||||||
<div id="bottom-strip" style="display:none">
|
<div id="room-sensors" style="display:none">
|
||||||
<div id="cam-wrap"><img id="pulse-cam" alt="Pulse-Ox"></div>
|
<div class="sensor"><div class="sensor-val" id="s-temp">--</div><div class="sensor-label">Temp</div></div>
|
||||||
<div id="room-sensors" style="display:none">
|
<div class="sensor"><div class="sensor-val" id="s-hum">--</div><div class="sensor-label">Humidity</div></div>
|
||||||
<div class="sensor"><div class="sensor-val" id="s-temp">--</div><div class="sensor-label">Temp</div></div>
|
<div class="sensor"><div class="sensor-val" id="s-co2">--</div><div class="sensor-label">CO₂</div></div>
|
||||||
<div class="sensor"><div class="sensor-val" id="s-hum">--</div><div class="sensor-label">Humidity</div></div>
|
</div>
|
||||||
<div class="sensor"><div class="sensor-val" id="s-co2">--</div><div class="sensor-label">CO₂</div></div>
|
<div id="calendar">
|
||||||
</div>
|
<div id="cal-nav">
|
||||||
<div id="calendar">
|
<button id="cal-prev">‹</button>
|
||||||
<div id="cal-nav">
|
<div id="cal-title"></div>
|
||||||
<button id="cal-prev">‹</button>
|
<button id="cal-next">›</button>
|
||||||
<div id="cal-title"></div>
|
|
||||||
<button id="cal-next">›</button>
|
|
||||||
</div>
|
|
||||||
<div id="cal-grid"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div id="cal-grid"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -357,11 +352,8 @@ evtSource.onerror = () => { setTimeout(() => location.reload(), 5000); };
|
||||||
// Resume audio on first interaction
|
// Resume audio on first interaction
|
||||||
document.addEventListener('click', () => { if (audioCtx.state === 'suspended') audioCtx.resume(); }, { once: true });
|
document.addEventListener('click', () => { if (audioCtx.state === 'suspended') audioCtx.resume(); }, { once: true });
|
||||||
|
|
||||||
// === NIGHT STRIP: Camera + Sensors (7pm - 8am only) ===
|
// === ROOM SENSORS (7pm - 8am only) ===
|
||||||
const bottomStrip = document.getElementById('bottom-strip');
|
|
||||||
const sensorEl = document.getElementById('room-sensors');
|
const sensorEl = document.getElementById('room-sensors');
|
||||||
const camImg = document.getElementById('pulse-cam');
|
|
||||||
const camWrap = document.getElementById('cam-wrap');
|
|
||||||
|
|
||||||
function isNightTime() {
|
function isNightTime() {
|
||||||
const h = new Date().getHours();
|
const h = new Date().getHours();
|
||||||
|
|
@ -369,6 +361,8 @@ function isNightTime() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateSensors() {
|
async function updateSensors() {
|
||||||
|
if (!isNightTime()) { sensorEl.style.display = 'none'; return; }
|
||||||
|
sensorEl.style.display = '';
|
||||||
try {
|
try {
|
||||||
const r = await fetch('/api/sensors/bed1');
|
const r = await fetch('/api/sensors/bed1');
|
||||||
const d = await r.json();
|
const d = await r.json();
|
||||||
|
|
@ -376,12 +370,12 @@ async function updateSensors() {
|
||||||
const tempC = ((tempF - 32) * 5/9).toFixed(1);
|
const tempC = ((tempF - 32) * 5/9).toFixed(1);
|
||||||
document.getElementById('s-temp').textContent = Math.round(tempF) + '°';
|
document.getElementById('s-temp').textContent = Math.round(tempF) + '°';
|
||||||
document.getElementById('s-temp').title = tempC + '°C';
|
document.getElementById('s-temp').title = tempC + '°C';
|
||||||
|
|
||||||
const hum = parseFloat(d.humidity);
|
const hum = parseFloat(d.humidity);
|
||||||
const humEl = document.getElementById('s-hum');
|
const humEl = document.getElementById('s-hum');
|
||||||
humEl.textContent = Math.round(hum) + '%';
|
humEl.textContent = Math.round(hum) + '%';
|
||||||
humEl.className = 'sensor-val' + (hum < 30 || hum > 65 ? ' warn' : '');
|
humEl.className = 'sensor-val' + (hum < 30 || hum > 65 ? ' warn' : '');
|
||||||
|
|
||||||
const co2 = parseInt(d.co2);
|
const co2 = parseInt(d.co2);
|
||||||
const co2El = document.getElementById('s-co2');
|
const co2El = document.getElementById('s-co2');
|
||||||
co2El.textContent = co2;
|
co2El.textContent = co2;
|
||||||
|
|
@ -389,22 +383,32 @@ async function updateSensors() {
|
||||||
} catch(e) { console.error('Sensor fetch failed:', e); }
|
} catch(e) { console.error('Sensor fetch failed:', e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNightStrip() {
|
updateSensors();
|
||||||
if (isNightTime()) {
|
setInterval(updateSensors, 30000);
|
||||||
bottomStrip.style.display = '';
|
|
||||||
sensorEl.style.display = '';
|
// === PULSE-OX CAMERA (7pm - 8am only) ===
|
||||||
|
const camImg = document.getElementById('pulse-cam');
|
||||||
|
const camWrap = document.getElementById('cam-wrap');
|
||||||
|
|
||||||
|
function isCamTime() {
|
||||||
|
const h = new Date().getHours();
|
||||||
|
return h >= 19 || h < 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCam() {
|
||||||
|
if (isCamTime()) {
|
||||||
|
camWrap.style.display = '';
|
||||||
if (!camImg.src.includes('/stream')) {
|
if (!camImg.src.includes('/stream')) {
|
||||||
camImg.src = '/api/cam/pulse-ox/stream';
|
camImg.src = '/api/cam/pulse-ox/stream';
|
||||||
}
|
}
|
||||||
updateSensors();
|
|
||||||
} else {
|
} else {
|
||||||
bottomStrip.style.display = 'none';
|
camWrap.style.display = 'none';
|
||||||
camImg.src = '';
|
camImg.src = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNightStrip();
|
updateCam();
|
||||||
setInterval(updateNightStrip, 30000);
|
setInterval(updateCam, 60000);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue