migrating vendor frontend to new architecture

This commit is contained in:
2025-10-28 22:58:55 +01:00
parent b0cc0385f8
commit cd5097fc04
28 changed files with 312 additions and 228 deletions

View File

@@ -1,14 +1,8 @@
// static/admin/js/components.js
// Setup logging
const COMPONENTS_LOG_LEVEL = 3;
const componentsLog = {
error: (...args) => COMPONENTS_LOG_LEVEL >= 1 && console.error('❌ [COMPONENTS ERROR]', ...args),
warn: (...args) => COMPONENTS_LOG_LEVEL >= 2 && console.warn('⚠️ [COMPONENTS WARN]', ...args),
info: (...args) => COMPONENTS_LOG_LEVEL >= 3 && console.info(' [COMPONENTS INFO]', ...args),
debug: (...args) => COMPONENTS_LOG_LEVEL >= 4 && console.log('🔍 [COMPONENTS DEBUG]', ...args)
};
// ✅ Use centralized logger - ONE LINE!
// Create custom logger for components page
const componentsLog = window.LogConfig.createLogger('COMPONENTS');
/**
* Components Library Alpine.js Component
@@ -132,7 +126,7 @@ function adminComponents() {
}
componentsLog.debug('Code copied to clipboard');
} catch (error) {
componentsLog.error('Failed to copy code:', error);
window.LogConfig.logError(error, 'Copy Code');
if (typeof Utils !== 'undefined' && Utils.showToast) {
Utils.showToast('Failed to copy code', 'error');
}
@@ -150,6 +144,8 @@ function adminComponents() {
info: 'Here is some information.'
};
componentsLog.info('Showing toast example:', type);
if (typeof Utils !== 'undefined' && Utils.showToast) {
Utils.showToast(messages[type] || messages.info, type);
} else {
@@ -170,6 +166,7 @@ function adminComponents() {
}
componentsLog.info('Initializing charts...');
componentsLog.time('Chart Initialization');
// Pie Chart
const pieCanvas = document.getElementById('examplePieChart');
@@ -284,9 +281,10 @@ function adminComponents() {
componentsLog.debug('Bar chart initialized');
}
componentsLog.timeEnd('Chart Initialization');
componentsLog.info('All charts initialized successfully');
} catch (error) {
componentsLog.error('Error initializing charts:', error);
window.LogConfig.logError(error, 'Initialize Charts');
}
}
};