feat: 更新训练计划和今日训练页面
- 在训练计划中添加了新的类型定义,优化了排课功能 - 修改了今日训练页面的布局,提升用户体验 - 删除了不再使用的排课相关文件,简化代码结构 - 更新了 Redux 状态管理,确保数据处理的准确性和稳定性
This commit is contained in:
@@ -403,7 +403,7 @@ export default function TodayWorkoutScreen() {
|
||||
|
||||
if (!currentSession) {
|
||||
return (
|
||||
<SafeAreaView style={styles.safeArea}>
|
||||
<View style={styles.safeArea}>
|
||||
<HeaderBar title="今日训练" onBack={() => router.back()} />
|
||||
<View style={styles.emptyContainer}>
|
||||
<Ionicons name="calendar-outline" size={64} color="#9CA3AF" />
|
||||
@@ -416,7 +416,7 @@ export default function TodayWorkoutScreen() {
|
||||
<Text style={styles.createPlanBtnText}>去创建训练计划</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -447,58 +447,61 @@ export default function TodayWorkoutScreen() {
|
||||
|
||||
<View style={styles.content}>
|
||||
{/* 训练计划信息头部 */}
|
||||
<View style={[styles.planHeader, { backgroundColor: `${goalConfig.color}20` }]}>
|
||||
{/* 删除按钮 - 右上角 */}
|
||||
<TouchableOpacity
|
||||
style={styles.deleteBtn}
|
||||
onPress={handleDeleteSession}
|
||||
disabled={loading}
|
||||
>
|
||||
<Ionicons name="trash-outline" size={18} color="#EF4444" />
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity onPress={() => router.push(`/training-plan`)}>
|
||||
<View style={[styles.planHeader, { backgroundColor: `${goalConfig.color}20` }]}>
|
||||
|
||||
<View style={[styles.planColorIndicator, { backgroundColor: goalConfig.color }]} />
|
||||
<View style={styles.planInfo}>
|
||||
<ThemedText style={styles.planTitle}>{goalConfig.title}</ThemedText>
|
||||
<ThemedText style={styles.planDescription}>
|
||||
{currentSession.trainingPlan?.name || '今日训练'}
|
||||
</ThemedText>
|
||||
{/* 进度统计文字 */}
|
||||
{currentSession.status !== 'planned' && (
|
||||
<Text style={styles.planProgressStats}>
|
||||
{workoutStats.completed}/{workoutStats.total} 个动作已完成
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* 右侧区域:圆环进度或开始按钮 */}
|
||||
{currentSession.status === 'planned' ? (
|
||||
{/* 删除按钮 - 右上角 */}
|
||||
<TouchableOpacity
|
||||
style={[styles.planStartBtn, { backgroundColor: goalConfig.color }]}
|
||||
onPress={handleStartWorkout}
|
||||
style={styles.deleteBtn}
|
||||
onPress={handleDeleteSession}
|
||||
disabled={loading}
|
||||
>
|
||||
<Ionicons name="play" size={20} color="#FFFFFF" />
|
||||
<Ionicons name="trash-outline" size={18} color="#EF4444" />
|
||||
</TouchableOpacity>
|
||||
) : (
|
||||
<View style={styles.circularProgressContainer}>
|
||||
<CircularRing
|
||||
size={60}
|
||||
strokeWidth={6}
|
||||
trackColor={`${goalConfig.color}20`}
|
||||
progressColor={goalConfig.color}
|
||||
progress={completionPercentage / 100}
|
||||
showCenterText={false}
|
||||
durationMs={800}
|
||||
/>
|
||||
<View style={styles.circularProgressText}>
|
||||
<Text style={[styles.circularProgressPercentage, { color: goalConfig.color }]}>
|
||||
{completionPercentage}%
|
||||
|
||||
<View style={[styles.planColorIndicator, { backgroundColor: goalConfig.color }]} />
|
||||
<View style={styles.planInfo}>
|
||||
<ThemedText style={styles.planTitle}>{goalConfig.title}</ThemedText>
|
||||
<ThemedText style={styles.planDescription}>
|
||||
{currentSession.trainingPlan?.name || '今日训练'}
|
||||
</ThemedText>
|
||||
{/* 进度统计文字 */}
|
||||
{currentSession.status !== 'planned' && (
|
||||
<Text style={styles.planProgressStats}>
|
||||
{workoutStats.completed}/{workoutStats.total} 个动作已完成
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* 右侧区域:圆环进度或开始按钮 */}
|
||||
{currentSession.status === 'planned' ? (
|
||||
<TouchableOpacity
|
||||
style={[styles.planStartBtn, { backgroundColor: goalConfig.color }]}
|
||||
onPress={handleStartWorkout}
|
||||
disabled={loading}
|
||||
>
|
||||
<Ionicons name="play" size={20} color="#FFFFFF" />
|
||||
</TouchableOpacity>
|
||||
) : (
|
||||
<View style={styles.circularProgressContainer}>
|
||||
<CircularRing
|
||||
size={60}
|
||||
strokeWidth={6}
|
||||
trackColor={`${goalConfig.color}20`}
|
||||
progressColor={goalConfig.color}
|
||||
progress={completionPercentage / 100}
|
||||
showCenterText={false}
|
||||
durationMs={800}
|
||||
/>
|
||||
<View style={styles.circularProgressText}>
|
||||
<Text style={[styles.circularProgressPercentage, { color: goalConfig.color }]}>
|
||||
{completionPercentage}%
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
{/* 训练完成提示 */}
|
||||
{currentSession.status === 'completed' && (
|
||||
@@ -924,7 +927,8 @@ const styles = StyleSheet.create({
|
||||
emptyContainer: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
paddingTop: 40,
|
||||
padding: 20,
|
||||
},
|
||||
emptyTitle: {
|
||||
|
||||
Reference in New Issue
Block a user