From ac6095a89976a9e74aa6ae86fa42453935cdb961 Mon Sep 17 00:00:00 2001 From: calboo Date: Wed, 11 Feb 2026 13:01:25 +0100 Subject: [PATCH] better task complete animation --- app.py | 6 +- templates/dashboard.html | 135 ++++++++++++++++++++++++++++++--------- 2 files changed, 107 insertions(+), 34 deletions(-) diff --git a/app.py b/app.py index 50b1abd..aa30d77 100644 --- a/app.py +++ b/app.py @@ -95,14 +95,12 @@ def sync_check(): entry_id = str(current_entry['_id']) if current_entry else 'none' - # Create simple hash of tasks (IDs joined string) - # If a task is completed, it drops from this list -> hash changes -> client reloads + # Return list of IDs for smart diffing on frontend task_ids = sorted([str(t['_id']) for t in active_tasks]) - tasks_hash = ','.join(task_ids) return jsonify({ 'entry_hash': entry_id, - 'tasks_hash': tasks_hash + 'task_ids': task_ids }) @app.route('/register', methods=['GET', 'POST']) diff --git a/templates/dashboard.html b/templates/dashboard.html index c3de700..dc9ba43 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -57,6 +57,27 @@ /* Mobile specific timer adjustments */ .timer-display { font-size: 2.5rem !important; margin: 0.5rem 0 1rem 0 !important; } } + + /* Task Animations */ + .checklist-item { + transition: transform 0.4s ease, opacity 0.4s ease, background-color 0.3s; + opacity: 1; + transform: translateX(0); + } + + /* State: Just finished animating out */ + .checklist-item.fade-out-complete { + opacity: 0; + transform: translateX(20px); + pointer-events: none; + } + + /* State: Currently animating out (optional differentiation) */ + .checklist-item.animating-out { + opacity: 0.5; + background-color: #f9f9f9; + text-decoration: line-through; + }