Commit de015c32 authored by Isura Eranda's avatar Isura Eranda

new

parent 94ea193e
This diff is collapsed.
...@@ -19,11 +19,14 @@ ...@@ -19,11 +19,14 @@
"@react-navigation/native": "^6.1.17", "@react-navigation/native": "^6.1.17",
"@react-navigation/stack": "^6.3.29", "@react-navigation/stack": "^6.3.29",
"axios": "^1.6.8", "axios": "^1.6.8",
"cloudinary": "^2.2.0",
"cloudinary-react-native": "^1.0.0",
"formik": "^2.4.6", "formik": "^2.4.6",
"metro-react-native-babel-preset": "^0.77.0", "metro-react-native-babel-preset": "^0.77.0",
"moment": "^2.30.1", "moment": "^2.30.1",
"react": "18.2.0", "react": "18.2.0",
"react-native": "0.73.6", "react-native": "0.73.6",
"react-native-chart-kit": "^6.12.0",
"react-native-circular-progress": "^1.4.0", "react-native-circular-progress": "^1.4.0",
"react-native-circular-progress-indicator": "^4.4.2", "react-native-circular-progress-indicator": "^4.4.2",
"react-native-gesture-handler": "^2.16.2", "react-native-gesture-handler": "^2.16.2",
...@@ -41,7 +44,6 @@ ...@@ -41,7 +44,6 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.20.0", "@babel/core": "^7.20.0",
"react-native-image-picker": "^7.1.1",
"@babel/preset-env": "^7.20.0", "@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0", "@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.73.21", "@react-native/babel-preset": "0.73.21",
...@@ -54,6 +56,7 @@ ...@@ -54,6 +56,7 @@
"eslint": "^8.19.0", "eslint": "^8.19.0",
"jest": "^29.6.3", "jest": "^29.6.3",
"prettier": "2.8.8", "prettier": "2.8.8",
"react-native-image-picker": "^7.1.1",
"react-test-renderer": "18.2.0", "react-test-renderer": "18.2.0",
"typescript": "5.0.4" "typescript": "5.0.4"
}, },
......
...@@ -9,20 +9,60 @@ import { ...@@ -9,20 +9,60 @@ import {
Image, Image,
View, View,
ScrollView, ScrollView,
Button Button,
Dimensions
} from 'react-native'; } from 'react-native';
import Logo from '../../../assets/icons/progress.svg'; import Logo from '../../../assets/icons/progress.svg';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
import {
ProgressChart
} from "react-native-chart-kit";
// each value represents a goal ring in Progress chart
const data = {
labels: ["Session 1", "Session 2", "Session 3"], // optional
data: [0.4, 0.0, 0.0]
};
const { width } = Dimensions.get('window');
const ExercisesProgress = (props) => { const ExercisesProgress = (props) => {
const chartConfig={
backgroundColor: "#e26a00",
backgroundGradientFrom: "#fb8c00",
backgroundGradientTo: "#ffa726",
decimalPlaces: 2, // optional, defaults to 2dp
color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
labelColor: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
style: {
borderRadius: 16
},
propsForDots: {
r: "6",
strokeWidth: "2",
stroke: "#ffa726"
},
}
return ( return (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<View style={styles.secondContainer} > <View style={styles.secondContainer} >
<Text style={styles.topTextMain}>ExercisesProgress</Text> <Text style={styles.topTextMain}>ExercisesProgress</Text>
</View> </View>
<View style={styles.thirdContainer}> <View style={styles.thirdContainer}>
<Text>No data found</Text> <ProgressChart
data={data}
width={width}
height={220}
strokeWidth={16}
radius={32}
chartConfig={chartConfig}
hideLegend={false}
/>
</View>
<View style={styles.secondContainer} >
<Text style={styles.topTextMain}>Week Report</Text>
</View>
<View style={styles.secondContainer}>
<Text style={styles.SecondTextMain}>Not Found data</Text>
</View> </View>
</SafeAreaView> </SafeAreaView>
) )
...@@ -41,6 +81,7 @@ const styles = StyleSheet.create({ ...@@ -41,6 +81,7 @@ const styles = StyleSheet.create({
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
paddingHorizontal: 10, paddingHorizontal: 10,
marginTop: 20
}, },
topTextMain: { topTextMain: {
marginTop: 15, marginTop: 15,
...@@ -49,11 +90,18 @@ const styles = StyleSheet.create({ ...@@ -49,11 +90,18 @@ const styles = StyleSheet.create({
marginLeft: 10, marginLeft: 10,
color: "black" color: "black"
}, },
SecondTextMain: {
marginTop: 15,
fontSize: 15,
marginLeft: 10,
color: "black"
},
thirdContainer: { thirdContainer: {
alignItems: "center", alignItems: "center",
textAlign: "center", textAlign: "center",
height: "30%", height: "30%",
marginTop: "20%" marginTop: "10%",
marginHorizontal: 20
} }
}) })
export default ExercisesProgress export default ExercisesProgress
\ No newline at end of file
...@@ -24,6 +24,28 @@ const HealthFormExercise = (props) => { ...@@ -24,6 +24,28 @@ const HealthFormExercise = (props) => {
const [wearableModalVisible, setWearableModalVisible] = useState(false); const [wearableModalVisible, setWearableModalVisible] = useState(false);
const validateInputs = (values) => {
const errors = {};
if (!values.SystolicBP || isNaN(values.SystolicBP) || values.SystolicBP <= 0 || values.SystolicBP > 180) {
errors.SystolicBP = 'Invalid Systolic Blood Pressure (1-180)';
}
if (!values.DiastolicBP || isNaN(values.DiastolicBP) || values.DiastolicBP <= 0 || values.DiastolicBP > 120) {
errors.DiastolicBP = 'Invalid Diastolic Blood Pressure (1-120)';
}
if (!values.Blood_glucose || isNaN(values.Blood_glucose) || values.Blood_glucose <= 0 || values.Blood_glucose > 18) {
errors.Blood_glucose = 'Invalid Blood Glucose (1-400)';
}
if (!values.BodyTemp || isNaN(values.BodyTemp) || values.BodyTemp <= 0 || values.BodyTemp > 113) {
errors.BodyTemp = 'Invalid Body Temperature (1-45)';
}
if (!values.HeartRate || isNaN(values.HeartRate) || values.HeartRate <= 0 || values.HeartRate > 200) {
errors.HeartRate = 'Invalid Heart Rate (1-200)';
}
return errors;
};
useEffect(() => { useEffect(() => {
if (isWearbleDevice) { if (isWearbleDevice) {
const databaseRef = database().ref('test'); const databaseRef = database().ref('test');
...@@ -54,6 +76,12 @@ const HealthFormExercise = (props) => { ...@@ -54,6 +76,12 @@ const HealthFormExercise = (props) => {
} }
const onSubmit = async (values) => { const onSubmit = async (values) => {
const errors = validateInputs(values);
if (Object.keys(errors).length > 0) {
ToastAndroid.show(Object.values(errors).join(', '), ToastAndroid.LONG);
return;
}
let userDataString = await AsyncStorage.getItem('userData'); let userDataString = await AsyncStorage.getItem('userData');
let userData = JSON.parse(userDataString); let userData = JSON.parse(userDataString);
console.log(values) console.log(values)
...@@ -86,6 +114,7 @@ const HealthFormExercise = (props) => { ...@@ -86,6 +114,7 @@ const HealthFormExercise = (props) => {
ToastAndroid.show('Error updating userData !', ToastAndroid.SHORT); ToastAndroid.show('Error updating userData !', ToastAndroid.SHORT);
} }
} }
return ( return (
<SafeAreaView > <SafeAreaView >
<Formik <Formik
......
// // cloudinary.js
// import { Cloudinary } from 'cloudinary-core';
// const cloudinary = new Cloudinary({
// cloud_name: 'dehjozc3p',
// api_key: '381783681172934',
// api_secret: '438Ho1zc1fje40TJplqtpj3wzGU'
// });
// export default cloudinary;
import axios from "axios"; import axios from "axios";
let BASE_PATH = 'http://16.170.242.186:8080'; let BASE_PATH = 'http://16.170.242.186:8080';
let SECOND_BASE_PATH = 'http://16.171.16.144:8070/api/mother'; let SECOND_BASE_PATH = 'http://16.171.16.144:8070/api/mother';
let THIRD_BASE_PATH = 'http://51.20.73.24:8000';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
...@@ -58,3 +59,15 @@ export let updateDeviceStatus = async (id, deviceStatus) => { ...@@ -58,3 +59,15 @@ export let updateDeviceStatus = async (id, deviceStatus) => {
return error return error
} }
} }
export let updatePoseCountStatus = async (url, mode) => {
try {
let value = await axios.post(THIRD_BASE_PATH + '/video_feed', {
video_url: url,
exercise_mode: mode
})
return value;
} catch (error) {
return error
}
}
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment