Refactor: Streamline product management UI and enhance PWA behavior
**Product List Improvements:** - Move Import/Export to settings menu for cleaner interface - Replace Edit/Variants/Multi-Buys buttons with single Details action - Remove Blazor UI button from product list - Simplify product row actions for better mobile UX **Product Details Enhancements:** - Add Danger Zone section with Delete button at bottom - Improve visual hierarchy and action placement **Navigation Updates:** - Remove hamburger menu toggle (desktop nav always visible) - Rename Settings to Menu in mobile bottom nav - Update settings drawer header and icon **Code Cleanup:** - Remove unused Blazor, Variations, and Variants endpoints (243 lines) - Consolidate variant/multi-buy management within product details - Clean up ProductsController for better maintainability **PWA & Notifications:** - Add proper PWA support detection (only show if browser supports) - Implement session-based notification prompt tracking - Prevent repeated prompts after dismissal in same session - Respect permanent dismissal preferences - Enhance iOS Safari detection and instructions **Technical Details:** - 6 files changed, 96 insertions(+), 286 deletions(-) - Build successful with 0 errors - All features production-ready 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -42,11 +42,37 @@ class AdminNotificationManager {
|
||||
}
|
||||
|
||||
showAdminNotificationPrompt() {
|
||||
// Check if notifications are supported
|
||||
if (!('Notification' in window) || !('PushManager' in window)) {
|
||||
console.log('Admin Notifications: Push notifications not supported in this browser');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if already enabled
|
||||
if (window.pwaManager && window.pwaManager.pushSubscription) {
|
||||
console.log('Admin Notifications: Already subscribed');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if prompt already exists
|
||||
if (document.getElementById('admin-notification-prompt')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if dismissed in current session
|
||||
const sessionDismissed = sessionStorage.getItem('notificationPromptDismissed');
|
||||
if (sessionDismissed === 'true') {
|
||||
console.log('Admin Notifications: Prompt dismissed this session');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if permanently dismissed
|
||||
const permanentlyDismissed = localStorage.getItem('pushNotificationDeclined');
|
||||
if (permanentlyDismissed === 'true') {
|
||||
console.log('Admin Notifications: Notifications declined permanently');
|
||||
return;
|
||||
}
|
||||
|
||||
const promptDiv = document.createElement('div');
|
||||
promptDiv.id = 'admin-notification-prompt';
|
||||
promptDiv.className = 'alert alert-warning alert-dismissible position-fixed';
|
||||
@@ -74,7 +100,7 @@ class AdminNotificationManager {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" id="close-notification-prompt"></button>
|
||||
`;
|
||||
|
||||
document.body.appendChild(promptDiv);
|
||||
@@ -84,6 +110,7 @@ class AdminNotificationManager {
|
||||
try {
|
||||
await this.enableNotifications();
|
||||
promptDiv.remove();
|
||||
sessionStorage.setItem('notificationPromptDismissed', 'true');
|
||||
} catch (error) {
|
||||
console.error('Failed to enable notifications:', error);
|
||||
this.showNotificationError('Failed to enable notifications. Please try again.');
|
||||
@@ -92,8 +119,14 @@ class AdminNotificationManager {
|
||||
|
||||
document.getElementById('remind-later').addEventListener('click', () => {
|
||||
promptDiv.remove();
|
||||
// Set reminder for 1 hour
|
||||
setTimeout(() => this.showAdminNotificationPrompt(), 60 * 60 * 1000);
|
||||
// Mark as dismissed for this session only
|
||||
sessionStorage.setItem('notificationPromptDismissed', 'true');
|
||||
});
|
||||
|
||||
document.getElementById('close-notification-prompt').addEventListener('click', () => {
|
||||
promptDiv.remove();
|
||||
// Mark as dismissed for this session only
|
||||
sessionStorage.setItem('notificationPromptDismissed', 'true');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user