feat: 更新标签页和新增统计页面
- 修改标签页的名称和图标,将“探索”改为“统计”,并更新相关逻辑 - 新增统计页面,展示用户健康数据和历史记录 - 优化首页布局,调整组件显示,提升用户体验 - 删除不再使用的代码,简化项目结构
This commit is contained in:
@@ -19,7 +19,7 @@ export default function TabLayout() {
|
|||||||
const routeName = route.name;
|
const routeName = route.name;
|
||||||
const isSelected = (routeName === 'index' && pathname === '/') ||
|
const isSelected = (routeName === 'index' && pathname === '/') ||
|
||||||
(routeName === 'coach' && pathname === '/coach') ||
|
(routeName === 'coach' && pathname === '/coach') ||
|
||||||
(routeName === 'explore' && pathname === '/explore') ||
|
(routeName === 'statistics' && pathname === '/statistics') ||
|
||||||
pathname.includes(routeName);
|
pathname.includes(routeName);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -42,8 +42,8 @@ export default function TabLayout() {
|
|||||||
return { icon: 'house.fill', title: '首页' } as const;
|
return { icon: 'house.fill', title: '首页' } as const;
|
||||||
case 'coach':
|
case 'coach':
|
||||||
return { icon: 'person.3.fill', title: 'Bot' } as const;
|
return { icon: 'person.3.fill', title: 'Bot' } as const;
|
||||||
case 'explore':
|
case 'statistics':
|
||||||
return { icon: 'paperplane.fill', title: '探索' } as const;
|
return { icon: 'chart.pie.fill', title: '统计' } as const;
|
||||||
case 'personal':
|
case 'personal':
|
||||||
return { icon: 'person.fill', title: '个人' } as const;
|
return { icon: 'person.fill', title: '个人' } as const;
|
||||||
default:
|
default:
|
||||||
@@ -125,34 +125,7 @@ export default function TabLayout() {
|
|||||||
tabBarShowLabel: false,
|
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
|
<Tabs.Screen
|
||||||
name="coach"
|
name="coach"
|
||||||
options={{
|
options={{
|
||||||
@@ -182,15 +155,15 @@ export default function TabLayout() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
name="explore"
|
name="index"
|
||||||
options={{
|
options={{
|
||||||
title: '探索',
|
title: '首页',
|
||||||
tabBarIcon: ({ color }) => {
|
tabBarIcon: ({ color }) => {
|
||||||
const isExploreSelected = pathname === '/explore';
|
const isHomeSelected = pathname === '/' || pathname === '/index';
|
||||||
return (
|
return (
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
||||||
<IconSymbol size={22} name="paperplane.fill" color={color} />
|
<IconSymbol size={22} name="house.fill" color={color} />
|
||||||
{isExploreSelected && (
|
{isHomeSelected && (
|
||||||
<Text
|
<Text
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
style={{
|
style={{
|
||||||
@@ -201,7 +174,35 @@ export default function TabLayout() {
|
|||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
flexShrink: 0,
|
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>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { loadPlans } from '@/store/trainingPlanSlice';
|
|||||||
// Removed WorkoutCard import since we no longer use the horizontal carousel
|
// Removed WorkoutCard import since we no longer use the horizontal carousel
|
||||||
import { useAuthGuard } from '@/hooks/useAuthGuard';
|
import { useAuthGuard } from '@/hooks/useAuthGuard';
|
||||||
import { TrainingPlan } from '@/services/trainingPlanApi';
|
import { TrainingPlan } from '@/services/trainingPlanApi';
|
||||||
import { getChineseGreeting } from '@/utils/date';
|
|
||||||
import { useRouter } from 'expo-router';
|
import { useRouter } from 'expo-router';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Animated, Image, PanResponder, Pressable, SafeAreaView, ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native';
|
import { Animated, Image, PanResponder, Pressable, SafeAreaView, ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native';
|
||||||
@@ -260,10 +259,10 @@ export default function HomeScreen() {
|
|||||||
</View>
|
</View>
|
||||||
<ScrollView showsVerticalScrollIndicator={false}>
|
<ScrollView showsVerticalScrollIndicator={false}>
|
||||||
{/* Header Section */}
|
{/* Header Section */}
|
||||||
<View style={styles.header}>
|
{/* <View style={styles.header}>
|
||||||
<ThemedText style={styles.greeting}>{getChineseGreeting()}</ThemedText>
|
<ThemedText style={styles.greeting}>{getChineseGreeting()}</ThemedText>
|
||||||
<ThemedText style={styles.userName}>新学员,欢迎你</ThemedText>
|
<ThemedText style={styles.userName}></ThemedText>
|
||||||
</View>
|
</View> */}
|
||||||
|
|
||||||
{/* Search Box */}
|
{/* Search Box */}
|
||||||
<SearchBox placeholder="搜索" />
|
<SearchBox placeholder="搜索" />
|
||||||
|
|||||||
Reference in New Issue
Block a user