feat: 更新应用名称和图标,优化用户界面
- 将应用名称修改为“Health Bot”,提升品牌识别度 - 更新应用图标为 logo.png,确保视觉一致性 - 删除不再使用的 ai-coach-chat 页面,简化代码结构 - 更新多个页面的导航和按钮文本,提升用户体验 - 添加体重历史记录功能,支持用户追踪健康数据 - 优化 Redux 状态管理,确保数据处理的准确性和稳定性
This commit is contained in:
@@ -8,16 +8,18 @@ import {
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Dimensions,
|
||||
Modal,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
View
|
||||
} from 'react-native';
|
||||
import Toast from 'react-native-toast-message';
|
||||
|
||||
const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
|
||||
|
||||
interface BMICardProps {
|
||||
weight?: number;
|
||||
height?: number;
|
||||
@@ -31,8 +33,6 @@ export function BMICard({ weight, height, style }: BMICardProps) {
|
||||
const canCalculate = canCalculateBMI(weight, height);
|
||||
let bmiResult: BMIResult | null = null;
|
||||
|
||||
|
||||
|
||||
if (canCalculate && weight && height) {
|
||||
try {
|
||||
bmiResult = getBMIResult(weight, height);
|
||||
@@ -156,56 +156,88 @@ export function BMICard({ weight, height, style }: BMICardProps) {
|
||||
style={styles.modalBackdrop}
|
||||
onPress={handleHideInfoModal}
|
||||
>
|
||||
<Pressable style={styles.modalContainer} onPress={(e) => e.stopPropagation()}>
|
||||
<View style={styles.modalContent}>
|
||||
<View style={styles.modalHeader}>
|
||||
<Pressable
|
||||
style={styles.modalContainer}
|
||||
onPress={(e) => e.stopPropagation()}
|
||||
>
|
||||
{/* 弹窗头部 */}
|
||||
<View style={styles.modalHeader}>
|
||||
<View style={styles.modalTitleContainer}>
|
||||
<View style={styles.modalIconContainer}>
|
||||
<Ionicons name="fitness" size={24} color="#3B82F6" />
|
||||
</View>
|
||||
<Text style={styles.modalTitle}>BMI 指数说明</Text>
|
||||
<TouchableOpacity
|
||||
onPress={handleHideInfoModal}
|
||||
style={styles.closeButton}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
<Ionicons name="close" size={20} color="#6B7280" />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
<TouchableOpacity
|
||||
onPress={handleHideInfoModal}
|
||||
style={styles.closeButton}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
<Ionicons name="close" size={20} color="#6B7280" />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* 内容区域 - 去除滚动,精简设计 */}
|
||||
<View style={styles.modalContent}>
|
||||
{/* 介绍部分 */}
|
||||
<View style={styles.introSection}>
|
||||
<Text style={styles.modalDescription}>
|
||||
BMI 是评估体重与身高关系的健康指标
|
||||
</Text>
|
||||
<View style={styles.formulaContainer}>
|
||||
<Text style={styles.formulaText}>
|
||||
计算公式:体重(kg) ÷ 身高²(m)
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<ScrollView
|
||||
style={styles.modalBody}
|
||||
showsVerticalScrollIndicator={false}
|
||||
contentContainerStyle={{ paddingBottom: 20 }}
|
||||
>
|
||||
<Text style={styles.modalDescription}>
|
||||
BMI(身体质量指数)是评估体重与身高关系的常用指标,计算公式为:体重(kg) ÷ 身高²(m)
|
||||
</Text>
|
||||
{/* BMI 分类标准 - 紧凑设计 */}
|
||||
<View style={styles.categoriesSection}>
|
||||
<Text style={styles.sectionTitle}>分类标准</Text>
|
||||
<View style={styles.categoriesGrid}>
|
||||
{BMI_CATEGORIES.map((category, index) => {
|
||||
const colors = index === 0 ? { bg: '#FEF3C7', text: '#B45309' } :
|
||||
index === 1 ? { bg: '#E8F5E8', text: '#2D5016' } :
|
||||
index === 2 ? { bg: '#FEF3C7', text: '#B45309' } :
|
||||
{ bg: '#FEE2E2', text: '#B91C1C' };
|
||||
|
||||
<Text style={styles.sectionTitle}>BMI 分类标准</Text>
|
||||
{BMI_CATEGORIES.map((category, index) => {
|
||||
const colors = index === 0 ? { bg: '#FFF4E6', text: '#8B7355' } :
|
||||
index === 1 ? { bg: '#E8F5E8', text: '#2D5016' } :
|
||||
index === 2 ? { bg: '#FEF3C7', text: '#B45309' } :
|
||||
{ bg: '#FEE2E2', text: '#B91C1C' };
|
||||
|
||||
return (
|
||||
<View key={index} style={[styles.categoryItem, { backgroundColor: colors.bg }]}>
|
||||
<View style={styles.categoryHeader}>
|
||||
<Text style={[styles.categoryName, { color: colors.text }]}>
|
||||
{category.name}
|
||||
</Text>
|
||||
<Text style={[styles.categoryRange, { color: colors.text }]}>
|
||||
{category.range}
|
||||
return (
|
||||
<View key={index} style={[styles.categoryCompact, { backgroundColor: colors.bg }]}>
|
||||
<View style={styles.categoryCompactHeader}>
|
||||
<Text style={[styles.categoryCompactName, { color: colors.text }]}>
|
||||
{category.name}
|
||||
</Text>
|
||||
<Text style={[styles.categoryCompactRange, { color: colors.text }]}>
|
||||
{category.range}
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={[styles.categoryCompactAdvice, { color: colors.text }]} numberOfLines={2}>
|
||||
{category.advice}
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={styles.categoryAdvice}>
|
||||
{category.advice}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<Text style={styles.disclaimer}>
|
||||
* BMI 仅供参考,不能完全反映身体健康状况。如有疑问,请咨询专业医生。
|
||||
{/* 健康提示 - 简化版 */}
|
||||
<View style={styles.healthTips}>
|
||||
<View style={styles.tipsHeader}>
|
||||
<Ionicons name="heart" size={16} color="#EF4444" />
|
||||
<Text style={styles.tipsTitle}>健康建议</Text>
|
||||
</View>
|
||||
<Text style={styles.tipsContent}>
|
||||
保持均衡饮食、规律运动、充足睡眠,定期监测体重变化
|
||||
</Text>
|
||||
</ScrollView>
|
||||
</View>
|
||||
|
||||
{/* 免责声明 - 精简版 */}
|
||||
<View style={styles.disclaimerCompact}>
|
||||
<Ionicons name="information-circle" size={14} color="#6B7280" />
|
||||
<Text style={styles.disclaimerCompactText}>
|
||||
BMI 仅供参考,如有疑问请咨询专业医生
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
</Pressable>
|
||||
@@ -336,8 +368,7 @@ const styles = StyleSheet.create({
|
||||
padding: 20,
|
||||
},
|
||||
modalContainer: {
|
||||
width: '90%',
|
||||
maxHeight: '85%',
|
||||
width: screenWidth * 0.92,
|
||||
backgroundColor: '#FFFFFF',
|
||||
borderRadius: 24,
|
||||
overflow: 'hidden',
|
||||
@@ -347,98 +378,161 @@ const styles = StyleSheet.create({
|
||||
shadowOpacity: 0.3,
|
||||
shadowRadius: 20,
|
||||
},
|
||||
modalContent: {
|
||||
maxHeight: '100%',
|
||||
},
|
||||
modalHeader: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
padding: 24,
|
||||
padding: 20,
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: '#F3F4F6',
|
||||
backgroundColor: '#FAFAFA',
|
||||
},
|
||||
modalTitleContainer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
},
|
||||
modalIconContainer: {
|
||||
width: 40,
|
||||
height: 40,
|
||||
borderRadius: 12,
|
||||
backgroundColor: '#EFF6FF',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
marginRight: 12,
|
||||
},
|
||||
modalTitle: {
|
||||
fontSize: 22,
|
||||
fontSize: 20,
|
||||
fontWeight: '800',
|
||||
color: '#111827',
|
||||
letterSpacing: -0.5,
|
||||
},
|
||||
closeButton: {
|
||||
padding: 8,
|
||||
borderRadius: 20,
|
||||
width: 36,
|
||||
height: 36,
|
||||
borderRadius: 18,
|
||||
backgroundColor: '#F3F4F6',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
modalBody: {
|
||||
paddingHorizontal: 24,
|
||||
paddingVertical: 20,
|
||||
|
||||
// 内容区域样式
|
||||
modalContent: {
|
||||
paddingHorizontal: 20,
|
||||
paddingBottom: 24,
|
||||
},
|
||||
|
||||
// 介绍部分
|
||||
introSection: {
|
||||
marginBottom: 20,
|
||||
},
|
||||
modalDescription: {
|
||||
fontSize: 16,
|
||||
color: '#4B5563',
|
||||
lineHeight: 26,
|
||||
marginBottom: 28,
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#F8FAFC',
|
||||
padding: 16,
|
||||
borderRadius: 12,
|
||||
borderLeftWidth: 4,
|
||||
borderLeftColor: '#3B82F6',
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: 20,
|
||||
fontWeight: '800',
|
||||
color: '#111827',
|
||||
marginBottom: 16,
|
||||
letterSpacing: -0.3,
|
||||
},
|
||||
categoryItem: {
|
||||
borderRadius: 16,
|
||||
padding: 20,
|
||||
marginBottom: 16,
|
||||
borderWidth: 1,
|
||||
borderColor: 'rgba(0,0,0,0.05)',
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOpacity: 0.05,
|
||||
shadowRadius: 4,
|
||||
elevation: 2,
|
||||
},
|
||||
categoryHeader: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
marginBottom: 12,
|
||||
},
|
||||
categoryName: {
|
||||
fontSize: 18,
|
||||
fontWeight: '800',
|
||||
letterSpacing: -0.2,
|
||||
},
|
||||
categoryRange: {
|
||||
fontSize: 15,
|
||||
fontWeight: '700',
|
||||
backgroundColor: 'rgba(255,255,255,0.8)',
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 4,
|
||||
borderRadius: 20,
|
||||
},
|
||||
categoryAdvice: {
|
||||
fontSize: 15,
|
||||
color: '#374151',
|
||||
lineHeight: 22,
|
||||
fontWeight: '500',
|
||||
textAlign: 'center',
|
||||
marginBottom: 12,
|
||||
},
|
||||
disclaimer: {
|
||||
formulaContainer: {
|
||||
backgroundColor: '#F8FAFC',
|
||||
borderRadius: 12,
|
||||
padding: 16,
|
||||
borderLeftWidth: 4,
|
||||
borderLeftColor: '#3B82F6',
|
||||
},
|
||||
formulaText: {
|
||||
fontSize: 15,
|
||||
color: '#1F2937',
|
||||
fontWeight: '600',
|
||||
textAlign: 'center',
|
||||
},
|
||||
|
||||
// 分类部分
|
||||
categoriesSection: {
|
||||
marginBottom: 18,
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: 16,
|
||||
fontWeight: '800',
|
||||
color: '#111827',
|
||||
marginBottom: 12,
|
||||
textAlign: 'center',
|
||||
},
|
||||
categoriesGrid: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
gap: 8,
|
||||
},
|
||||
categoryCompact: {
|
||||
flex: 1,
|
||||
minWidth: '48%',
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
marginBottom: 8,
|
||||
},
|
||||
categoryCompactHeader: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
marginBottom: 6,
|
||||
},
|
||||
categoryCompactName: {
|
||||
fontSize: 14,
|
||||
fontWeight: '700',
|
||||
},
|
||||
categoryCompactRange: {
|
||||
fontSize: 12,
|
||||
fontWeight: '600',
|
||||
opacity: 0.8,
|
||||
},
|
||||
categoryCompactAdvice: {
|
||||
fontSize: 11,
|
||||
lineHeight: 16,
|
||||
fontWeight: '500',
|
||||
opacity: 0.9,
|
||||
},
|
||||
|
||||
// 健康提示
|
||||
healthTips: {
|
||||
backgroundColor: '#F9FAFB',
|
||||
borderRadius: 12,
|
||||
padding: 14,
|
||||
marginBottom: 16,
|
||||
borderLeftWidth: 3,
|
||||
borderLeftColor: '#EF4444',
|
||||
},
|
||||
tipsHeader: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginBottom: 6,
|
||||
},
|
||||
tipsTitle: {
|
||||
fontSize: 14,
|
||||
fontWeight: '700',
|
||||
color: '#111827',
|
||||
marginLeft: 6,
|
||||
},
|
||||
tipsContent: {
|
||||
fontSize: 13,
|
||||
color: '#374151',
|
||||
lineHeight: 18,
|
||||
},
|
||||
|
||||
// 免责声明紧凑版
|
||||
disclaimerCompact: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
backgroundColor: '#F9FAFB',
|
||||
borderRadius: 8,
|
||||
padding: 12,
|
||||
marginTop: 4,
|
||||
},
|
||||
disclaimerCompactText: {
|
||||
fontSize: 12,
|
||||
color: '#6B7280',
|
||||
fontStyle: 'italic',
|
||||
marginTop: 24,
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#F9FAFB',
|
||||
padding: 16,
|
||||
borderRadius: 12,
|
||||
lineHeight: 20,
|
||||
lineHeight: 16,
|
||||
marginLeft: 6,
|
||||
flex: 1,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user