feat: 更新 CLAUDE.md 文件及多个组件以优化用户体验和功能

- 更新 CLAUDE.md 文件,重构架构部分,增加认证和数据层的描述
- 在 GoalsScreen 中新增目标模板选择功能,支持用户选择和创建目标
- 在 CreateGoalModal 中添加初始数据支持,优化目标创建体验
- 新增 GoalTemplateModal 组件,提供目标模板选择界面
- 更新 NotificationHelpers,支持构建深度链接以便于导航
- 在 CoachScreen 中处理路由参数,增强用户交互体验
- 更新多个组件的样式和逻辑,提升整体用户体验
- 删除不再使用的中文回复规则文档
This commit is contained in:
richarjiang
2025-08-26 15:04:04 +08:00
parent 7f2afdf671
commit 3f89023447
13 changed files with 1113 additions and 359 deletions

227
constants/goalTemplates.ts Normal file
View File

@@ -0,0 +1,227 @@
import { CreateGoalRequest } from '@/types/goals';
export interface GoalTemplate {
id: string;
title: string;
icon: string;
iconColor: string;
backgroundColor: string;
category: 'recommended' | 'health' | 'lifestyle' | 'exercise';
data: Partial<CreateGoalRequest>;
isRecommended?: boolean;
}
export interface GoalCategory {
id: string;
title: string;
icon?: string;
isRecommended?: boolean;
}
export const goalTemplates: GoalTemplate[] = [
// 改善睡眠分类的模板
{
id: 'afternoon-nap',
title: '睡一会午觉',
icon: 'hotel',
iconColor: '#22D3EE',
backgroundColor: '#E0F2FE',
category: 'health',
data: {
title: '午休时间',
description: '每天午休30分钟恢复精力',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '13:00',
},
isRecommended: true
},
{
id: 'regular-bedtime',
title: '规律作息',
icon: 'access-time',
iconColor: '#8B5CF6',
backgroundColor: '#F3E8FF',
category: 'health',
data: {
title: '保持规律作息',
description: '每天固定时间睡觉起床,建立健康的生物钟',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '22:30',
},
isRecommended: true
},
// 生活习惯分类的模板
{
id: 'eat-breakfast',
title: '坚持吃早餐',
icon: 'restaurant',
iconColor: '#F97316',
backgroundColor: '#FFF7ED',
category: 'lifestyle',
data: {
title: '坚持吃早餐',
description: '每天按时吃早餐,保持营养均衡',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '07:30',
},
isRecommended: true
},
{
id: 'drink-water',
title: '喝八杯水',
icon: 'local-drink',
iconColor: '#06B6D4',
backgroundColor: '#E0F2FE',
category: 'lifestyle',
data: {
title: '每日饮水目标',
description: '每天喝足够的水,保持身体水分',
repeatType: 'daily',
frequency: 8,
hasReminder: true,
reminderTime: '09:00',
},
isRecommended: true
},
{
id: 'read-book',
title: '看一本新书',
icon: 'book',
iconColor: '#8B5CF6',
backgroundColor: '#F3E8FF',
category: 'lifestyle',
data: {
title: '阅读新书',
description: '每天阅读30分钟丰富知识',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '20:00',
}
},
{
id: 'housework',
title: '做一会家务',
icon: 'home',
iconColor: '#F97316',
backgroundColor: '#FFF7ED',
category: 'lifestyle',
data: {
title: '日常家务',
description: '每天做一些家务,保持家居整洁',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '19:00',
}
},
{
id: 'mindfulness',
title: '练习一次正念',
icon: 'self-improvement',
iconColor: '#10B981',
backgroundColor: '#ECFDF5',
category: 'lifestyle',
data: {
title: '正念练习',
description: '每天练习10分钟正念冥想',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '21:00',
},
isRecommended: true
},
// 运动锻炼分类的模板
{
id: 'exercise-duration',
title: '锻炼时长达标',
icon: 'timer',
iconColor: '#7C3AED',
backgroundColor: '#F3E8FF',
category: 'exercise',
data: {
title: '每日锻炼时长',
description: '每天至少锻炼30分钟',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '17:00',
}
},
{
id: 'morning-run',
title: '晨跑',
icon: 'directions-run',
iconColor: '#EF4444',
backgroundColor: '#FEF2F2',
category: 'exercise',
data: {
title: '每日晨跑',
description: '每天早上跑步30分钟保持活力',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '06:30',
}
},
{
id: 'yoga-practice',
title: '瑜伽练习',
icon: 'self-improvement',
iconColor: '#10B981',
backgroundColor: '#ECFDF5',
category: 'exercise',
data: {
title: '每日瑜伽',
description: '每天练习瑜伽,提升身体柔韧性',
repeatType: 'daily',
frequency: 1,
hasReminder: true,
reminderTime: '19:30',
}
},
];
// 分类定义
export const goalCategories: GoalCategory[] = [
{
id: 'recommended',
title: '推荐',
isRecommended: true
},
{
id: 'health',
title: '改善睡眠'
},
{
id: 'lifestyle',
title: '生活习惯'
},
{
id: 'exercise',
title: '运动锻炼'
}
];
// 按类别分组的模板
export const getTemplatesByCategory = (category: string) => {
if (category === 'recommended') {
// 推荐分类显示所有分类中的精选模板
return goalTemplates.filter(template => template.isRecommended);
}
return goalTemplates.filter(template => template.category === category);
};
// 获取所有分类
export const getAllCategories = () => {
return goalCategories;
};