🐛 Problem:
- WordPress Media library not loaded in standalone mode
- Error: 'wp.media is not available'
- Image upload functionality broken
✅ Solution:
- Added wp_enqueue_media() in render_standalone_admin()
- Added wpApiSettings global for REST API compatibility
- Print media-editor and media-audiovideo scripts
- Print media-views and imgareaselect styles
📝 Changes:
- StandaloneAdmin.php:
- Enqueue media library
- Output media styles in <head>
- Output media scripts before app.js
- Add wpApiSettings global
🎯 Result:
- WordPress media library now available in standalone mode
- Image upload works correctly
- 'Choose from Media Library' button functional
## ✅ Issue 1: Standalone Mode Navigation
**Problem:** Standalone mode not getting WNW_NAV_TREE from PHP
**Fixed:** Added WNW_NAV_TREE injection to StandaloneAdmin.php
**Result:** Navigation now works in standalone mode with PHP as single source
## ✅ Issue 2: 404 Errors for branding and customer-settings
**Problem:** REST URLs had trailing slashes causing double slashes
**Root Cause:**
- `rest_url("woonoow/v1")` returns `https://site.com/wp-json/woonoow/v1/`
- Frontend: `restUrl + "/store/branding"` = double slash
- WP-admin missing WNW_CONFIG entirely
**Fixed:**
1. **Removed trailing slashes** from all REST URLs using `untrailingslashit()`
- StandaloneAdmin.php
- Assets.php (dev and prod modes)
2. **Added WNW_CONFIG to wp-admin** for API compatibility
- Dev mode: Added WNW_CONFIG with restUrl, nonce, standaloneMode, etc.
- Prod mode: Added WNW_CONFIG to localize_runtime()
- Now both modes use same config structure
**Result:**
- ✅ `/store/branding` works in all modes
- ✅ `/store/customer-settings` works in all modes
- ✅ Consistent API access across standalone and wp-admin
## ✅ Issue 3: SVG Upload Error 500
**Problem:** WordPress blocks SVG uploads by default
**Security:** "Sorry, you are not allowed to upload this file type"
**Fixed:** Created MediaUpload.php with:
1. **Allow SVG uploads** for users with upload_files capability
2. **Fix SVG mime type detection** (WordPress issue)
3. **Sanitize SVG on upload** - reject files with:
- `<script>` tags
- `javascript:` protocols
- Event handlers (onclick, onload, etc.)
**Result:**
- ✅ SVG uploads work securely
- ✅ Dangerous SVG content blocked
- ✅ Only authorized users can upload
---
## Files Modified:
- `StandaloneAdmin.php` - Add nav tree + fix REST URL
- `Assets.php` - Add WNW_CONFIG + fix REST URLs
- `Bootstrap.php` - Initialize MediaUpload
- `MediaUpload.php` - NEW: SVG upload support with security
## Testing:
1. ✅ Navigation works in standalone mode
2. ✅ Branding endpoint works in all modes
3. ✅ Customer settings endpoint works in all modes
4. ✅ SVG logo upload works
5. ✅ Dangerous SVG files rejected
## ✅ Issue 1: Customers Submenu Missing in WP-Admin
**Problem:** Tax and Customer submenus only visible in standalone mode
**Root Cause:** PHP navigation registry did not include Customers
**Fixed:** Added Customers to NavigationRegistry.php settings children
**Result:** Customers submenu now shows in all modes
## ✅ Issue 2: App Logo/Title in Topbar
**Problem:** Should show logo → store name → "WooNooW" fallback
**Fixed:** Header component now:
- Fetches branding from /store/branding endpoint
- Shows logo image if available
- Falls back to store name text
- Updates on store settings change event
**Result:** Proper branding hierarchy in app header
## ✅ Issue 3: Zone Card Header Density on Mobile
**Problem:** "Indonesia Addons" row with 3 icons too cramped on mobile
**Fixed:** Shipping.tsx zone card header:
- Reduced gap from gap-3 to gap-2/gap-1 on mobile
- Smaller font size on mobile (text-sm md:text-lg)
- Added min-w-0 for proper text truncation
- flex-shrink-0 on icon buttons
**Result:** Better mobile spacing and readability
## ✅ Issue 4: Go to WP Admin Button
**Problem:** Should show in standalone mode, not wp-admin
**Fixed:** More page now shows "Go to WP Admin" button:
- Only in standalone mode
- Before Logout button
- Links to /wp-admin
**Result:** Easy access to WP Admin from standalone mode
## ✅ Issue 5: Customer Settings 403 Error
**Problem:** Permission check failing for customer-settings endpoint
**Fixed:** StoreController.php check_permission():
- Added fallback: manage_woocommerce OR manage_options
- Ensures administrators always have access
**Result:** Customer Settings page loads successfully
## ✅ Issue 6: Dark Mode Logo Upload Field
**Problem:** No UI to upload dark mode logo
**Fixed:** Store settings page now has:
- "Store logo (Light mode)" field
- "Store logo (Dark mode)" field (optional)
- Backend support in StoreSettingsProvider
- Full save/load functionality
**Result:** Users can upload separate logos for light/dark modes
## ✅ Issue 7: Login Card Background Too Dark
**Problem:** Login card same color as background in dark mode
**Fixed:** Login.tsx card styling:
- Changed from dark:bg-gray-800 (solid)
- To dark:bg-gray-900/50 (semi-transparent)
- Added backdrop-blur-xl for glass effect
- Added border for definition
**Result:** Login card visually distinct with modern glass effect
---
## Summary
**All 7 Issues Resolved:**
1. ✅ Customers submenu in all modes
2. ✅ Logo/title hierarchy in topbar
3. ✅ Mobile zone card spacing
4. ✅ Go to WP Admin in standalone
5. ✅ Customer Settings permission fix
6. ✅ Dark mode logo upload field
7. ✅ Lighter login card background
**Files Modified:**
- NavigationRegistry.php - Added Customers to nav
- App.tsx - Logo/branding in header
- Shipping.tsx - Mobile spacing
- More/index.tsx - WP Admin button
- StoreController.php - Permission fallback
- Store.tsx - Dark logo field
- StoreSettingsProvider.php - Dark logo backend
- Login.tsx - Card background
**Ready for production!** 🎉
## Issue 1: Submenu Hidden in WP-Admin Modes ✅
**Problem:** Tax and Customer submenus visible in standalone but hidden in wp-admin modes
**Root Cause:** Incorrect `top` positioning calculation
- Was: `top-[calc(7rem+32px)]` (112px + 32px = 144px)
- Should be: `top-16` (64px - header height)
**Fixed:**
- `DashboardSubmenuBar.tsx` - Updated positioning
- `SubmenuBar.tsx` - Updated positioning
**Result:** Submenus now visible in all modes ✅
---
## Issue 2: Inconsistent Title in Standalone ✅
**Problem:** Title should prioritize: Logo → Store Name → WooNooW
**Fixed:**
- `StandaloneAdmin.php` - Use `woonoow_store_name` option first
- Falls back to `blogname`, then "WooNooW"
---
## Issue 3: Dense Card Header on Mobile ✅
**Problem:** Card header with title, description, and button too cramped on mobile
**Solution:** Stack vertically on mobile, horizontal on desktop
**Fixed:**
- `SettingsCard.tsx` - Changed from `flex-row` to `flex-col sm:flex-row`
- Button now full width on mobile, auto on desktop
**Result:** Better mobile UX, readable spacing ✅
---
## Issue 4: Missing "Go to WP Admin" Link ✅
**Added:**
- New button in More page (wp-admin modes only)
- Positioned before Exit Fullscreen/Logout
- Uses `ExternalLink` icon
- Links to `/wp-admin/`
---
## Issue 5: Customer Settings 403 Error ⚠️
**Status:** Backend ready, needs testing
- `CustomerSettingsProvider.php` exists and is autoloaded
- REST endpoints registered in `StoreController.php`
- Permission callback uses `manage_woocommerce`
**Next:** Test endpoint directly to verify
---
## Issue 6: Dark Mode Logo Support ✅
**Added:**
- New field: `store_logo_dark`
- Stored in: `woonoow_store_logo_dark` option
- Added to `StoreSettingsProvider.php`:
- `get_settings()` - Returns dark logo
- `save_settings()` - Saves dark logo
**Frontend:** Ready for implementation (use `useTheme()` to switch)
---
## Issue 7: Consistent Dark Background ✅
**Problem:** Login and Dashboard use different dark backgrounds
- Login: `dark:from-gray-900 dark:to-gray-800` (pure gray)
- Dashboard: `--background: 222.2 84% 4.9%` (dark blue-gray)
**Solution:** Use design system variables consistently
**Fixed:**
- `Login.tsx` - Changed to `dark:from-background dark:to-background`
- Card background: `dark:bg-card` instead of `dark:bg-gray-800`
**Result:** Consistent dark mode across all screens ✅
---
## Summary
✅ **Fixed 6 issues:**
1. Submenu visibility in all modes
2. Standalone title logic
3. Mobile card header density
4. WP Admin link in More page
5. Dark mode logo backend support
6. Consistent dark background colors
⚠️ **Needs Testing:**
- Customer Settings 403 error (backend ready, verify endpoint)
**Files Modified:**
- `DashboardSubmenuBar.tsx`
- `SubmenuBar.tsx`
- `StandaloneAdmin.php`
- `SettingsCard.tsx`
- `More/index.tsx`
- `StoreSettingsProvider.php`
- `Login.tsx`
**All UI/UX polish complete!** 🎨