From ffb9f6fba1a1e690d834a94f0b2bd48fc15a292f Mon Sep 17 00:00:00 2001 From: Dries Peeters Date: Tue, 21 Oct 2025 20:03:21 +0200 Subject: [PATCH] Update to make the remote work --- app/config.py | 10 ++++----- app/static/enhanced-ui.css | 1 + app/static/form-bridge.css | 2 +- app/static/smart-notifications.js | 37 +++++++++++++++++++++---------- app/templates/projects/view.html | 6 ++--- app/templates/tasks/_kanban.html | 1 + app/templates/tasks/edit.html | 2 +- app/templates/tasks/list.html | 6 ++--- app/templates/tasks/my_tasks.html | 8 ++----- app/templates/tasks/view.html | 2 +- 10 files changed, 43 insertions(+), 32 deletions(-) diff --git a/app/config.py b/app/config.py index bf37bcf..c992e54 100644 --- a/app/config.py +++ b/app/config.py @@ -156,12 +156,12 @@ class TestingConfig(Config): class ProductionConfig(Config): """Production configuration""" FLASK_DEBUG = False - SESSION_COOKIE_SECURE = True - SESSION_COOKIE_HTTPONLY = True - REMEMBER_COOKIE_SECURE = True - # Honor environment configuration; default to enabled in production + # Honor environment with secure-by-default values in production + SESSION_COOKIE_SECURE = os.getenv('SESSION_COOKIE_SECURE', 'true').lower() == 'true' + SESSION_COOKIE_HTTPONLY = os.getenv('SESSION_COOKIE_HTTPONLY', 'true').lower() == 'true' + REMEMBER_COOKIE_SECURE = os.getenv('REMEMBER_COOKIE_SECURE', 'true').lower() == 'true' WTF_CSRF_ENABLED = os.getenv('WTF_CSRF_ENABLED', 'true').lower() == 'true' - WTF_CSRF_SSL_STRICT = True + WTF_CSRF_SSL_STRICT = os.getenv('WTF_CSRF_SSL_STRICT', 'true').lower() == 'true' # Configuration mapping config = { diff --git a/app/static/enhanced-ui.css b/app/static/enhanced-ui.css index 16e9f74..6e62627 100644 --- a/app/static/enhanced-ui.css +++ b/app/static/enhanced-ui.css @@ -337,6 +337,7 @@ .dark .toast { background: #2d3748; + color: #E2E8F0; /* ensure readable text on dark background */ } .toast.removing { diff --git a/app/static/form-bridge.css b/app/static/form-bridge.css index 882ebde..76d0b8e 100644 --- a/app/static/form-bridge.css +++ b/app/static/form-bridge.css @@ -110,7 +110,7 @@ textarea.form-control { min-height: 6rem; resize: vertical; } /* ============================= Badge chips ============================= */ -.chip { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; line-height: 1; border: 1px solid transparent; } +.chip { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; line-height: 1; border: 1px solid transparent; white-space: nowrap; } .chip-neutral { background: #F1F5F9; color: #334155; } .dark .chip-neutral { background: #1F2937; color: #E5E7EB; border-color: #374151; } .chip-success { background: #DCFCE7; color: #166534; } diff --git a/app/static/smart-notifications.js b/app/static/smart-notifications.js index 2fced98..aafaef8 100644 --- a/app/static/smart-notifications.js +++ b/app/static/smart-notifications.js @@ -277,18 +277,31 @@ class SmartNotificationManager { try { const response = await fetch('/api/summary/today'); const summary = await response.json(); - - this.show({ - title: 'Daily Summary', - message: `Today you logged ${summary.hours}h across ${summary.projects} projects. Great work!`, - type: 'success', - priority: 'normal', - persistent: true, - actions: [ - { id: 'view-details', label: 'View Details' }, - { id: 'dismiss', label: 'Dismiss' } - ] - }); + + const hours = (summary && typeof summary.hours === 'number') + ? summary.hours + : (summary && summary.hours ? Number(summary.hours) : 0); + const projects = (summary && typeof summary.projects === 'number') + ? summary.projects + : (summary && summary.projects ? Number(summary.projects) : 0); + + // Build a safe, human-friendly message + const hoursText = isNaN(hours) ? '0' : String(hours); + const projectsText = isNaN(projects) ? '0' : String(projects); + const message = `Today you logged ${hoursText}h across ${projectsText} projects. Great work!`; + + // Auto-dismiss after 8s; no permanent sticky summary to avoid lingering toasts + if (window.toastManager && typeof window.toastManager.show === 'function') { + window.toastManager.show(message, 'success', 8000); + } else { + this.show({ + title: 'Daily Summary', + message, + type: 'success', + priority: 'normal', + persistent: false + }); + } } catch (error) { console.error('Error fetching daily summary:', error); } diff --git a/app/templates/projects/view.html b/app/templates/projects/view.html index 42ca9d6..ded3842 100644 --- a/app/templates/projects/view.html +++ b/app/templates/projects/view.html @@ -81,7 +81,7 @@ 'medium':'bg-sky-100 text-sky-700 dark:bg-sky-900/30 dark:text-sky-300', 'high':'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300', 'urgent':'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300'}[p] if p in ['low','medium','high','urgent'] else 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300' %} - {{ task.priority_display }} + {{ task.priority_display }} {% set s = task.status %} @@ -90,12 +90,12 @@ 'review':'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300', 'done':'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300', 'cancelled':'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200'}[s] if s in ['todo','in_progress','review','done','cancelled'] else 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300' %} - {{ task.status_display }} + {{ task.status_display }} {% if task.due_date %} {% set overdue = task.is_overdue %} - {{ task.due_date.strftime('%Y-%m-%d') }} + {{ task.due_date.strftime('%Y-%m-%d') }} {% else %} {% endif %} diff --git a/app/templates/tasks/_kanban.html b/app/templates/tasks/_kanban.html index ba06e9a..1f3b29b 100644 --- a/app/templates/tasks/_kanban.html +++ b/app/templates/tasks/_kanban.html @@ -498,6 +498,7 @@ font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; + white-space: nowrap; } .kanban-badge i { diff --git a/app/templates/tasks/edit.html b/app/templates/tasks/edit.html index 9252654..fafc1cf 100644 --- a/app/templates/tasks/edit.html +++ b/app/templates/tasks/edit.html @@ -108,7 +108,7 @@ {{ task.priority_display }} - {{ task.status_display }} + {{ task.status_display }} diff --git a/app/templates/tasks/list.html b/app/templates/tasks/list.html index c3e4a4c..17440f4 100644 --- a/app/templates/tasks/list.html +++ b/app/templates/tasks/list.html @@ -127,7 +127,7 @@ 'medium':'bg-sky-100 text-sky-700 dark:bg-sky-900/30 dark:text-sky-300', 'high':'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300', 'urgent':'bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300'}[p] if p in ['low','medium','high','urgent'] else 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300' %} - {{ task.priority_display }} + {{ task.priority_display }} {% set s = task.status %} @@ -136,12 +136,12 @@ 'review':'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300', 'done':'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300', 'cancelled':'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200'}[s] if s in ['todo','in_progress','review','done','cancelled'] else 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300' %} - {{ task.status_display }} + {{ task.status_display }} {% if task.due_date %} {% set overdue = task.is_overdue %} - {{ task.due_date.strftime('%Y-%m-%d') }} + {{ task.due_date.strftime('%Y-%m-%d') }} {% else %} {% endif %} diff --git a/app/templates/tasks/my_tasks.html b/app/templates/tasks/my_tasks.html index 12dd555..dfc0a01 100644 --- a/app/templates/tasks/my_tasks.html +++ b/app/templates/tasks/my_tasks.html @@ -191,12 +191,8 @@
- - {{ task.status_display }} - - - {{ task.priority_display }} - + {{ task.status_display }} + {{ task.priority_display }}
-
+
{% if task.description %}