diff --git a/admin-spa/src/App.tsx b/admin-spa/src/App.tsx index e30a64a..f6bef5e 100644 --- a/admin-spa/src/App.tsx +++ b/admin-spa/src/App.tsx @@ -271,6 +271,7 @@ function AddonRoute({ config }: { config: any }) { function Header({ onFullscreen, fullscreen, showToggle = true, scrollContainerRef, onVisibilityChange }: { onFullscreen: () => void; fullscreen: boolean; showToggle?: boolean; scrollContainerRef?: React.RefObject; onVisibilityChange?: (visible: boolean) => void }) { const [siteTitle, setSiteTitle] = React.useState((window as any).wnw?.siteTitle || 'WooNooW'); + const [storeLogo, setStoreLogo] = React.useState(''); const [isVisible, setIsVisible] = React.useState(true); const lastScrollYRef = React.useRef(0); const isStandalone = window.WNW_CONFIG?.standaloneMode ?? false; @@ -280,12 +281,28 @@ function Header({ onFullscreen, fullscreen, showToggle = true, scrollContainerRe onVisibilityChange?.(isVisible); }, [isVisible, onVisibilityChange]); + // Fetch store branding on mount + React.useEffect(() => { + const fetchBranding = async () => { + try { + const response = await fetch((window.WNW_CONFIG?.restUrl || '') + '/store/branding'); + if (response.ok) { + const data = await response.json(); + if (data.store_logo) setStoreLogo(data.store_logo); + if (data.store_name) setSiteTitle(data.store_name); + } + } catch (err) { + console.error('Failed to fetch branding:', err); + } + }; + fetchBranding(); + }, []); + // Listen for store settings updates React.useEffect(() => { const handleStoreUpdate = (event: CustomEvent) => { - if (event.detail?.store_name) { - setSiteTitle(event.detail.store_name); - } + if (event.detail?.store_logo) setStoreLogo(event.detail.store_logo); + if (event.detail?.store_name) setSiteTitle(event.detail.store_name); }; window.addEventListener('woonoow:store:updated' as any, handleStoreUpdate); @@ -343,7 +360,13 @@ function Header({ onFullscreen, fullscreen, showToggle = true, scrollContainerRe return (
-
{siteTitle}
+
+ {storeLogo ? ( + {siteTitle} + ) : ( +
{siteTitle}
+ )} +
{window.WNW_API?.isDev ? 'Dev Server' : 'Production'}
{isStandalone && ( diff --git a/admin-spa/src/components/nav/DashboardSubmenuBar.tsx b/admin-spa/src/components/nav/DashboardSubmenuBar.tsx index 1ac04d9..10b4164 100644 --- a/admin-spa/src/components/nav/DashboardSubmenuBar.tsx +++ b/admin-spa/src/components/nav/DashboardSubmenuBar.tsx @@ -24,8 +24,8 @@ export default function DashboardSubmenuBar({ items = [], fullscreen = false, he // Calculate top position based on fullscreen state // Fullscreen: top-0 (no contextual headers, submenu is first element) - // Normal: top-16 (64px - below header) - const topClass = fullscreen ? 'top-0' : 'top-16'; + // Normal: top-[calc(7rem+32px)] (below WP admin bar + menu bar) + const topClass = fullscreen ? 'top-0' : 'top-[calc(7rem+32px)]'; return (
diff --git a/admin-spa/src/components/nav/SubmenuBar.tsx b/admin-spa/src/components/nav/SubmenuBar.tsx index 97c8251..174a403 100644 --- a/admin-spa/src/components/nav/SubmenuBar.tsx +++ b/admin-spa/src/components/nav/SubmenuBar.tsx @@ -13,8 +13,8 @@ export default function SubmenuBar({ items = [], fullscreen = false, headerVisib // Calculate top position based on fullscreen state // Fullscreen: top-0 (no contextual headers, submenu is first element) - // Normal: top-16 (64px - below header) - const topClass = fullscreen ? 'top-0' : 'top-16'; + // Normal: top-[calc(7rem+32px)] (below WP admin bar + menu bar) + const topClass = fullscreen ? 'top-0' : 'top-[calc(7rem+32px)]'; return (
diff --git a/admin-spa/src/routes/Login.tsx b/admin-spa/src/routes/Login.tsx index 433eff5..86b35f5 100644 --- a/admin-spa/src/routes/Login.tsx +++ b/admin-spa/src/routes/Login.tsx @@ -66,9 +66,9 @@ export function Login() { }; return ( -
+
-
+
{/* Logo */}
{branding.logo ? ( diff --git a/admin-spa/src/routes/More/index.tsx b/admin-spa/src/routes/More/index.tsx index 9f973f2..e472d4b 100644 --- a/admin-spa/src/routes/More/index.tsx +++ b/admin-spa/src/routes/More/index.tsx @@ -111,9 +111,9 @@ export default function MorePage() { {/* Exit Fullscreen / Logout */}
- {!isStandalone && ( + {isStandalone && (