feat: 更新标签页和新增统计页面

- 修改标签页的名称和图标,将“探索”改为“统计”,并更新相关逻辑
- 新增统计页面,展示用户健康数据和历史记录
- 优化首页布局,调整组件显示,提升用户体验
- 删除不再使用的代码,简化项目结构
This commit is contained in:
richarjiang
2025-08-18 08:43:44 +08:00
parent 6a67fb21f7
commit 93918366a9
3 changed files with 51 additions and 51 deletions

View File

@@ -19,7 +19,7 @@ export default function TabLayout() {
const routeName = route.name;
const isSelected = (routeName === 'index' && pathname === '/') ||
(routeName === 'coach' && pathname === '/coach') ||
(routeName === 'explore' && pathname === '/explore') ||
(routeName === 'statistics' && pathname === '/statistics') ||
pathname.includes(routeName);
return {
@@ -42,8 +42,8 @@ export default function TabLayout() {
return { icon: 'house.fill', title: '首页' } as const;
case 'coach':
return { icon: 'person.3.fill', title: 'Bot' } as const;
case 'explore':
return { icon: 'paperplane.fill', title: '探索' } as const;
case 'statistics':
return { icon: 'chart.pie.fill', title: '统计' } as const;
case 'personal':
return { icon: 'person.fill', title: '个人' } as const;
default:
@@ -125,34 +125,7 @@ export default function TabLayout() {
tabBarShowLabel: false,
};
}}>
<Tabs.Screen
name="index"
options={{
title: '首页',
tabBarIcon: ({ color }) => {
const isHomeSelected = pathname === '/' || pathname === '/index';
return (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<IconSymbol size={22} name="house.fill" color={color} />
{isHomeSelected && (
<Text
numberOfLines={1}
style={{
color: color,
fontSize: 12,
fontWeight: '600',
marginLeft: 6,
textAlign: 'center',
flexShrink: 0,
}}>
</Text>
)}
</View>
);
},
}}
/>
<Tabs.Screen
name="coach"
options={{
@@ -182,15 +155,15 @@ export default function TabLayout() {
}}
/>
<Tabs.Screen
name="explore"
name="index"
options={{
title: '探索',
title: '首页',
tabBarIcon: ({ color }) => {
const isExploreSelected = pathname === '/explore';
const isHomeSelected = pathname === '/' || pathname === '/index';
return (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<IconSymbol size={22} name="paperplane.fill" color={color} />
{isExploreSelected && (
<IconSymbol size={22} name="house.fill" color={color} />
{isHomeSelected && (
<Text
numberOfLines={1}
style={{
@@ -201,7 +174,35 @@ export default function TabLayout() {
textAlign: 'center',
flexShrink: 0,
}}>
</Text>
)}
</View>
);
},
}}
/>
<Tabs.Screen
name="statistics"
options={{
title: '统计',
tabBarIcon: ({ color }) => {
const isStatisticsSelected = pathname === '/statistics';
return (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<IconSymbol size={22} name="chart.pie.fill" color={color} />
{isStatisticsSelected && (
<Text
numberOfLines={1}
style={{
color: color,
fontSize: 12,
fontWeight: '600',
marginLeft: 6,
textAlign: 'center',
flexShrink: 0,
}}>
</Text>
)}
</View>

View File

@@ -12,7 +12,6 @@ import { loadPlans } from '@/store/trainingPlanSlice';
// Removed WorkoutCard import since we no longer use the horizontal carousel
import { useAuthGuard } from '@/hooks/useAuthGuard';
import { TrainingPlan } from '@/services/trainingPlanApi';
import { getChineseGreeting } from '@/utils/date';
import { useRouter } from 'expo-router';
import React from 'react';
import { Animated, Image, PanResponder, Pressable, SafeAreaView, ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native';
@@ -260,10 +259,10 @@ export default function HomeScreen() {
</View>
<ScrollView showsVerticalScrollIndicator={false}>
{/* Header Section */}
<View style={styles.header}>
{/* <View style={styles.header}>
<ThemedText style={styles.greeting}>{getChineseGreeting()}</ThemedText>
<ThemedText style={styles.userName}></ThemedText>
</View>
<ThemedText style={styles.userName}></ThemedText>
</View> */}
{/* Search Box */}
<SearchBox placeholder="搜索" />