mobile: one mode-toggle button instead of two bottom tabs

Replace the two-tab bottom bar (Live / Архив) with a single centered
toggle button. It switches the mode either/or: shows the current mode
with a swap glyph (⇆), tap flips Live ⇄ Архив.

VERSION 0.0.150 -> 0.0.151

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 23:49:02 +05:00
parent c91f82bf28
commit 126b588dc7
4 changed files with 20 additions and 17 deletions
+11 -9
View File
@@ -46,14 +46,16 @@ html, body {
.m-empty { color: #8b93a7; text-align: center; padding: 28px 16px; font-size: 14px; }
.m-tabs {
flex: none; display: flex; background: #161a22; border-top: 1px solid #272d3a;
padding-bottom: env(safe-area-inset-bottom, 0);
flex: none; display: flex; justify-content: center; background: #161a22;
border-top: 1px solid #272d3a; padding: 8px 12px;
padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
}
.m-tab {
flex: 1; background: none; border: 0; color: #8b93a7; cursor: pointer;
padding: 9px 0 11px; font-size: 11px; font-family: inherit;
display: flex; flex-direction: column; align-items: center; gap: 3px;
/* одна кнопка-переключатель режима (или/или): показывает текущий режим, тап — меняет */
.m-mode {
display: inline-flex; align-items: center; justify-content: center; gap: 10px;
min-width: 190px; background: #1d2230; color: #e6e9ef; border: 1px solid #272d3a;
border-radius: 10px; padding: 12px 28px; cursor: pointer;
font: 600 15px/1 inherit; letter-spacing: .3px;
}
.m-tab .i { font-size: 22px; line-height: 1; }
.m-tab.active { color: #fff; }
.m-tab.active .i { color: #c0392b; }
.m-mode:active { background: #232a3a; }
.m-mode .i { font-size: 18px; color: #c0392b; }
+6 -5
View File
@@ -14,7 +14,7 @@ async function api(url) {
}
const M = {
cams: [], liveId: null, archId: null, date: null,
cams: [], liveId: null, archId: null, date: null, view: "live",
async init() {
let data;
@@ -44,15 +44,16 @@ const M = {
else if (lv.webkitEnterFullscreen) lv.webkitEnterFullscreen(); // iOS
});
document.querySelectorAll(".m-tab").forEach((tb) => {
tb.onclick = () => this.showView(tb.dataset.view);
});
// одна кнопка снизу — переключатель режима (или/или): Live ⇄ Архив
document.getElementById("m-mode").onclick = () =>
this.showView(this.view === "live" ? "arch" : "live");
this.showView("live");
},
showView(v) {
document.querySelectorAll(".m-tab").forEach((t) => t.classList.toggle("active", t.dataset.view === v));
this.view = v;
document.getElementById("m-mode-name").textContent = v === "live" ? "Live" : "Архив";
document.getElementById("view-live").hidden = v !== "live";
document.getElementById("view-arch").hidden = v !== "arch";
if (v === "live") { this.stopArch(); this.startLive(); }