From 22b1ddcb48cccc9fd0f81848cd965647bf644c01 Mon Sep 17 00:00:00 2001 From: xmanrui <841206367@qq.com> Date: Sat, 7 Mar 2026 03:59:31 +0800 Subject: [PATCH] feat(mobile): show OpenClaw version in top navbar title --- app/sidebar.tsx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/sidebar.tsx b/app/sidebar.tsx index 75de7ca..2c71a30 100644 --- a/app/sidebar.tsx +++ b/app/sidebar.tsx @@ -41,6 +41,7 @@ export function Sidebar() { const [collapsed, setCollapsed] = useState(false); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [mobileAgentCount, setMobileAgentCount] = useState(null); + const [mobileOpenclawVersion, setMobileOpenclawVersion] = useState(null); const [experimentOpen, setExperimentOpen] = useState(false); const [bugsEnabled, setBugsEnabled] = useState(false); const [bugsCount, setBugsCount] = useState(5); @@ -232,6 +233,24 @@ export function Sidebar() { }; }, [pathname]); + useEffect(() => { + let cancelled = false; + const fetchOpenclawVersion = async () => { + try { + const res = await fetch("/api/gateway-health", { cache: "no-store" }); + if (!res.ok) return; + const data = await res.json(); + if (cancelled) return; + const version = typeof data?.openclawVersion === "string" ? data.openclawVersion.trim() : ""; + setMobileOpenclawVersion(version || null); + } catch {} + }; + void fetchOpenclawVersion(); + return () => { + cancelled = true; + }; + }, []); + return ( <>
@@ -266,7 +285,9 @@ export function Sidebar() { 🦞
-
OPENCLAW
+
+ OPENCLAW{mobileOpenclawVersion ? ` ${mobileOpenclawVersion}` : ""} +
{pathname === "/" && mobileAgentCount !== null ? `${mobileAgentCount} ${t("home.agentCount")}`