From 43126abf0881c661a49f396f4df8159718ab22ea Mon Sep 17 00:00:00 2001
From: dj-oyu <68707227+dj-oyu@users.noreply.github.com>
Date: Wed, 25 Feb 2026 05:12:49 +0900
Subject: [PATCH] feat: hide Orch tab when orchestration is not enabled
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- serveIndex injects before
when orchBroadcaster is non-nil (i.e. --orchestration active)
- JS hides the Orch tab button and panel when ORCH_ENABLED is falsy,
and sets --tab-count CSS var to 6 so the indicator pill stays correct
- tab indicator width uses var(--tab-count, 7) — defaults to 7 when
orchestration is enabled, falls back to 6 otherwise
- No extra API endpoint or network request needed
Co-Authored-By: Claude Sonnet 4.6
---
pkg/miniapp/miniapp.go | 4 ++++
pkg/miniapp/static/index.html | 13 +++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/pkg/miniapp/miniapp.go b/pkg/miniapp/miniapp.go
index 5b290bdc0..c6d71fbfc 100644
--- a/pkg/miniapp/miniapp.go
+++ b/pkg/miniapp/miniapp.go
@@ -5,6 +5,7 @@ import (
"net/http"
"net/http/httputil"
"net/url"
+ "strings"
"sync"
"github.com/sipeed/picoclaw/pkg/orch"
@@ -86,6 +87,9 @@ func (h *Handler) serveIndex(w http.ResponseWriter, r *http.Request) {
return
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
+ if h.orchBroadcaster != nil {
+ data = []byte(strings.Replace(string(data), "", "", 1))
+ }
w.Write(data)
}
diff --git a/pkg/miniapp/static/index.html b/pkg/miniapp/static/index.html
index 7e08c4a52..985d77c7a 100644
--- a/pkg/miniapp/static/index.html
+++ b/pkg/miniapp/static/index.html
@@ -84,7 +84,7 @@
top: 2px;
bottom: 2px;
left: 2px;
- width: calc(100%/7 - 2px);
+ width: calc(100% / var(--tab-count, 7) - 2px);
border-radius: 8px;
background: var(--tab-pill-bg);
box-shadow: 0 0.5px 2px rgba(0,0,0,0.12), 0 0.5px 1px rgba(0,0,0,0.08);
@@ -941,8 +941,17 @@ let initData = tg.initData || '';
let selectedSkill = null;
var lastSSE = { plan: 0, skills: 0, session: 0, dev: 0 };
+// Hide Orch tab when orchestration is not enabled (ORCH_ENABLED injected by server).
+if (!window.ORCH_ENABLED) {
+ var orchTabBtn = document.querySelector('.tab[data-panel="orch"]');
+ var orchPanel = document.getElementById('orch');
+ if (orchTabBtn) orchTabBtn.style.display = 'none';
+ if (orchPanel) orchPanel.style.display = 'none';
+ document.documentElement.style.setProperty('--tab-count', '6');
+}
+
// Tab switching — re-fetch data unless SSE delivered recently
-const tabs = document.querySelectorAll('.tab');
+const tabs = document.querySelectorAll('.tab:not([style*="display: none"])');
const tabIndicator = document.querySelector('.tab-indicator');
function moveIndicator(index) {