From 766f2353e007d9aa0da4dbbbef4f069551237112 Mon Sep 17 00:00:00 2001 From: dwindown Date: Wed, 19 Nov 2025 17:10:48 +0700 Subject: [PATCH] fix: Blank page error and reorganize notification cards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed two issues: 1. Blank Page Error (ReferenceError) - EditTemplate.tsx referenced removed 'variables' object - Changed to use 'availableVariables' array - Error occurred in preview generation function 2. Reorganized Notification Cards - Added clear category sections: Recipients and Channels - Recipients section: Staff, Customer (ready for Affiliate, Merchant) - Channels section: Channel Configuration, Activity Log - Better structure for future scalability - Cleaner UI with section headers and descriptions Structure Now: ├── Recipients │ ├── Staff (Orders, Products, Customers) │ └── Customer (Orders, Shipping, Account) └── Channels ├── Channel Configuration (Email, Push, WhatsApp, Telegram) └── Activity Log (Coming soon) Ready to add: - Affiliate recipient (for affiliate notifications) - Merchant recipient (for marketplace vendors) --- .../src/routes/Settings/Notifications.tsx | 270 ++++++++++-------- .../Settings/Notifications/EditTemplate.tsx | 2 +- 2 files changed, 147 insertions(+), 125 deletions(-) diff --git a/admin-spa/src/routes/Settings/Notifications.tsx b/admin-spa/src/routes/Settings/Notifications.tsx index 6fbc51a..5a356c7 100644 --- a/admin-spa/src/routes/Settings/Notifications.tsx +++ b/admin-spa/src/routes/Settings/Notifications.tsx @@ -10,139 +10,161 @@ export default function NotificationsSettings() { return ( } // Empty action to trigger contextual header > -
- {/* Staff Notifications */} - - -
-
- -
-
- {__('Staff Notifications')} - - {__('Alerts for admins and staff members')} - -
-
-
- +
+ {/* Recipients Section */} +
+
+

{__('Recipients')}

- {__('Get notified about orders, low stock, new customers, and more. Configure email and push notifications for your team.')} + {__('Configure notifications for different user types')}

-
-
- {__('Orders, Products, Customers')} -
- - - -
- - +
+
+ {/* Staff Notifications */} + + +
+
+ +
+
+ {__('Staff')} + + {__('Alerts for admins and staff members')} + +
+
+
+ +

+ {__('Get notified about orders, low stock, new customers, and more. Configure email and push notifications for your team.')} +

+
+
+ {__('Orders, Products, Customers')} +
+ + + +
+
+
- {/* Customer Notifications */} - - -
-
- -
-
- {__('Customer Notifications')} - - {__('Transactional emails and updates for customers')} - -
-
-
- -

- {__('Manage order confirmations, shipping updates, account emails, and marketing messages sent to your customers.')} -

-
-
- {__('Orders, Shipping, Account')} -
- - - -
-
-
+ {/* Customer Notifications */} + + +
+
+ +
+
+ {__('Customer')} + + {__('Transactional emails and updates for customers')} + +
+
+
+ +

+ {__('Manage order confirmations, shipping updates, account emails, and marketing messages sent to your customers.')} +

+
+
+ {__('Orders, Shipping, Account')} +
+ + + +
+
+
+
+
- {/* Channel Configuration */} - - -
-
- -
-
- {__('Channel Configuration')} - - {__('Configure notification channels and settings')} - -
-
-
- + {/* Channels Section */} +
+
+

{__('Channels')}

- {__('Configure email, push notifications, WhatsApp, Telegram, and other notification channels. Set templates and connection settings.')} + {__('Configure notification delivery methods and settings')}

-
-
- {__('Email, Push, WhatsApp, Telegram')} -
- - - -
- - +
+
+ {/* Channel Configuration */} + + +
+
+ +
+
+ {__('Channel Configuration')} + + {__('Configure notification channels and settings')} + +
+
+
+ +

+ {__('Configure email, push notifications, WhatsApp, Telegram, and other notification channels. Set templates and connection settings.')} +

+
+
+ {__('Email, Push, WhatsApp, Telegram')} +
+ + + +
+
+
- {/* Activity Log */} - - -
-
- -
-
- {__('Activity Log')} - - {__('View notification history and activities')} - -
-
-
- -

- {__('Track all notification activities, view delivery status, and monitor system events.')} -

-
-
- {__('Coming soon')} -
- -
-
-
+ {/* Activity Log */} + + +
+
+ +
+
+ {__('Activity Log')} + + {__('View notification history and activities')} + +
+
+
+ +

+ {__('Track all notification activities, view delivery status, and monitor system events.')} +

+
+
+ {__('Coming soon')} +
+ +
+
+
+
+
); diff --git a/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx b/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx index f7e94db..629ff00 100644 --- a/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx +++ b/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx @@ -318,7 +318,7 @@ export default function EditTemplate() { }); // Highlight variables that don't have sample data - Object.keys(variables).forEach(key => { + availableVariables.forEach(key => { if (!storeVariables[key] && !sampleData[key]) { const sampleValue = `[${key}]`; previewBody = previewBody.replace(new RegExp(`\\{${key}\\}`, 'g'), sampleValue);