fix(loyalty): align menu item IDs with URL segments for sidebar highlight
The store and merchant init-alpine.js derive currentPage from the URL's last segment (e.g., /loyalty/program -> 'program'). Loyalty menu items used prefixed IDs like 'loyalty-program' which never matched, so sidebar items never highlighted. Fixed by renaming all store/merchant menu item IDs and JS currentPage values to match URL segments: program, cards, analytics, transactions, pins, settings — consistent with how every other module works. Also reverted the init-alpine.js guard that broke storeCode extraction, and added missing loyalty.common.contact_admin_setup translation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -65,16 +65,14 @@ function data() {
|
||||
openSections: getStoreSidebarSectionsFromStorage(),
|
||||
|
||||
init() {
|
||||
// Set current page from URL (only if not already set by child component)
|
||||
if (!this.currentPage) {
|
||||
const path = window.location.pathname;
|
||||
const segments = path.split('/').filter(Boolean);
|
||||
// For /store/ABC/orders/123 -> 'orders' (skip numeric IDs)
|
||||
const last = segments[segments.length - 1] || 'dashboard';
|
||||
this.currentPage = /^\d+$/.test(last) && segments.length > 2
|
||||
? segments[segments.length - 2]
|
||||
: last;
|
||||
}
|
||||
// Set current page from URL
|
||||
const path = window.location.pathname;
|
||||
const segments = path.split('/').filter(Boolean);
|
||||
// For /store/ABC/orders/123 -> 'orders' (skip numeric IDs)
|
||||
const last = segments[segments.length - 1] || 'dashboard';
|
||||
this.currentPage = /^\d+$/.test(last) && segments.length > 2
|
||||
? segments[segments.length - 2]
|
||||
: last;
|
||||
|
||||
// Get store code from server-rendered value or URL fallback
|
||||
this.storeCode = window.STORE_CODE || null;
|
||||
|
||||
Reference in New Issue
Block a user