From 47cb9e8e44f10c4de63a8e906e5acdaf5190e4ba Mon Sep 17 00:00:00 2001 From: oyi77 Date: Wed, 1 Apr 2026 03:44:54 +0700 Subject: [PATCH] feat(sidebar): wire whitelabeling settings to sidebar - Add state for custom app name and logo - Fetch whitelabeling settings from /api/settings - Listen for whitelabeling changes via settings event - Display custom app name when set - Display custom logo (Base64 or URL) when set - Fall back to default OmniRoute logo and name --- src/shared/components/Sidebar.tsx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/shared/components/Sidebar.tsx b/src/shared/components/Sidebar.tsx index 2eeb5a3b65..019da21e6b 100644 --- a/src/shared/components/Sidebar.tsx +++ b/src/shared/components/Sidebar.tsx @@ -37,11 +37,15 @@ export default function Sidebar({ const [isDisconnected, setIsDisconnected] = useState(false); const [showDebug, setShowDebug] = useState(false); const [hiddenSidebarItems, setHiddenSidebarItems] = useState([]); + const [customAppName, setCustomAppName] = useState(null); + const [customLogo, setCustomLogo] = useState(null); useEffect(() => { const applySettings = (data) => { setShowDebug(data?.debugMode === true); setHiddenSidebarItems(normalizeHiddenSidebarItems(data?.[HIDDEN_SIDEBAR_ITEMS_SETTING_KEY])); + setCustomAppName(data?.instanceName || null); + setCustomLogo(data?.customLogoBase64 || data?.customLogoUrl || null); }; fetch("/api/settings") @@ -61,6 +65,16 @@ export default function Sidebar({ normalizeHiddenSidebarItems(detail[HIDDEN_SIDEBAR_ITEMS_SETTING_KEY]) ); } + + if ("instanceName" in detail) { + setCustomAppName(detail.instanceName as string || null); + } + + if ("customLogoBase64" in detail) { + setCustomLogo(detail.customLogoBase64 as string || null); + } else if ("customLogoUrl" in detail) { + setCustomLogo(detail.customLogoUrl as string || null); + } }; window.addEventListener(SIDEBAR_SETTINGS_UPDATED_EVENT, handleSettingsUpdated as EventListener); @@ -221,12 +235,20 @@ export default function Sidebar({ className={cn("flex items-center", collapsed ? "justify-center" : "gap-3")} >
- + {customLogo ? ( + {customAppName + ) : ( + + )}
{!collapsed && (

- {APP_CONFIG.name} + {customAppName || APP_CONFIG.name}

v{APP_CONFIG.version}