From 7771541a8d18103ed96752ec758d551ce4aa8dfd Mon Sep 17 00:00:00 2001 From: canvas-bot Date: Mon, 15 Jun 2026 01:49:17 +0400 Subject: [PATCH] feat(app): global backend-health banner across every scene The login screen already shows a yellow banner when /api/* is in proxy-down (502/504) or auth-down (503) state. Extend the same signal to every authenticated scene so a regional store manager seeing a broken Mission Control gets a one-line explanation, not silent failure. - New src/lib/useBackendHealth.ts polls /api/v1/auth/me every 30s (cheap, returns 401 when healthy + unauth'd so it doubles as auth probe). Status maps: 200/401/403 -> up, 502/504 -> proxy-down, 503 -> auth-down. - App.tsx renders .global-banner above the topbar whenever the proxy or auth service is down. Hidden on /login (Login.tsx already has its own banner) and during SSO callback. - Dark-theme banner colours added. 31/31 vitest pass. tsc + vite build green. --- src/App.tsx | 10 +++++++++ src/index.css | 11 ++++++++++ src/lib/useBackendHealth.ts | 43 +++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/lib/useBackendHealth.ts diff --git a/src/App.tsx b/src/App.tsx index 277fd19..c8cf1df 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,6 +19,7 @@ import CommandBar from "./components/CommandBar"; import Toaster from "./components/Toaster"; import Console from "./components/Console"; import { Cmd, Home, Layers, HistoryIcon, Pulse, Refresh, Branch, Cog, User, Sun, Moon, Bot } from "./components/icons"; +import { useBackendHealth } from "./lib/useBackendHealth"; export default function App() { @@ -120,8 +121,17 @@ export default function App() { return () => { cancelled = true; window.clearInterval(id); }; }, [isAuthed, tenantId, userEmail]); + const backendHealth = useBackendHealth(); + return (
+ {(backendHealth === "proxy-down" || backendHealth === "auth-down") && scene !== "login" && scene !== "sso-callback" && ( +
+ {backendHealth === "proxy-down" + ? "The FlowMaster backend is not reachable from this environment right now. Some actions will fail until it is restored." + : "The authentication service is temporarily down. Some actions will fail until it is restored."} +
+ )} {scene !== "landing" && scene !== "login" && scene !== "sso-callback" && (