revert 6a0dd75f10
revert Enhance debugging and logging in settings and toast rendering; add JSON parsing output and improve toast container handling
This commit is contained in:
parent
b876f1f469
commit
e8483c859b
2 changed files with 4 additions and 18 deletions
|
@ -1,26 +1,15 @@
|
|||
const ToastConfig = {
|
||||
containerId: 'toast-container',
|
||||
positionClasses: 'toast-container position-fixed bottom-0 end-0 p-3',
|
||||
defaultType: 'info',
|
||||
defaultTimeout: 3000
|
||||
};
|
||||
|
||||
function updateToastConfig(overrides = {}) {
|
||||
Object.assign(ToastConfig, overrides);
|
||||
}
|
||||
|
||||
function renderToast({ message, type = ToastConfig.defaultType, timeout = ToastConfig.defaultTimeout }) {
|
||||
function renderToast({ message, type = 'info', timeout = 3000 }) {
|
||||
if (!message) {
|
||||
console.warn('renderToast was called without a message.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Auto-create the toast container if it doesn't exist
|
||||
let container = document.getElementById(ToastConfig.containerId);
|
||||
let container = document.getElementById('toast-container');
|
||||
if (!container) {
|
||||
container = document.createElement('div');
|
||||
container.id = ToastConfig.containerId;
|
||||
container.className = ToastConfig.positionClasses;
|
||||
container.id = 'toast-container';
|
||||
container.className = 'toast-container position-fixed bottom-0 end-0 p-3';
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue