feat: 移除目标管理演示页面并优化相关组件
- 删除目标管理演示页面的代码,简化项目结构 - 更新底部导航,移除目标管理演示页面的路由 - 调整相关组件的样式和逻辑,确保界面一致性 - 优化颜色常量的使用,提升视觉效果
This commit is contained in:
@@ -24,6 +24,9 @@ const HealthDataCard: React.FC<HealthDataCardProps> = ({
|
||||
style={[styles.card, style]}
|
||||
>
|
||||
|
||||
<View style={styles.iconContainer}>
|
||||
{icon}
|
||||
</View>
|
||||
<View style={styles.content}>
|
||||
<Text style={styles.title}>{title}</Text>
|
||||
<View style={styles.valueContainer}>
|
||||
@@ -53,14 +56,18 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
iconContainer: {
|
||||
marginRight: 16,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
content: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
},
|
||||
title: {
|
||||
fontSize: 14,
|
||||
color: '#666',
|
||||
marginBottom: 4,
|
||||
fontWeight: '600',
|
||||
},
|
||||
valueContainer: {
|
||||
flexDirection: 'row',
|
||||
@@ -68,14 +75,15 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
value: {
|
||||
fontSize: 24,
|
||||
fontWeight: 'bold',
|
||||
color: '#333',
|
||||
fontWeight: '800',
|
||||
color: '#192126',
|
||||
},
|
||||
unit: {
|
||||
fontSize: 14,
|
||||
color: '#666',
|
||||
marginLeft: 4,
|
||||
marginBottom: 2,
|
||||
fontWeight: '500',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,29 +1,19 @@
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React from 'react';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import HealthDataService from '../../services/healthData';
|
||||
import HealthDataCard from './HealthDataCard';
|
||||
|
||||
interface HeartRateCardProps {
|
||||
resetToken: number;
|
||||
style?: object;
|
||||
heartRate?: number | null;
|
||||
}
|
||||
|
||||
const HeartRateCard: React.FC<HeartRateCardProps> = ({
|
||||
resetToken,
|
||||
style
|
||||
style,
|
||||
heartRate
|
||||
}) => {
|
||||
const [heartRate, setHeartRate] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchHeartRate = async () => {
|
||||
const data = await HealthDataService.getHeartRate();
|
||||
setHeartRate(data);
|
||||
};
|
||||
|
||||
fetchHeartRate();
|
||||
}, [resetToken]);
|
||||
|
||||
const heartIcon = (
|
||||
<Ionicons name="heart" size={24} color="#EF4444" />
|
||||
);
|
||||
@@ -31,7 +21,7 @@ const HeartRateCard: React.FC<HeartRateCardProps> = ({
|
||||
return (
|
||||
<HealthDataCard
|
||||
title="心率"
|
||||
value={heartRate !== null ? heartRate.toString() : '--'}
|
||||
value={heartRate !== null && heartRate !== undefined ? Math.round(heartRate).toString() : '--'}
|
||||
unit="bpm"
|
||||
icon={heartIcon}
|
||||
style={style}
|
||||
|
||||
@@ -1,29 +1,19 @@
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React from 'react';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import HealthDataService from '../../services/healthData';
|
||||
import HealthDataCard from './HealthDataCard';
|
||||
|
||||
interface OxygenSaturationCardProps {
|
||||
resetToken: number;
|
||||
style?: object;
|
||||
oxygenSaturation?: number | null;
|
||||
}
|
||||
|
||||
const OxygenSaturationCard: React.FC<OxygenSaturationCardProps> = ({
|
||||
resetToken,
|
||||
style
|
||||
style,
|
||||
oxygenSaturation
|
||||
}) => {
|
||||
const [oxygenSaturation, setOxygenSaturation] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchOxygenSaturation = async () => {
|
||||
const data = await HealthDataService.getOxygenSaturation();
|
||||
setOxygenSaturation(data);
|
||||
};
|
||||
|
||||
fetchOxygenSaturation();
|
||||
}, [resetToken]);
|
||||
|
||||
const oxygenIcon = (
|
||||
<Ionicons name="water" size={24} color="#3B82F6" />
|
||||
);
|
||||
@@ -31,7 +21,7 @@ const OxygenSaturationCard: React.FC<OxygenSaturationCardProps> = ({
|
||||
return (
|
||||
<HealthDataCard
|
||||
title="血氧饱和度"
|
||||
value={oxygenSaturation !== null ? oxygenSaturation.toString() : '--'}
|
||||
value={oxygenSaturation !== null && oxygenSaturation !== undefined ? oxygenSaturation.toFixed(1) : '--'}
|
||||
unit="%"
|
||||
icon={oxygenIcon}
|
||||
style={style}
|
||||
|
||||
Reference in New Issue
Block a user