ui(bot): simplify /status panel — one power toggle, cleaner layout

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 <noreply@anthropic.com>
This commit is contained in:
2026-05-13 23:20:52 +02:00
parent b99c36c13c
commit 404fee3405

View File

@@ -517,18 +517,24 @@ function fmtTs(): string {
async function renderMain(ctx: Context) { async function renderMain(ctx: Context) {
const [mc, pf] = await Promise.all([serverRunning(), pfRunning()]); const [mc, pf] = await Promise.all([serverRunning(), pfRunning()]);
const allUp = mc && pf;
const allDown = !mc && !pf;
const headline = allUp ? "🟢 <b>Online</b>" : allDown ? "🔴 <b>Offline</b>" : "🟡 <b>Partial</b>";
const dot = (ok: boolean) => (ok ? "🟢" : "🔴");
const text = const text =
`<b>🎮 Minecraft Control</b>\n` + `🎮 <b>Minecraft</b>\n` +
`${headline}\n` +
`\n` + `\n` +
`server : ${mc ? "✅ up" : "⛔ down"}\n` + `${dot(mc)} Server\n` +
`tunnel : ${pf ? "✅ up" : "⛔ down"}\n` + `${dot(pf)} Tunnel\n` +
`\n` + `\n` +
`<i>updated ${fmtTs()}</i>`; `<i> ${fmtTs()}</i>`;
// 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() const kb = new InlineKeyboard()
.text(mc && pf ? "⏹ Down All" : "▶ Up All", mc && pf ? "act:downall" : "act:upall").row() .text(allUp ? "🛑 Stop" : "▶️ Start", allUp ? "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").text("🔄", "nav:main");
.text("📜 Logs", "nav:logs").text("👥 Users", "nav:users").row()
.text("🔄 Refresh", "nav:main");
return editPanel(ctx, "main", text, kb); return editPanel(ctx, "main", text, kb);
} }