fix: Image upload, remove WP login branding, implement dark mode
## 1. Fix Image Upload ✅ **Issue:** Image upload failing due to missing nonce **Fix:** - Better nonce detection (wpApiSettings, WooNooW, meta tag) - Added credentials: 'same-origin' - Better error handling with error messages - Clarified image size recommendations (not strict requirements) **Changes:** - Logo: "Recommended size: 200x60px (or similar ratio)" - Icon: "Recommended: 32x32px or larger square image" --- ## 2. Remove WordPress Login Page Branding ✅ **Issue:** Misunderstood - implemented WP login branding instead of SPA login **Fix:** - Removed all WordPress login page customization - Removed login_enqueue_scripts hook - Removed login_headerurl filter - Removed login_headertext filter - Removed customize_login_page() method - Removed login_logo_url() method - Removed login_logo_title() method **Note:** WooNooW uses standalone SPA login, not WordPress login page --- ## 3. Implement Dark/Light Mode ✅ ### Components Created: **ThemeProvider.tsx:** - Theme context (light, dark, system) - Automatic system theme detection - localStorage persistence (woonoow_theme) - Applies .light or .dark class to <html> - Listens for system theme changes **ThemeToggle.tsx:** - Dropdown menu with 3 options: - ☀️ Light - 🌙 Dark - 🖥️ System - Shows current selection with checkmark - Icon changes based on actual theme ### Integration: - Wrapped App with ThemeProvider in main.tsx - Added ThemeToggle to header (before fullscreen button) - Uses existing dark mode CSS variables (already configured) ### Features: - ✅ Light mode - ✅ Dark mode - ✅ System preference (auto) - ✅ Persists in localStorage - ✅ Smooth transitions - ✅ Icon updates dynamically ### CSS: - Already configured: darkMode: ["class"] in tailwind.config.js - Dark mode variables already defined in index.css - No additional CSS needed --- ## Result ✅ Image upload fixed with better error handling ✅ WordPress login branding removed (not needed) ✅ Dark/Light mode fully functional ✅ Theme toggle in header ✅ System preference support ✅ Persists across sessions **Ready to test!**
This commit is contained in:
@@ -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');
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
/* Brand colors */
|
||||
:root {
|
||||
--woonoow-primary: <?php echo esc_attr($primary); ?>;
|
||||
}
|
||||
|
||||
/* Logo */
|
||||
#login h1 a {
|
||||
<?php if (!empty($logo)): ?>
|
||||
background-image: url(<?php echo esc_url($logo); ?>);
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
<?php else: ?>
|
||||
/* Text logo fallback */
|
||||
background: none !important;
|
||||
width: auto !important;
|
||||
height: auto !important;
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: var(--woonoow-primary);
|
||||
text-indent: 0 !important;
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
<?php if (empty($logo)): ?>
|
||||
#login h1 a::after {
|
||||
content: '<?php echo esc_js($store_name); ?>';
|
||||
display: block;
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
/* Tagline */
|
||||
<?php if (!empty($tagline)): ?>
|
||||
#login h1::after {
|
||||
content: '<?php echo esc_js($tagline); ?>';
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
font-weight: normal;
|
||||
}
|
||||
<?php endif; ?>
|
||||
|
||||
/* Primary button color */
|
||||
.wp-core-ui .button-primary {
|
||||
background: var(--woonoow-primary);
|
||||
border-color: var(--woonoow-primary);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.wp-core-ui .button-primary:hover,
|
||||
.wp-core-ui .button-primary:focus {
|
||||
background: var(--woonoow-primary);
|
||||
border-color: var(--woonoow-primary);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* Link color */
|
||||
#login a {
|
||||
color: var(--woonoow-primary);
|
||||
}
|
||||
|
||||
#login a:hover,
|
||||
#login a:focus {
|
||||
color: var(--woonoow-primary);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/* Input focus */
|
||||
input[type="text"]:focus,
|
||||
input[type="password"]:focus,
|
||||
input[type="email"]:focus {
|
||||
border-color: var(--woonoow-primary);
|
||||
box-shadow: 0 0 0 1px var(--woonoow-primary);
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Change login logo URL
|
||||
*/
|
||||
public static function login_logo_url() {
|
||||
return home_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Change login logo title
|
||||
*/
|
||||
public static function login_logo_title() {
|
||||
return get_option('blogname', 'WooNooW');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get logo URL or fallback to text
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user