feat(ui): 排行榜与首页打卡卡片多项优化

排行榜性能:
- 客户端乐观缓存:进页面/切周期秒显旧数据,后台静默刷新,消除 2-3s 空白
- 云函数实例缓存 TTL 60s -> 5min,降低全表扫描频率

排行榜 UI:
- 空状态重设计:奖杯光环插画(径向光晕 + 闪光漂浮)
- 领奖台 slot 撑满对齐列表、金银铜底座配色、角标与昵称间距修复、底线对齐

首页打卡卡片:
- 火焰光晕脉动 + 72rpx 大数字 + 分段进度格子
- 计划 >10 天时进度退化为里程碑连续条

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-27 17:28:53 +08:00
parent 4b5f195a18
commit e2becc24aa
9 changed files with 329 additions and 121 deletions
+7 -1
View File
@@ -20,7 +20,13 @@ const TZ_OFFSET_MS = 8 * 60 * 60 * 1000
// a short TTL so repeated board opens (and day/month/year switches within
// a session) reuse one scan. Cold starts just re-scan. Not persistent
// across instances, which is fine - the board needn't be real-time.
const CACHE_TTL = 60 * 1000
// 5min: the board is non-real-time, and the expensive part is the serial
// full-collection scan (100/page). A longer TTL means far fewer re-scans
// while the instance stays warm; the trade-off is a freshly-trained user
// may not see themselves for up to 5min, acceptable for a motivational
// board. The client also keeps its own display cache, so re-entry paints
// instantly regardless of this TTL.
const CACHE_TTL = 5 * 60 * 1000
let _docsCache = null // { latestByOpenid: Map, ts }
let _docsCachePromise = null // in-flight 扫描 promise,防缓存击穿