feat: 添加日历功能和进度条组件

- 在项目中引入 dayjs 库以处理日期
- 新增 PlanCard 和 ProgressBar 组件,分别用于展示训练计划和进度条
- 更新首页以显示推荐的训练计划
- 优化个人中心页面的底部留白处理
- 本地化界面文本为中文
This commit is contained in:
richarjiang
2025-08-12 09:16:59 +08:00
parent 1646085428
commit 9796c614ed
11 changed files with 680 additions and 159 deletions

View File

@@ -1,31 +1,24 @@
import { PlanCard } from '@/components/PlanCard';
import { SearchBox } from '@/components/SearchBox';
import { ThemedText } from '@/components/ThemedText';
import { ThemedView } from '@/components/ThemedView';
import { WorkoutCard } from '@/components/WorkoutCard';
import { getChineseGreeting } from '@/utils/date';
import React from 'react';
import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
const workoutData = [
{
id: 1,
title: '体态评估',
duration: 50,
imageSource: require('@/assets/images/react-logo.png'),
title: 'AI体态评估',
duration: 5,
imageSource: 'https://plates-1251306435.cos.ap-guangzhou.myqcloud.com/images/Imagettpg.png',
},
{
id: 2,
title: 'Hand\nTraining',
calories: 600,
duration: 40,
title: '认证教练',
imageSource: require('@/assets/images/react-logo.png'),
},
{
id: 3,
title: 'Core\nWorkout',
calories: 450,
duration: 35,
imageSource: require('@/assets/images/react-logo.png'),
},
}
];
export default function HomeScreen() {
@@ -35,16 +28,16 @@ export default function HomeScreen() {
<ScrollView showsVerticalScrollIndicator={false}>
{/* Header Section */}
<View style={styles.header}>
<ThemedText style={styles.greeting}>Good Morning 🔥</ThemedText>
<ThemedText style={styles.userName}>Pramuditya Uzumaki</ThemedText>
<ThemedText style={styles.greeting}>{getChineseGreeting()} 🔥</ThemedText>
<ThemedText style={styles.userName}></ThemedText>
</View>
{/* Search Box */}
<SearchBox placeholder="Search" />
<SearchBox placeholder="搜索" />
{/* Popular Workouts Section */}
<View style={styles.sectionContainer}>
<ThemedText style={styles.sectionTitle}>Popular Workouts</ThemedText>
<ThemedText style={styles.sectionTitle}></ThemedText>
<ScrollView
horizontal
@@ -56,7 +49,6 @@ export default function HomeScreen() {
<WorkoutCard
key={workout.id}
title={workout.title}
calories={workout.calories}
duration={workout.duration}
imageSource={workout.imageSource}
onPress={() => console.log(`Pressed ${workout.title}`)}
@@ -65,6 +57,30 @@ export default function HomeScreen() {
</ScrollView>
</View>
{/* Today Plan Section */}
<View style={styles.sectionContainer}>
<ThemedText style={styles.sectionTitle}></ThemedText>
<View style={styles.planList}>
<PlanCard
image={'https://plates-1251306435.cos.ap-guangzhou.myqcloud.com/images/Imagettpg.png'}
title="体态评估"
subtitle="评估你的体态,制定训练计划"
level="初学者"
progress={0}
/>
<PlanCard
image={'https://plates-1251306435.cos.ap-guangzhou.myqcloud.com/images/Image30play@2x.png'}
title="30日训练打卡"
subtitle="坚持30天养成训练习惯"
level="初学者"
progress={0.75}
/>
</View>
</View>
{/* Add some spacing at the bottom */}
<View style={styles.bottomSpacing} />
</ScrollView>
@@ -109,6 +125,9 @@ const styles = StyleSheet.create({
paddingHorizontal: 24,
marginBottom: 18,
},
planList: {
paddingHorizontal: 24,
},
workoutScroll: {
paddingLeft: 24,
},