diff --git a/admin-spa/src/components/ui/dialog.tsx b/admin-spa/src/components/ui/dialog.tsx index 1e67770..ef50519 100644 --- a/admin-spa/src/components/ui/dialog.tsx +++ b/admin-spa/src/components/ui/dialog.tsx @@ -40,7 +40,17 @@ const DialogContent = React.forwardRef< if (!portalRoot) { portalRoot = document.createElement('div'); portalRoot.id = 'woonoow-dialog-portal'; + // Copy theme class from documentElement for proper CSS variable inheritance + const themeClass = document.documentElement.classList.contains('dark') ? 'dark' : 'light'; + portalRoot.className = themeClass; appContainer.appendChild(portalRoot); + } else { + // Update theme class in case it changed + const themeClass = document.documentElement.classList.contains('dark') ? 'dark' : 'light'; + if (!portalRoot.classList.contains(themeClass)) { + portalRoot.classList.remove('light', 'dark'); + portalRoot.classList.add(themeClass); + } } return portalRoot; }; diff --git a/admin-spa/src/routes/Appearance/Pages/index.tsx b/admin-spa/src/routes/Appearance/Pages/index.tsx index f844d8b..067dd52 100644 --- a/admin-spa/src/routes/Appearance/Pages/index.tsx +++ b/admin-spa/src/routes/Appearance/Pages/index.tsx @@ -51,8 +51,9 @@ export default function AppearancePages() { const { data: pages = [], isLoading: pagesLoading } = useQuery({ queryKey: ['pages'], queryFn: async () => { + // api.get returns JSON directly (not wrapped in { data: ... }) const response = await api.get('/pages'); - return response.data; + return response; // Return response directly }, }); @@ -64,8 +65,9 @@ export default function AppearancePages() { const endpoint = selectedPage.type === 'page' ? `/pages/${selectedPage.slug}` : `/templates/${selectedPage.cpt}`; + // api.get returns JSON directly const response = await api.get(endpoint); - return response.data; + return response; // Return response directly }, enabled: !!selectedPage, });