feat: 优化 AI 教练聊天和打卡功能

- 在 AI 教练聊天界面中添加会话缓存功能,支持冷启动时恢复聊天记录
- 实现轻量防抖机制,确保会话变动时及时保存缓存
- 在打卡功能中集成按月加载打卡记录,提升用户体验
- 更新 Redux 状态管理,支持打卡记录的按月加载和缓存
- 新增打卡日历页面,允许用户查看每日打卡记录
- 优化样式以适应新功能的展示和交互
This commit is contained in:
richarjiang
2025-08-14 09:57:13 +08:00
parent 7ad26590e5
commit e3e2f1b8c6
18 changed files with 918 additions and 117 deletions

View File

@@ -41,8 +41,15 @@ function ProgressBarImpl({
}).start();
}, [clamped, animated, animatedValue]);
const lastWidthRef = useRef<number>(0);
const onLayout = (e: LayoutChangeEvent) => {
setTrackWidth(e.nativeEvent.layout.width);
const w = e.nativeEvent.layout.width || 0;
// 仅在宽度发生明显变化时才更新,避免渲染-布局循环
const next = Math.round(w);
if (next > 0 && next !== lastWidthRef.current) {
lastWidthRef.current = next;
setTrackWidth(next);
}
};
const fillWidth = Animated.multiply(animatedValue, trackWidth || 1);