feat: implement header/footer visibility controls for checkout and thankyou pages

- Created LayoutWrapper component to conditionally render header/footer based on route
- Created MinimalHeader component (logo only)
- Created MinimalFooter component (trust badges + policy links)
- Created usePageVisibility hook to get visibility settings per page
- Wrapped ClassicLayout with LayoutWrapper for conditional rendering
- Header/footer visibility now controlled directly in React SPA
- Settings: show/minimal/hide for both header and footer
- Background color support for checkout and thankyou pages
This commit is contained in:
Dwindi Ramadhana
2025-12-25 22:20:48 +07:00
parent c37ecb8e96
commit 9ac09582d2
104 changed files with 14801 additions and 1213 deletions

247
FINAL_FIXES_APPLIED.md Normal file
View File

@@ -0,0 +1,247 @@
# Final Fixes Applied ✅
**Date:** November 27, 2025
**Status:** ALL ISSUES RESOLVED
---
## 🔧 CORRECTIONS MADE
### **1. Logo Source - FIXED ✅**
**Problem:**
- I incorrectly referenced WordPress Customizer (`Appearance > Customize > Site Identity > Logo`)
- Should use WooNooW Admin SPA (`Settings > Store Details`)
**Correct Implementation:**
```php
// Backend: Assets.php
// Get store logo from WooNooW Store Details (Settings > Store Details)
$logo_url = get_option('woonoow_store_logo', '');
$config = [
'storeName' => get_bloginfo('name'),
'storeLogo' => $logo_url, // From Settings > Store Details
// ...
];
```
**Option Name:** `woonoow_store_logo`
**Admin Path:** Settings > Store Details > Store Logo
---
### **2. Blue Color from Design Tokens - FIXED ✅**
**Problem:**
- Blue color (#3B82F6) was coming from `WooNooW Customer SPA - Design Tokens`
- Located in `Assets.php` default settings
**Root Cause:**
```php
// BEFORE - Hardcoded blue
'colors' => [
'primary' => '#3B82F6', // ❌ Blue
'secondary' => '#8B5CF6',
'accent' => '#10B981',
],
```
**Fix:**
```php
// AFTER - Use gray from Store Details or default to gray-900
'colors' => [
'primary' => get_option('woonoow_primary_color', '#111827'), // ✅ Gray-900
'secondary' => '#6B7280', // Gray-500
'accent' => '#10B981',
],
```
**Result:**
- ✅ No more blue color
- ✅ Uses primary color from Store Details if set
- ✅ Defaults to gray-900 (#111827)
- ✅ Consistent with our design system
---
### **3. Icons in Header & Footer - FIXED ✅**
**Problem:**
- Logo not showing in header
- Logo not showing in footer
- Both showing fallback "W" icon
**Fix Applied:**
**Header:**
```tsx
const storeLogo = (window as any).woonoowCustomer?.storeLogo;
const storeName = (window as any).woonoowCustomer?.storeName || 'My Wordpress Store';
{storeLogo ? (
<img src={storeLogo} alt={storeName} className="h-10 w-auto" />
) : (
// Fallback icon + text
)}
```
**Footer:**
```tsx
const storeLogo = (window as any).woonoowCustomer?.storeLogo;
const storeName = (window as any).woonoowCustomer?.storeName || 'My Wordpress Store';
{storeLogo ? (
<img src={storeLogo} alt={storeName} className="h-10 w-auto" />
) : (
// Fallback icon + text
)}
```
**Result:**
- ✅ Logo displays in header when set in Store Details
- ✅ Logo displays in footer when set in Store Details
- ✅ Fallback to icon + text when no logo
- ✅ Consistent across header and footer
---
## 📊 FILES MODIFIED
### **Backend:**
1. **`includes/Frontend/Assets.php`**
- Changed logo source from `get_theme_mod('custom_logo')` to `get_option('woonoow_store_logo')`
- Changed primary color from `#3B82F6` to `get_option('woonoow_primary_color', '#111827')`
- Changed secondary color to `#6B7280` (gray-500)
### **Frontend:**
2. **`customer-spa/src/components/Layout/Header.tsx`**
- Already had logo support (from previous fix)
- Now reads from correct option
3. **`customer-spa/src/components/Layout/Footer.tsx`**
- Added logo support matching header
- Reads from `window.woonoowCustomer.storeLogo`
---
## 🎯 CORRECT ADMIN PATHS
### **Logo Upload:**
```
Admin SPA > Settings > Store Details > Store Logo
```
**Option Name:** `woonoow_store_logo`
**Database:** `wp_options` table
### **Primary Color:**
```
Admin SPA > Settings > Store Details > Primary Color
```
**Option Name:** `woonoow_primary_color`
**Default:** `#111827` (gray-900)
---
## ✅ VERIFICATION CHECKLIST
### **Logo:**
- [x] Upload logo in Settings > Store Details
- [x] Logo appears in header
- [x] Logo appears in footer
- [x] Falls back to icon + text if not set
- [x] Responsive sizing (h-10 = 40px)
### **Colors:**
- [x] No blue color in design tokens
- [x] Primary color defaults to gray-900
- [x] Can be customized in Store Details
- [x] Secondary color is gray-500
- [x] Consistent throughout app
### **Integration:**
- [x] Uses WooNooW Admin SPA settings
- [x] Not dependent on WordPress Customizer
- [x] Consistent with plugin architecture
- [x] No external dependencies
---
## 🔍 DEBUGGING
### **Check Logo Value:**
```javascript
// In browser console
console.log(window.woonoowCustomer.storeLogo);
console.log(window.woonoowCustomer.storeName);
```
### **Check Database:**
```sql
SELECT option_value FROM wp_options WHERE option_name = 'woonoow_store_logo';
SELECT option_value FROM wp_options WHERE option_name = 'woonoow_primary_color';
```
### **Check Design Tokens:**
```javascript
// In browser console
console.log(window.woonoowCustomer.theme.colors);
```
Expected output:
```json
{
"primary": "#111827",
"secondary": "#6B7280",
"accent": "#10B981"
}
```
---
## 📝 IMPORTANT NOTES
### **Logo Storage:**
- Logo is stored as URL in `woonoow_store_logo` option
- Uploaded via Admin SPA > Settings > Store Details
- NOT from WordPress Customizer
- NOT from theme settings
### **Color System:**
- Primary: Gray-900 (#111827) - Main brand color
- Secondary: Gray-500 (#6B7280) - Muted elements
- Accent: Green (#10B981) - Success states
- NO BLUE anywhere in defaults
### **Fallback Behavior:**
- If no logo: Shows "W" icon + store name
- If no primary color: Uses gray-900
- If no store name: Uses "My Wordpress Store"
---
## 🎉 SUMMARY
**All 3 issues corrected:**
1.**Logo source** - Now uses `Settings > Store Details` (not WordPress Customizer)
2.**Blue color** - Removed from design tokens, defaults to gray-900
3.**Icons display** - Logo shows in header and footer when set
**Correct Admin Path:**
```
Admin SPA > Settings > Store Details
```
**Database Options:**
- `woonoow_store_logo` - Logo URL
- `woonoow_primary_color` - Primary color (defaults to #111827)
- `woonoow_store_name` - Store name (falls back to blogname)
---
**Last Updated:** November 27, 2025
**Version:** 2.1.1
**Status:** Production Ready ✅