From 63dbed757ad74a4c00380408e87d9eac8b804467 Mon Sep 17 00:00:00 2001 From: dwindown Date: Tue, 11 Nov 2025 14:51:42 +0700 Subject: [PATCH] fix: Polish notification UI - mobile, colors, and layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## ✅ All UI Improvements ### 1. Contextual Header - Added contextual header to Notifications page - Consistent with Payments and Shipping pages - Saves vertical space ### 2. Mobile View Improvements **Channels Page:** - Responsive flex-col on mobile, flex-row on desktop - Full-width buttons on mobile - Better spacing and alignment - Push subscription toggle in bordered container on mobile **Templates Accordion:** - Better mobile layout - Badges wrap properly - Icon and title alignment improved - Responsive padding ### 3. Active State Colors - **Green color for active channels** (consistent with Payments) - `bg-green-500/20 text-green-600` for active - `bg-muted text-muted-foreground` for inactive - Applied to: - Events page channel icons - Channels page channel icons - Active badges ### 4. Badge Layout - Badges moved under title on mobile - Better visual hierarchy - Title → Badges → Description flow - Proper spacing between elements ### 5. Template Variables Card Removed - Variables already in template editor modal - Click-to-insert functionality - No need for separate reference card - Cleaner page layout ### 6. Accordion Polish - Better padding and spacing - Responsive layout - Icon stays visible - Badges wrap on small screens --- **Next: Email toggle and push settings backend** 🎯 --- .../src/routes/Settings/Notifications.tsx | 1 + .../Settings/Notifications/Channels.tsx | 62 +++++++++-------- .../routes/Settings/Notifications/Events.tsx | 6 +- .../Settings/Notifications/Templates.tsx | 69 ++++--------------- 4 files changed, 53 insertions(+), 85 deletions(-) diff --git a/admin-spa/src/routes/Settings/Notifications.tsx b/admin-spa/src/routes/Settings/Notifications.tsx index ed52590..fcf03e9 100644 --- a/admin-spa/src/routes/Settings/Notifications.tsx +++ b/admin-spa/src/routes/Settings/Notifications.tsx @@ -13,6 +13,7 @@ export default function NotificationsSettings() { } // Empty action to trigger contextual header > diff --git a/admin-spa/src/routes/Settings/Notifications/Channels.tsx b/admin-spa/src/routes/Settings/Notifications/Channels.tsx index df72e0d..399cb01 100644 --- a/admin-spa/src/routes/Settings/Notifications/Channels.tsx +++ b/admin-spa/src/routes/Settings/Notifications/Channels.tsx @@ -169,20 +169,27 @@ export default function NotificationChannels() {
{builtinChannels.map((channel: NotificationChannel) => ( -
-
-
{getChannelIcon(channel.id)}
-
-
+
+
+
+ {getChannelIcon(channel.id)} +
+
+

{channel.label}

+
+
{__('Built-in')} - + {channel.enabled ? __('Active') : __('Inactive')}
-

+

{channel.id === 'email' && __('Email notifications powered by WooCommerce. Configure templates and SMTP settings.')} {channel.id === 'push' && @@ -190,7 +197,7 @@ export default function NotificationChannels() {

-
+
{channel.id === 'push' && pushSupported && ( -
-
- - {pushSubscribed ? __('Subscribed') : __('Not subscribed')} - - { - if (checked) { - subscribeToPush.mutate(); - } else { - unsubscribeFromPush.mutate(); - } - }} - disabled={subscribeToPush.isPending || unsubscribeFromPush.isPending} - /> -
+
+ + {pushSubscribed ? __('Subscribed') : __('Not subscribed')} + + { + if (checked) { + subscribeToPush.mutate(); + } else { + unsubscribeFromPush.mutate(); + } + }} + disabled={subscribeToPush.isPending || unsubscribeFromPush.isPending} + />
)} {channel.id === 'push' && !pushSupported && ( - + {__('Not Supported')} )} diff --git a/admin-spa/src/routes/Settings/Notifications/Events.tsx b/admin-spa/src/routes/Settings/Notifications/Events.tsx index 5fbcf6f..1d4a624 100644 --- a/admin-spa/src/routes/Settings/Notifications/Events.tsx +++ b/admin-spa/src/routes/Settings/Notifications/Events.tsx @@ -150,7 +150,7 @@ export default function NotificationEvents() { className="flex items-center justify-between p-3 rounded-lg border bg-card" >
-
+
{getChannelIcon(channel.id)}
@@ -212,7 +212,7 @@ export default function NotificationEvents() { className="flex items-center justify-between p-3 rounded-lg border bg-card" >
-
+
{getChannelIcon(channel.id)}
@@ -274,7 +274,7 @@ export default function NotificationEvents() { className="flex items-center justify-between p-3 rounded-lg border bg-card" >
-
+
{getChannelIcon(channel.id)}
diff --git a/admin-spa/src/routes/Settings/Notifications/Templates.tsx b/admin-spa/src/routes/Settings/Notifications/Templates.tsx index 2210869..3918c87 100644 --- a/admin-spa/src/routes/Settings/Notifications/Templates.tsx +++ b/admin-spa/src/routes/Settings/Notifications/Templates.tsx @@ -125,20 +125,22 @@ export default function NotificationTemplates() { const customCount = channelTemplates.length; return ( - - -
-
{getChannelIcon(channel.id)}
-
- {channel.label} {__('Templates')} - - {allEvents.length} {__('templates')} - - {customCount > 0 && ( - - {customCount} {__('custom')} + + +
+
{getChannelIcon(channel.id)}
+
+ {channel.label} +
+ + {allEvents.length} {__('templates')} - )} + {customCount > 0 && ( + + {customCount} {__('custom')} + + )} +
@@ -181,47 +183,6 @@ export default function NotificationTemplates() { - - {/* Template Variables Reference */} - -
-
-

{__('Order Variables')}

-
- {'{order_number}'} - {'{order_total}'} - {'{order_status}'} - {'{order_date}'} - {'{payment_method}'} - {'{shipping_method}'} -
-
- -
-

{__('Customer Variables')}

-
- {'{customer_name}'} - {'{customer_email}'} - {'{customer_phone}'} - {'{billing_address}'} - {'{shipping_address}'} -
-
- -
-

{__('Store Variables')}

-
- {'{store_name}'} - {'{store_url}'} - {'{store_email}'} - {'{store_phone}'} -
-
-
-
{/* Template Editor Dialog */} {selectedEvent && selectedChannel && (