From 404fee3405cfd656616ce55da43384ede1afbe5f Mon Sep 17 00:00:00 2001 From: Paul Kloppers Date: Wed, 13 May 2026 23:20:52 +0200 Subject: [PATCH] =?UTF-8?q?ui(bot):=20simplify=20/status=20panel=20?= =?UTF-8?q?=E2=80=94=20one=20power=20toggle,=20cleaner=20layout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the old "Up All / Server ▾ / Tunnel ▾" five-button grid with a single power-toggle button (▶️ Start / 🛑 Stop) plus three flat-nav buttons (Logs / Users / Refresh). Granular per-service control stays reachable via the existing /server_up, /server_down, /pf_up, /pf_down slash commands. Message body redesigned: top-line health pill (🟢 Online / 🟡 Partial / 🔴 Offline), then aligned status rows for Server and Tunnel, then the update timestamp. Uses the same 🟢/🔴 pair throughout for consistency, dropping the mixed ✅/⛔ + 🟢/🟡 from before. Co-Authored-By: Claude Opus 4.7 --- bot/bot.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/bot/bot.ts b/bot/bot.ts index f676903..5d510ad 100644 --- a/bot/bot.ts +++ b/bot/bot.ts @@ -517,18 +517,24 @@ function fmtTs(): string { async function renderMain(ctx: Context) { const [mc, pf] = await Promise.all([serverRunning(), pfRunning()]); + const allUp = mc && pf; + const allDown = !mc && !pf; + const headline = allUp ? "🟢 Online" : allDown ? "🔴 Offline" : "🟡 Partial"; + const dot = (ok: boolean) => (ok ? "🟢" : "🔴"); const text = - `🎮 Minecraft Control\n` + + `🎮 Minecraft\n` + + `${headline}\n` + `\n` + - `server : ${mc ? "✅ up" : "⛔ down"}\n` + - `tunnel : ${pf ? "✅ up" : "⛔ down"}\n` + + `${dot(mc)} Server\n` + + `${dot(pf)} Tunnel\n` + `\n` + - `updated ${fmtTs()}`; + `⏱ ${fmtTs()}`; + // Single control button: power toggle. Drives both server + tunnel at once + // via actUpAll / actDownAll. Granular per-service control is still reachable + // via the /server_up, /server_down, /pf_up, /pf_down slash commands. const kb = new InlineKeyboard() - .text(mc && pf ? "⏹ Down All" : "▶ Up All", mc && pf ? "act:downall" : "act:upall").row() - .text(mc ? "🟢 Server ▾" : "🟢 Server ▾", "nav:server").text(pf ? "🟡 Tunnel ▾" : "🟡 Tunnel ▾", "nav:tunnel").row() - .text("📜 Logs", "nav:logs").text("👥 Users", "nav:users").row() - .text("🔄 Refresh", "nav:main"); + .text(allUp ? "🛑 Stop" : "▶️ Start", allUp ? "act:downall" : "act:upall").row() + .text("📜 Logs", "nav:logs").text("👥 Users", "nav:users").text("🔄", "nav:main"); return editPanel(ctx, "main", text, kb); }