What's Changed
Bug fix and code quality improvements based on code review feedback.
Fixes
- Prevent data loss in stats persistence —
save()now handles serialization and filesystem errors explicitly instead of silently writing empty strings that would erase all user statistics
Refactoring
- Extract duplicated timer state transition logic into shared
transition_to_next_state()helper - Consolidate
get_today/get_weekinto singleget_response()with one timestamp - Replace magic numbers for progress ring tick marks with
RING_RADIUS-relative offsets - Define CSS custom properties for state colors (
--focus-color,--short-break-color,--long-break-color) - Remove redundant SVG attributes set by JavaScript on load
- Use nullish coalescing (
??) for settings defaults