From a42ae0d689e727b9f5785f70e1d0adc9a0a5ee82 Mon Sep 17 00:00:00 2001 From: dwindown Date: Tue, 11 Nov 2025 21:04:48 +0700 Subject: [PATCH] fix: Match Customer Events styling and fix submenu active state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🐛 Bug Fixes ### Issue #1: Customer Events Styling Inconsistency ✅ **Customer/Events.tsx:** - ✅ Added `p-3 rounded-lg border bg-card` to channel rows - ✅ Added `p-2 rounded-lg` with conditional background to icons - ✅ Changed Badge variant from "outline" to "secondary" - ✅ Changed "Recipient:" to "Send to:" format - ✅ Now matches Staff Events styling exactly ### Issue #2: Submenu Active State ✅ **SubmenuBar.tsx:** - ✅ Fixed active state detection for sub-pages - ✅ Changed from exact match to `startsWith` check - ✅ Now highlights "Notifications" when on /staff or /customer pages - ✅ Pattern: `pathname === it.path || pathname.startsWith(it.path + "/")` ### Issue #3: Customer Channels Toggles ✅ - Already correct! Customer channels show "Enabled" text without toggles - This is intentional - customers cannot disable core channels from admin ### Issue #4: WooCommerce Template Integration 📋 **Status:** Documented as future enhancement **Reason:** Requires deep WooCommerce integration **Current:** Uses hardcoded default templates **Future:** Load actual WooCommerce email templates --- **Result:** UI consistency fixed, navigation working correctly! 🎉 --- admin-spa/src/components/nav/SubmenuBar.tsx | 4 ++-- .../Settings/Notifications/Customer/Events.tsx | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/admin-spa/src/components/nav/SubmenuBar.tsx b/admin-spa/src/components/nav/SubmenuBar.tsx index afbe4be..cc41394 100644 --- a/admin-spa/src/components/nav/SubmenuBar.tsx +++ b/admin-spa/src/components/nav/SubmenuBar.tsx @@ -22,8 +22,8 @@ export default function SubmenuBar({ items = [], fullscreen = false, headerVisib
{items.map((it) => { const key = `${it.label}-${it.path || it.href}`; - // Fix: Always use exact match to prevent first submenu from being always active - const isActive = !!it.path && pathname === it.path; + // Check if current path starts with the submenu path (for sub-pages like /settings/notifications/staff) + const isActive = !!it.path && (pathname === it.path || pathname.startsWith(it.path + '/')); const cls = [ 'ui-ctrl inline-flex items-center gap-2 rounded-md px-2.5 py-1.5 border text-sm whitespace-nowrap', 'focus:outline-none focus:ring-0 focus:shadow-none', diff --git a/admin-spa/src/routes/Settings/Notifications/Customer/Events.tsx b/admin-spa/src/routes/Settings/Notifications/Customer/Events.tsx index 1130bcd..63c82dc 100644 --- a/admin-spa/src/routes/Settings/Notifications/Customer/Events.tsx +++ b/admin-spa/src/routes/Settings/Notifications/Customer/Events.tsx @@ -119,30 +119,32 @@ export default function CustomerEvents() {
-
+
{enabledChannels.map((channel: NotificationChannel) => { const channelSettings = event.channels[channel.id]; const isEnabled = channelSettings?.enabled || false; const recipient = channelSettings?.recipient || 'customer'; return ( -
+
-
+
{getChannelIcon(channel.id)}
{channel.label} {channel.builtin && ( - + {__('Built-in')} )}
-
- {__('Recipient')}: {recipient} -
+ {isEnabled && ( + + {__('Send to')}: {recipient === 'admin' ? __('Admin') : recipient === 'customer' ? __('Customer') : __('Both')} + + )}