25 Commits

Author SHA1 Message Date
Yuyao Huang
ab000bcd41 fix: delay scroll handler binding to skip queued scroll event
scrollTop assignment triggers an async scroll event. When all tasks
fit in the viewport, handleScrollFocus recalculates center-aligned
task and picks the last one instead of the saved one. Using setTimeout(0)
defers handler binding to after the queued event fires.
2026-05-09 15:59:13 +08:00
Yuyao Huang
2229fdd0ef fix: directly set in-focus on scrolled task instead of recalculating geometry
Previously handleScrollFocus() recalculated the centered task during
init, which could select a different task than the one scrollToTask()
targeted due to scroll container clamping or DOM layout timing.

Now the scrolled task directly receives the in-focus class, and
handleScrollFocus is only used during user-initiated scroll events.
Also removes the isInitializing flag as it's no longer needed.
2026-05-09 15:52:24 +08:00
Yuyao Huang
1a23558cad fix: restore center alignment in scrollToTask to match handleScrollFocus
Both scrollToTask and handleScrollFocus now use center-of-viewport
calculation, ensuring consistent behavior between scrolling and
in-focus detection.
2026-05-09 15:44:47 +08:00
Yuyao Huang
84181e1ec2 fix: use scrollTop instead of viewport center for in-focus detection
handleScrollFocus now finds the task closest to scrollTop (offset)
instead of closest to the vertical center of the viewport. This
ensures that the saved task matches the user's scroll target.
2026-05-09 15:37:34 +08:00
Yuyao Huang
eca0cf4193 fix: call handleScrollFocus before binding scroll event handlers
Call handleScrollFocus before adding scroll event listeners to prevent
handleScrollSave from triggering during initial setup.
2026-05-09 15:33:40 +08:00
Yuyao Huang
14ebbda585 fix: skip save during initial handleScrollFocus call
Wrap the initial handleScrollFocus call with isInitializing flag
to prevent handleScrollSave from incorrectly updating selected_task_id
2026-05-09 15:29:01 +08:00
Yuyao Huang
fd92c6fe96 fix: save the in-focus task instead of recalculating top task
handleScrollSave now saves the task with in-focus class (determined by
handleScrollFocus as the centered task) rather than recalculating which
task is closest to the top. This ensures consistency between what's
highlighted and what's saved.
2026-05-09 15:21:13 +08:00
Yuyao Huang
12610d26c0 Add debugging logs to trace scroll save behavior 2026-05-09 15:14:11 +08:00
Yuyao Huang
1df90490e6 fix: restore scroll position and in-focus highlighting correctly
- Set selectedTaskId when loading saved task
- Call handleScrollFocus initially to set in-focus class
- Skip saving during initialization unless task matches saved
2026-05-09 14:51:41 +08:00
Yuyao Huang
ca7bd7e24e fix: align task to top instead of center in scroll view 2026-05-09 14:47:03 +08:00
Yuyao Huang
025195be27 Add detailed scroll position diagnostics 2026-05-09 14:43:29 +08:00
Yuyao Huang
0f1fa712a9 Add delayed scrollTop checks to catch post-load changes 2026-05-09 14:39:00 +08:00
Yuyao Huang
df74f1b8a7 Add end-of-loadTasks scrollTop debug log 2026-05-09 14:35:28 +08:00
Yuyao Huang
295fde8a75 Add debug logging for goals data 2026-05-09 14:26:57 +08:00
Yuyao Huang
1f4efcd7b3 Add debug logging for scroll position restoration 2026-05-09 14:16:15 +08:00
Yuyao Huang
643ba56768 fix: skip initial handleScrollFocus call to prevent position override
Remove immediate handleScrollFocus() call in initScrollFocus().
Only actual user scroll events will trigger position saving now.
2026-05-09 14:08:22 +08:00
Yuyao Huang
27f85cd913 fix: prevent scroll position override during page initialization
Add isInitializing flag to block persistSelectedTask during loadTasks,
preventing handleScrollFocus from overwriting the saved scroll position
2026-05-09 14:05:11 +08:00
Yuyao Huang
f021395773 fix: ensure scroll position is restored before initializing scroll focus
Move initScrollFocus() after scrollToTask() to prevent handleScrollFocus()
from incorrectly updating selected_task_id before the saved position is restored
2026-05-09 13:59:57 +08:00
Yuyao Huang
6a2e0537ea fix: remove duplicate submit handler that caused double task creation
The Save button already has type=submit which naturally triggers
form submission. The additional click handler dispatching submit
event caused handleTaskSubmit to run twice.
2026-05-09 13:03:03 +08:00
Yuyao Huang
be4d11a60e fix: mobile task creation button reliability
- Add novalidate to task-form to prevent browser validation quirks
- Add explicit click handler for Save button that triggers
  form submission via dispatched event for mobile compatibility
2026-05-09 12:55:05 +08:00
Yuyao Huang
2629e8f2cd feat: move config.py to config.example.py, exclude config.py from git tracking
- Copy config.py to config.example.py as template (tracked in git)
- Add config.py to .gitignore (local config per developer)
- Update README.md with configuration setup instructions
- Fix outdated references (TinyDB -> SQLite, add missing files)
- Persist goal selection across task and note pages
2026-05-09 10:12:37 +08:00
Yuyao Huang
3c325bdb0f feat(notes): add notes feature with CRUD operations and UI
- Implement notes database schema and API endpoints
- Add notes page with filtering, search, and markdown support
- Persist selected goal and task preferences for better UX
- Include responsive design and mobile-friendly layout
2026-05-08 17:42:42 +08:00
Yuyao Huang
a8fe6ed7b3 Migrate from TinyDB to SQLite
- Replace TinyDB (JSON file) with sqlite3 for data persistence
- Add schema.py: table creation + data migration from db.json
- Rewrite database.py: all CRUD operations use sqlite3 directly
- All data retains original IDs via migration script
- Remove tinydb dependency from pyproject.toml
2026-05-08 16:18:26 +08:00
Yuyao Huang
6b05ba3e2c Improve tasks UI: scroll-to-focus picker, landscape layout, height alignment
- Complete tasks now displayed in scroll view alongside unfinished tasks
- Priority order: completed tasks first (by finished_time desc), then unfinished (by order asc)
- Time picker-style scroll: wheel scroll snaps per task, center item gets visual focus
- Landscape mode (>=1024px): scroll view + edit panel side by side, panel always visible
- Portrait mode: edit panel slides in from right on tap
- Fixed flex layout so scroll view and edit panel align perfectly in height
2026-05-08 15:47:25 +08:00
Yuyao Huang
f3bffa40cd Initial commit: GoalsBreakDown web app
- Flask backend with TinyDB database
- Multi-user auth with bcrypt password hashing
- Goal CRUD with activation/deactivation and per-user limits
- Task CRUD with status tracking (todo/doing/pending/done)
- Focus rule: one doing task per goal
- Time picker-style scroll view with drag-and-drop reordering
- Admin panel for user management
- uv environment management
2026-05-08 12:41:19 +08:00