From e8483c859bf63bd3bbd0a827b16cc013ea0ed6b1 Mon Sep 17 00:00:00 2001 From: yaro Date: Thu, 3 Jul 2025 09:38:39 -0500 Subject: [PATCH] revert 6a0dd75f104dc09c2819993accd2470ee57db388 revert Enhance debugging and logging in settings and toast rendering; add JSON parsing output and improve toast container handling --- routes.py | 3 --- static/js/widget.js | 19 ++++--------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/routes.py b/routes.py index df2c70a..8606406 100644 --- a/routes.py +++ b/routes.py @@ -442,9 +442,6 @@ def settings(): try: state = json.loads(form['formState']) - import pprint - print("🧠 Parsed state:") - pprint.pprint(state, indent=2, width=120) except Exception: flash("Invalid form state submitted. JSON decode failed.", "danger") traceback.print_exc() diff --git a/static/js/widget.js b/static/js/widget.js index ce27f10..d44a51d 100644 --- a/static/js/widget.js +++ b/static/js/widget.js @@ -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); }