Commit Graph

55 Commits

Author SHA1 Message Date
lc 8079242daf fix: theme not applying to training/records pages
Root cause: themeStyle was on .container only, but modals (picker,
day-detail) were siblings of .container in the WXML tree. CSS custom
properties set via inline style on .container don't cascade to
sibling elements — those elements fall back to app.wxss page-level
defaults (always orange). Users saw modal buttons in orange and
concluded the whole page didn't follow theme.

Fixes:
- index.wxml: Move picker modal inside .container so it inherits
  themeStyle CSS variables (position:fixed is viewport-relative,
  so nesting doesn't affect modal positioning)
- index.js, records.js: Add applyThemeToPage in onLoad alongside
  onShow, preventing a flash of default orange before onShow fires
- timer.js: Add onShow with applyThemeToPage as lifecycle safety
  net; extract _init from onLoad for clean separation
2026-06-04 16:53:53 +08:00
lc e2186b2502 fix: theme persistence — error handling, backup, stale highlight
Bug 1 (critical): setTheme lacked try/catch around wx.setStorageSync.
  If storage write throws (full / permission), the theme silently
  fails to persist but UI has already changed → on next cold start
  getCurrentTheme falls back to orange.
  → Wrap in try/catch; still apply UI change even if storage fails
    (better to see the right color now than revert immediately).

Bug 2 (display): settings onShow called applyThemeToPage (updates
  'theme' object) but never refreshed 'currentThemeId'. After tab
  switching, the radio highlight showed the wrong theme.
  → Add setData({ currentThemeId }) in onShow.

Redundancy: theme now also saved as themeId in user_settings.
  getCurrentTheme falls back to user_settings.themeId if app_theme
  key is unexpectedly missing, providing a recovery path.
2026-06-04 16:43:32 +08:00
lc 89d93c8155 refactor(ui): 12-point UI polish and bugfixes
Bug fixes:
- #1 Remove duplicate month label from calendar-heatmap (shown twice in records)
- #2 Extract shared .modal-overlay to app.wxss (was duplicated in index/records)

UX improvements:
- #3 Add long-press hint to history list in records page
- #4 Add drag handle + catchtouchmove to picker modal
- #5 Extend timer auto-navigate-back from 1.5s to 3s
- #6 Add clear data option in settings with confirmation dialog

Visual/code polish:
- #7 Remove 4 unused @keyframes (shimmer, spin) and 5 unused .icon classes
- #8 Tab bar inactive colors: hardcoded #888/#666 -> var(--text-secondary)
- #10 Split progress-ring observer to avoid redundant setData on size/color changes
- #12 Remove meaningless Math.min(planDay, 99) cap
2026-06-04 16:34:22 +08:00
lc 8c7f633541 refactor: ES6+ modernization + 2 bugfixes
- var→const/let, function→arrow/class across all 13 JS files
- Timer: prototype→class with ES6 getters
- plan days: IIFE→Array.from declarative generation
- storage/plan: unified formatDate via util.js
- Bugfix: getPlanDay now filters by planId (plan switch accuracy)
- Bugfix: getTodayRecord searches all months (cross-month boundary)
- WXML/WXSS unchanged; public API unchanged
2026-06-04 16:29:25 +08:00
lc ff2700c067 backup: snapshot before optimization 2026-06-04 16:25:43 +08:00