migrating vendor frontend to new architecture
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user