diff --git a/admin-spa/src/App.tsx b/admin-spa/src/App.tsx index 9421b90..5fc672b 100644 --- a/admin-spa/src/App.tsx +++ b/admin-spa/src/App.tsx @@ -38,6 +38,7 @@ import { FAB } from '@/components/FAB'; import { useActiveSection } from '@/hooks/useActiveSection'; import { NAV_TREE_VERSION } from '@/nav/tree'; import { __ } from '@/lib/i18n'; +import { ThemeToggle } from '@/components/ThemeToggle'; function useFullscreen() { const [on, setOn] = useState(() => { @@ -362,6 +363,7 @@ function Header({ onFullscreen, fullscreen, showToggle = true, scrollContainerRe )} + {showToggle && ( + + + setTheme('light')}> + + Light + {theme === 'light' && } + + setTheme('dark')}> + + Dark + {theme === 'dark' && } + + setTheme('system')}> + + System + {theme === 'system' && } + + + + ); +} diff --git a/admin-spa/src/components/ui/image-upload.tsx b/admin-spa/src/components/ui/image-upload.tsx index 48caa12..c5271a2 100644 --- a/admin-spa/src/components/ui/image-upload.tsx +++ b/admin-spa/src/components/ui/image-upload.tsx @@ -74,24 +74,31 @@ export function ImageUpload({ const formData = new FormData(); formData.append('file', file); + // Get nonce from REST API settings + const nonce = (window as any).wpApiSettings?.nonce || + (window as any).WooNooW?.nonce || + document.querySelector('meta[name="wp-rest-nonce"]')?.getAttribute('content') || ''; + // Upload to WordPress media library const response = await fetch('/wp-json/wp/v2/media', { method: 'POST', headers: { - 'X-WP-Nonce': (window as any).wpApiSettings?.nonce || '', + 'X-WP-Nonce': nonce, }, + credentials: 'same-origin', body: formData, }); if (!response.ok) { - throw new Error('Upload failed'); + const errorData = await response.json().catch(() => ({})); + throw new Error(errorData.message || 'Upload failed'); } const data = await response.json(); onChange(data.source_url); } catch (error) { console.error('Upload error:', error); - alert('Failed to upload image'); + alert(error instanceof Error ? error.message : 'Failed to upload image'); } finally { setIsUploading(false); } diff --git a/admin-spa/src/main.tsx b/admin-spa/src/main.tsx index aa8fa55..4701a33 100644 --- a/admin-spa/src/main.tsx +++ b/admin-spa/src/main.tsx @@ -2,10 +2,15 @@ import React from 'react'; import { createRoot } from 'react-dom/client'; import './index.css'; import App from './App'; +import { ThemeProvider } from './components/ThemeProvider'; const el = document.getElementById('woonoow-admin-app'); if (el) { - createRoot(el).render(); + createRoot(el).render( + + + + ); } else { console.warn('[WooNooW] Root element #woonoow-admin-app not found.'); } \ No newline at end of file diff --git a/admin-spa/src/routes/Settings/Store.tsx b/admin-spa/src/routes/Settings/Store.tsx index fdca450..0363fef 100644 --- a/admin-spa/src/routes/Settings/Store.tsx +++ b/admin-spa/src/routes/Settings/Store.tsx @@ -325,7 +325,7 @@ export default function StoreDetailsPage() { title="Brand" description="Logo, icon, and colors for your store" > - + updateSetting('storeLogo', url)} @@ -334,7 +334,7 @@ export default function StoreDetailsPage() { /> - + updateSetting('storeIcon', url)} diff --git a/includes/Branding.php b/includes/Branding.php index d280f93..b1ece54 100644 --- a/includes/Branding.php +++ b/includes/Branding.php @@ -21,12 +21,8 @@ class Branding { // Apply favicon add_action('wp_head', [__CLASS__, 'inject_favicon']); add_action('admin_head', [__CLASS__, 'inject_favicon']); - add_action('login_head', [__CLASS__, 'inject_favicon']); - // Customize login page - add_action('login_enqueue_scripts', [__CLASS__, 'customize_login_page']); - add_filter('login_headerurl', [__CLASS__, 'login_logo_url']); - add_filter('login_headertext', [__CLASS__, 'login_logo_title']); + // Note: Login page branding removed - WooNooW uses standalone SPA login } /** @@ -62,113 +58,6 @@ class Branding { } } - /** - * Customize login page - */ - public static function customize_login_page() { - $logo = get_option('woonoow_store_logo', ''); - $store_name = get_option('blogname', 'WooNooW'); - $tagline = get_option('blogdescription', ''); - $primary = get_option('woonoow_primary_color', '#3b82f6'); - - ?> - -