Commit 4d356d8d authored by Malsha Jayakody's avatar Malsha Jayakody

merge all components

parent 875f4af0
...@@ -14807,7 +14807,7 @@ ...@@ -14807,7 +14807,7 @@
"version": "5.0.4", "version": "5.0.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
"devOptional": true, "dev": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
gray: '#666666', gray: '#666666',
grayLight: '#ccc', grayLight: '#ccc',
black: '#0a0a0a', black: '#0a0a0a',
blue:'#ADC4CE', blue: '#ADC4CE',
navyBlue: '#000080', navyBlue: '#000080',
purple: '#DFCCFB', purple: '#DFCCFB',
light_purple: '#D9ACF5', light_purple: '#D9ACF5',
...@@ -20,4 +20,5 @@ export default { ...@@ -20,4 +20,5 @@ export default {
pastalBlue: '#D2E9E9', pastalBlue: '#D2E9E9',
purple_new: '#AC87C5', purple_new: '#AC87C5',
pink_new: '#FF8080', pink_new: '#FF8080',
pastal_blue: '#7469B6',
}; };
...@@ -38,9 +38,9 @@ function BottomTabNavigator() { ...@@ -38,9 +38,9 @@ function BottomTabNavigator() {
); );
} else if (route.name === ROUTES.SKIN_WELCOME) { } else if (route.name === ROUTES.SKIN_WELCOME) {
return focused ? ( return focused ? (
<Icon name="home" size={22} color={color} /> <Icon name="pulse-sharp" size={22} color={color} />
) : ( ) : (
<Icon name="home-outline" size={22} color={color} /> <Icon name="pulse-outline" size={22} color={color} />
); );
} else if (route.name === ROUTES.EXERCISE_HOME) { } else if (route.name === ROUTES.EXERCISE_HOME) {
return focused ? ( return focused ? (
...@@ -115,9 +115,9 @@ const styles = StyleSheet.create({ ...@@ -115,9 +115,9 @@ const styles = StyleSheet.create({
backgroundColor: 'rgba(255,255,255,0.1)', backgroundColor: 'rgba(255,255,255,0.1)',
borderTopWidth: 0, borderTopWidth: 0,
borderColor: COLORS.white, borderColor: COLORS.white,
bottom: 5, bottom: 0,
right: 10, right: 0,
left: 10, left: 0,
height: 58, height: 58,
}, },
mr7: { mr7: {
......
...@@ -8,58 +8,98 @@ import { ...@@ -8,58 +8,98 @@ import {
TouchableOpacity, TouchableOpacity,
KeyboardAvoidingView, KeyboardAvoidingView,
ScrollView, ScrollView,
ToastAndroid ToastAndroid,
} from 'react-native'; } from 'react-native';
import LinearGradient from 'react-native-linear-gradient'; import LinearGradient from 'react-native-linear-gradient';
import { COLORS, ROUTES } from '../../constants'; import {COLORS, ROUTES} from '../../constants';
import Logo from '../../assets/icons/mother.svg'; import Logo from '../../assets/icons/mother.svg';
import { Formik } from 'formik'; import {Formik} from 'formik';
import { signup } from '../../services/auth/index'; import {signup} from '../../services/auth/index';
const Register = ({ navigation }) => { const Register = ({navigation}) => {
const onSubmit = async (values) => { const onSubmit = async values => {
let respond = await signup(values.name, values.password, values.email, values.age, values.week); let respond = await signup(
console.log("dataset3",respond.data) values.name,
if(respond.data.success === true){ values.password,
console.log("dataset") values.email,
navigation.navigate(ROUTES.HOME) values.age,
values.week,
);
console.log('dataset3', respond.data);
if (respond.data.success === true) {
console.log('dataset');
navigation.navigate(ROUTES.HOME);
ToastAndroid.show('Login success', ToastAndroid.SHORT); ToastAndroid.show('Login success', ToastAndroid.SHORT);
} } else {
else{
ToastAndroid.show('Network or details not clear !', ToastAndroid.SHORT); ToastAndroid.show('Network or details not clear !', ToastAndroid.SHORT);
} }
}; };
return ( return (
<KeyboardAvoidingView style={{ flex: 1 }}> <KeyboardAvoidingView style={{flex: 1}}>
<ScrollView contentContainerStyle={{ flexGrow: 1 }} bounces={false}> <ScrollView contentContainerStyle={{flexGrow: 1}} bounces={false}>
<View style={styles.container}> <View style={styles.container}>
<View style={styles.wFull}> <View style={styles.wFull}>
<Formik <Formik
initialValues={{ email: '', password: '', name: '', age: '', week: '' }} initialValues={{
onSubmit={values => onSubmit(values)} email: '',
> password: '',
{({ handleChange, handleBlur, handleSubmit, values }) => ( name: '',
age: '',
week: '',
}}
onSubmit={values => onSubmit(values)}>
{({handleChange, handleBlur, handleSubmit, values}) => (
<> <>
<View style={styles.row}> <View style={styles.row}>
<Logo width={55} height={55} style={styles.mr7} /> <Logo width={55} height={55} style={styles.mr7} />
<Text style={styles.brandName}>EmidWife</Text> <Text style={styles.brandName}>EmidWife</Text>
</View> </View>
<Text style={styles.loginContinueTxt}>Register to continue</Text> <Text style={styles.loginContinueTxt}>
<TextInput style={styles.input} placeholder="Name" onChangeText={handleChange('name')} value={values.name} /> Register to continue
<TextInput style={styles.input} placeholder="Email" onChangeText={handleChange('email')} value={values.email} /> </Text>
<TextInput style={styles.input} placeholder="Password" onChangeText={handleChange('password')} value={values.password} /> <TextInput
<TextInput style={styles.input} placeholder="Age" onChangeText={handleChange('age')} value={values.age} /> style={styles.input}
<TextInput style={styles.input} placeholder="Week" onChangeText={handleChange('week')} value={values.week} /> placeholder="Name"
onChangeText={handleChange('name')}
value={values.name}
/>
<TextInput
style={styles.input}
placeholder="Email"
onChangeText={handleChange('email')}
value={values.email}
/>
<TextInput
style={styles.input}
placeholder="Password"
onChangeText={handleChange('password')}
value={values.password}
/>
<TextInput
style={styles.input}
placeholder="Age"
onChangeText={handleChange('age')}
value={values.age}
/>
<TextInput
style={styles.input}
placeholder="Week"
onChangeText={handleChange('week')}
value={values.week}
/>
<View style={styles.loginBtnWrapper}> <View style={styles.loginBtnWrapper}>
<LinearGradient <LinearGradient
colors={[COLORS.gradientForm, COLORS.bgColor]} colors={[COLORS.gradientForm, COLORS.bgColor]}
style={styles.linearGradient} style={styles.linearGradient}
start={{ y: 0.0, x: 0.0 }} start={{y: 0.0, x: 0.0}}
end={{ y: 1.0, x: 0.0 }}> end={{y: 1.0, x: 0.0}}>
<TouchableOpacity activeOpacity={0.7} style={styles.loginBtn} onPress={handleSubmit}> <TouchableOpacity
activeOpacity={0.7}
style={styles.loginBtn}
onPress={handleSubmit}>
<Text style={styles.loginText}>Sign Up</Text> <Text style={styles.loginText}>Sign Up</Text>
</TouchableOpacity> </TouchableOpacity>
</LinearGradient> </LinearGradient>
...@@ -114,6 +154,7 @@ const styles = StyleSheet.create({ ...@@ -114,6 +154,7 @@ const styles = StyleSheet.create({
borderRadius: 12, borderRadius: 12,
height: 45, height: 45,
paddingVertical: 0, paddingVertical: 0,
color: COLORS.black,
}, },
// Login Btn Styles // Login Btn Styles
loginBtnWrapper: { loginBtnWrapper: {
......
...@@ -27,7 +27,9 @@ const GameLevelPage = ({route, navigation}) => { ...@@ -27,7 +27,9 @@ const GameLevelPage = ({route, navigation}) => {
</View> </View>
<View style={styles.diamondContainer}> <View style={styles.diamondContainer}>
<View style={styles.innerCircle}> <View style={styles.innerCircle}>
<Text style={styles.scoreText}>{predictedGameLevel}</Text> <Text style={styles.scoreText}>
{predictedGameLevel === 0 ? '2' : predictedGameLevel}
</Text>
</View> </View>
</View> </View>
<TouchableOpacity <TouchableOpacity
......
...@@ -152,6 +152,7 @@ const MainDetailsFormInSinhala = ({navigation}) => { ...@@ -152,6 +152,7 @@ const MainDetailsFormInSinhala = ({navigation}) => {
onChangeText={text => setAge(text)} // Use setAge for the age field onChangeText={text => setAge(text)} // Use setAge for the age field
keyboardType="numeric" // Set keyboardType appropriately keyboardType="numeric" // Set keyboardType appropriately
value={age} value={age}
required
/> />
</View> </View>
<View style={{marginTop: 15}}> <View style={{marginTop: 15}}>
...@@ -243,7 +244,7 @@ const MainDetailsFormInSinhala = ({navigation}) => { ...@@ -243,7 +244,7 @@ const MainDetailsFormInSinhala = ({navigation}) => {
value={previousChildBirthExperiences} value={previousChildBirthExperiences}
/> />
</View> </View>
<View style={{marginTop: 55}}> <View style={{marginTop: 35}}>
<TouchableOpacity <TouchableOpacity
style={{ style={{
backgroundColor: COLORS.normal_purple, backgroundColor: COLORS.normal_purple,
......
...@@ -47,7 +47,7 @@ const QuestionInEnglishPage = ({navigation, route}) => { ...@@ -47,7 +47,7 @@ const QuestionInEnglishPage = ({navigation, route}) => {
const loadData = () => { const loadData = () => {
axios axios
// .get('http://192.168.8.161:8070/api/quiz/all_english') // .get('http://192.168.8.161:8070/api/quiz/all_english')
.get('http://10.0.2.2:8070/api/quiz/all_english') .get('http://16.16.97.48/api/quiz/all_english')
.then(response => { .then(response => {
// console.log(response.data); // console.log(response.data);
setQuestions(response.data.data); setQuestions(response.data.data);
...@@ -99,16 +99,40 @@ const QuestionInEnglishPage = ({navigation, route}) => { ...@@ -99,16 +99,40 @@ const QuestionInEnglishPage = ({navigation, route}) => {
<ActivityIndicator size={150} color={COLORS.dark_purple} /> <ActivityIndicator size={150} color={COLORS.dark_purple} />
</View> </View>
) : ( ) : (
<ScrollView style={styles.container}> <LinearGradient
<LinearGradient style={{
style={{ flex: 1,
flex: 1, width: '100%',
}} height: '100%',
colors={[COLORS.white, '#FDCEDF']}> }}
{questions colors={[COLORS.white, '#FDCEDF']}>
.slice(questionIndex, questionIndex + 2) {questions
.map((question, index) => ( .slice(questionIndex, questionIndex + 2)
<View style={{padding: 18, marginTop: 42}} key={question._id}> .map((question, index) => (
<View style={{padding: 18, marginTop: 42}} key={question._id}>
<View
style={{
justifyContent: 'center',
alignItems: 'center',
}}>
<Text
style={{
color: '#DE3163',
fontSize: 22,
fontWeight: 'bold',
}}>
Question {questionIndex + index + 1}
</Text>
</View>
<View
style={{
backgroundColor: 'white',
borderColor: '#FFC107', // Add this line to set the border color
borderWidth: 3,
borderRadius: 17,
marginTop: 5,
padding: 12,
}}>
<View <View
style={{ style={{
justifyContent: 'center', justifyContent: 'center',
...@@ -116,178 +140,154 @@ const QuestionInEnglishPage = ({navigation, route}) => { ...@@ -116,178 +140,154 @@ const QuestionInEnglishPage = ({navigation, route}) => {
}}> }}>
<Text <Text
style={{ style={{
color: '#DE3163', color: 'black',
fontSize: 22, fontSize: 15,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 10,
}}> }}>
Question {questionIndex + index + 1} {question.question}
</Text> </Text>
</View> </View>
<View <View
style={{ style={{
backgroundColor: 'white', marginTop: 30,
borderColor: '#FFC107', // Add this line to set the border color gap: 2,
borderWidth: 3, marginBottom: 5,
borderRadius: 17, color: 'black',
marginTop: 10, marginRight: 25,
padding: 14,
}}> }}>
<View <RadioButton
style={{ label={questions[questionIndex + index].answers[0]}
justifyContent: 'center', selected={
alignItems: 'center', selectedAnswerIndices[questionIndex + index] === 0
}}> }
<Text onPress={() =>
style={{ setSelectedAnswer(0, questionIndex + index)
color: 'black', }
fontSize: 15, value={3}
fontWeight: 'bold', />
marginTop: 16, <RadioButton
}}> label={questions[questionIndex + index].answers[1]}
{question.question} selected={
</Text> selectedAnswerIndices[questionIndex + index] === 1
</View> }
<View onPress={() =>
style={{ setSelectedAnswer(1, questionIndex + index)
marginTop: 30, }
gap: 15, value={2}
marginBottom: 15, />
color: 'black', <RadioButton
marginRight: 25, label={questions[questionIndex + index].answers[2]}
}}> selected={
<RadioButton selectedAnswerIndices[questionIndex + index] === 2
label={questions[questionIndex + index].answers[0]} }
selected={ onPress={() =>
selectedAnswerIndices[questionIndex + index] === 0 setSelectedAnswer(2, questionIndex + index)
} }
onPress={() => value={1}
setSelectedAnswer(0, questionIndex + index) />
} <RadioButton
value={3} textColor="black"
/> label={questions[questionIndex + index].answers[3]}
<RadioButton selected={
label={questions[questionIndex + index].answers[1]} selectedAnswerIndices[questionIndex + index] === 3
selected={ }
selectedAnswerIndices[questionIndex + index] === 1 onPress={() =>
} setSelectedAnswer(3, questionIndex + index)
onPress={() => }
setSelectedAnswer(1, questionIndex + index) value={0}
} />
value={2}
/>
<RadioButton
label={questions[questionIndex + index].answers[2]}
selected={
selectedAnswerIndices[questionIndex + index] === 2
}
onPress={() =>
setSelectedAnswer(2, questionIndex + index)
}
value={1}
/>
<RadioButton
textColor="black"
label={questions[questionIndex + index].answers[3]}
selected={
selectedAnswerIndices[questionIndex + index] === 3
}
onPress={() =>
setSelectedAnswer(3, questionIndex + index)
}
value={0}
/>
</View>
</View> </View>
</View> </View>
))} </View>
<View ))}
style={{ <View
flexDirection: 'row', style={{
justifyContent: 'space-between', flexDirection: 'row',
marginTop: 25, justifyContent: 'space-between',
marginBottom: 50, marginTop: 25,
}}> marginBottom: 50,
{!isOnFirstQuestions && ( }}>
<TouchableOpacity {!isOnFirstQuestions && (
<TouchableOpacity
style={{
backgroundColor: '#DE3163',
height: 50,
justifyContent: 'center',
alignItems: 'center',
marginHorizontal: 20,
borderRadius: 16,
width: 140,
elevation: 10,
}}
onPress={handlePrevious}>
<Text
bold
medium
center
style={{ style={{
backgroundColor: '#DE3163', color: 'white',
height: 50, fontSize: 20,
justifyContent: 'center', fontWeight: 'bold',
alignItems: 'center', }}>
marginHorizontal: 20, Back
borderRadius: 16, </Text>
width: 140, </TouchableOpacity>
elevation: 10, )}
}} {!isOnLastQuestions && (
onPress={handlePrevious}> <TouchableOpacity
<Text style={{
bold backgroundColor: '#DE3163',
medium height: 50,
center justifyContent: 'center',
style={{ alignItems: 'center',
color: 'white', marginHorizontal: isOnFirstQuestions ? 240 : 20,
fontSize: 20, borderRadius: 16,
fontWeight: 'bold', width: 140,
}}> elevation: 10,
Back }}
</Text> onPress={handleNext}>
</TouchableOpacity> <Text
)} bold
{!isOnLastQuestions && ( medium
<TouchableOpacity center
style={{ style={{
backgroundColor: '#DE3163', color: 'white',
height: 50, fontWeight: 'bold',
justifyContent: 'center', fontSize: 20,
alignItems: 'center', }}>
marginHorizontal: isOnFirstQuestions ? 240 : 20, Next
borderRadius: 16, </Text>
width: 140, </TouchableOpacity>
elevation: 10, )}
}} {isOnLastQuestions && (
onPress={handleNext}> <TouchableOpacity
<Text style={{
bold backgroundColor: '#116A7B',
medium height: 50,
center justifyContent: 'center',
style={{ alignItems: 'center',
color: 'white', marginHorizontal: 20,
fontWeight: 'bold', borderRadius: 16,
fontSize: 20, width: 150,
}}> elevation: 10,
Next }}
</Text> onPress={handleNavigationToQuizScore}>
</TouchableOpacity> <Text
)} bold
{isOnLastQuestions && ( medium
<TouchableOpacity center
style={{ style={{
backgroundColor: '#116A7B', color: 'white',
height: 50, fontSize: 20,
justifyContent: 'center', fontWeight: 'bold',
alignItems: 'center', }}>
marginHorizontal: 20, Submit
borderRadius: 16, </Text>
width: 150, </TouchableOpacity>
elevation: 10, )}
}} </View>
onPress={handleNavigationToQuizScore}> </LinearGradient>
<Text
bold
medium
center
style={{
color: 'white',
fontSize: 20,
fontWeight: 'bold',
}}>
Submit
</Text>
</TouchableOpacity>
)}
</View>
</LinearGradient>
</ScrollView>
)} )}
</> </>
); );
......
...@@ -47,7 +47,7 @@ const QuestionInSinhalaPage = ({navigation, route}) => { ...@@ -47,7 +47,7 @@ const QuestionInSinhalaPage = ({navigation, route}) => {
const loadData = () => { const loadData = () => {
axios axios
// .get('http://192.168.8.161:8070/api/quiz/all_sinhala') // .get('http://192.168.8.161:8070/api/quiz/all_sinhala')
.get('http://10.0.2.2:8070/api/quiz/all_sinhala') .get('http://16.16.97.48/api/quiz/all_sinhala')
.then(response => { .then(response => {
setQuestions(response.data.data); setQuestions(response.data.data);
setIsLoading(false); setIsLoading(false);
...@@ -95,16 +95,40 @@ const QuestionInSinhalaPage = ({navigation, route}) => { ...@@ -95,16 +95,40 @@ const QuestionInSinhalaPage = ({navigation, route}) => {
<ActivityIndicator size={150} color={COLORS.dark_purple} /> <ActivityIndicator size={150} color={COLORS.dark_purple} />
</View> </View>
) : ( ) : (
<ScrollView style={styles.container}> <LinearGradient
<LinearGradient style={{
style={{ flex: 1,
flex: 1, width: '100%',
}} height: '100%',
colors={[COLORS.white, '#FDCEDF']}> }}
{questions colors={[COLORS.white, '#FDCEDF']}>
.slice(questionIndex, questionIndex + 2) {questions
.map((question, index) => ( .slice(questionIndex, questionIndex + 2)
<View style={{padding: 18, marginTop: 42}} key={question._id}> .map((question, index) => (
<View style={{padding: 18, marginTop: 42}} key={question._id}>
<View
style={{
justifyContent: 'center',
alignItems: 'center',
}}>
<Text
style={{
color: '#DE3163',
fontSize: 22,
fontWeight: 'bold',
}}>
ප්‍රශ්නය {questionIndex + index + 1}
</Text>
</View>
<View
style={{
backgroundColor: 'white',
borderColor: '#FFC107', // Add this line to set the border color
borderWidth: 3,
borderRadius: 17,
marginTop: 5,
padding: 12,
}}>
<View <View
style={{ style={{
justifyContent: 'center', justifyContent: 'center',
...@@ -112,178 +136,154 @@ const QuestionInSinhalaPage = ({navigation, route}) => { ...@@ -112,178 +136,154 @@ const QuestionInSinhalaPage = ({navigation, route}) => {
}}> }}>
<Text <Text
style={{ style={{
color: '#DE3163', color: 'black',
fontSize: 22, fontSize: 15,
fontWeight: 'bold', fontWeight: 'bold',
marginTop: 10,
}}> }}>
ප්‍රශ්නය {questionIndex + index + 1} {question.question}
</Text> </Text>
</View> </View>
<View <View
style={{ style={{
backgroundColor: 'white', marginTop: 30,
borderColor: '#FFC107', // Add this line to set the border color gap: 2,
borderWidth: 3, marginBottom: 5,
borderRadius: 17, color: 'black',
marginTop: 10, marginRight: 25,
padding: 14,
}}> }}>
<View <RadioButton
style={{ label={questions[questionIndex + index].answers[0]}
justifyContent: 'center', selected={
alignItems: 'center', selectedAnswerIndices[questionIndex + index] === 0
}}> }
<Text onPress={() =>
style={{ setSelectedAnswer(0, questionIndex + index)
color: 'black', }
fontSize: 15, value={3}
fontWeight: 'bold', />
marginTop: 16, <RadioButton
}}> label={questions[questionIndex + index].answers[1]}
{question.question} selected={
</Text> selectedAnswerIndices[questionIndex + index] === 1
</View> }
<View onPress={() =>
style={{ setSelectedAnswer(1, questionIndex + index)
marginTop: 30, }
gap: 10, value={2}
marginBottom: 15, />
color: 'black', <RadioButton
marginRight: 25, label={questions[questionIndex + index].answers[2]}
}}> selected={
<RadioButton selectedAnswerIndices[questionIndex + index] === 2
label={questions[questionIndex + index].answers[0]} }
selected={ onPress={() =>
selectedAnswerIndices[questionIndex + index] === 0 setSelectedAnswer(2, questionIndex + index)
} }
onPress={() => value={1}
setSelectedAnswer(0, questionIndex + index) />
} <RadioButton
value={3} textColor="black"
/> label={questions[questionIndex + index].answers[3]}
<RadioButton selected={
label={questions[questionIndex + index].answers[1]} selectedAnswerIndices[questionIndex + index] === 3
selected={ }
selectedAnswerIndices[questionIndex + index] === 1 onPress={() =>
} setSelectedAnswer(3, questionIndex + index)
onPress={() => }
setSelectedAnswer(1, questionIndex + index) value={0}
} />
value={2}
/>
<RadioButton
label={questions[questionIndex + index].answers[2]}
selected={
selectedAnswerIndices[questionIndex + index] === 2
}
onPress={() =>
setSelectedAnswer(2, questionIndex + index)
}
value={1}
/>
<RadioButton
textColor="black"
label={questions[questionIndex + index].answers[3]}
selected={
selectedAnswerIndices[questionIndex + index] === 3
}
onPress={() =>
setSelectedAnswer(3, questionIndex + index)
}
value={0}
/>
</View>
</View> </View>
</View> </View>
))} </View>
<View ))}
style={{ <View
flexDirection: 'row', style={{
justifyContent: 'space-between', flexDirection: 'row',
marginTop: 25, justifyContent: 'space-between',
marginBottom: 50, marginTop: 25,
}}> marginBottom: 50,
{!isOnFirstQuestions && ( }}>
<TouchableOpacity {!isOnFirstQuestions && (
<TouchableOpacity
style={{
backgroundColor: '#DE3163',
height: 50,
justifyContent: 'center',
alignItems: 'center',
marginHorizontal: 20,
borderRadius: 16,
width: 140,
elevation: 10,
}}
onPress={handlePrevious}>
<Text
bold
medium
center
style={{ style={{
backgroundColor: '#DE3163', color: 'white',
height: 50, fontSize: 20,
justifyContent: 'center', fontWeight: 'bold',
alignItems: 'center', }}>
marginHorizontal: 20, ආපසු
borderRadius: 16, </Text>
width: 140, </TouchableOpacity>
elevation: 10, )}
}} {!isOnLastQuestions && (
onPress={handlePrevious}> <TouchableOpacity
<Text style={{
bold backgroundColor: '#DE3163',
medium height: 50,
center justifyContent: 'center',
style={{ alignItems: 'center',
color: 'white', marginHorizontal: isOnFirstQuestions ? 240 : 20,
fontSize: 20, borderRadius: 16,
fontWeight: 'bold', width: 140,
}}> elevation: 10,
ආපසු }}
</Text> onPress={handleNext}>
</TouchableOpacity> <Text
)} bold
{!isOnLastQuestions && ( medium
<TouchableOpacity center
style={{ style={{
backgroundColor: '#DE3163', color: 'white',
height: 50, fontSize: 20,
justifyContent: 'center', fontWeight: 'bold',
alignItems: 'center', }}>
marginHorizontal: isOnFirstQuestions ? 240 : 20, ඊළඟ
borderRadius: 16, </Text>
width: 140, </TouchableOpacity>
elevation: 10, )}
}} {isOnLastQuestions && (
onPress={handleNext}> <TouchableOpacity
<Text style={{
bold backgroundColor: '#116A7B',
medium height: 50,
center justifyContent: 'center',
style={{ alignItems: 'center',
color: 'white', marginHorizontal: 20,
fontSize: 20, borderRadius: 16,
fontWeight: 'bold', width: 150,
}}> elevation: 10,
ඊළඟ }}
</Text> onPress={handleNavigationToQuizScore}>
</TouchableOpacity> <Text
)} bold
{isOnLastQuestions && ( medium
<TouchableOpacity center
style={{ style={{
backgroundColor: '#116A7B', color: 'white',
height: 50, fontSize: 20,
justifyContent: 'center', fontWeight: 'bold',
alignItems: 'center', }}>
marginHorizontal: 20, ස්ථිර කරන්න
borderRadius: 16, </Text>
width: 150, </TouchableOpacity>
elevation: 10, )}
}} </View>
onPress={handleNavigationToQuizScore}> </LinearGradient>
<Text
bold
medium
center
style={{
color: 'white',
fontSize: 20,
fontWeight: 'bold',
}}>
ස්ථිර කරන්න
</Text>
</TouchableOpacity>
)}
</View>
</LinearGradient>
</ScrollView>
)} )}
</> </>
); );
......
...@@ -39,7 +39,7 @@ const QuizOptionsPage = ({navigation}) => { ...@@ -39,7 +39,7 @@ const QuizOptionsPage = ({navigation}) => {
<Text <Text
style={{ style={{
display: 'flex', display: 'flex',
color: '#DC143C', color: COLORS.navyBlue,
fontSize: 20, fontSize: 20,
fontWeight: 'bold', fontWeight: 'bold',
marginBottom: 25, marginBottom: 25,
...@@ -87,7 +87,7 @@ const QuizOptionsPage = ({navigation}) => { ...@@ -87,7 +87,7 @@ const QuizOptionsPage = ({navigation}) => {
<View style={{marginTop: 40}}> <View style={{marginTop: 40}}>
<TouchableOpacity <TouchableOpacity
style={{ style={{
backgroundColor: COLORS.pink_new, backgroundColor: COLORS.pastal_blue,
height: 50, height: 50,
marginBottom: 20, marginBottom: 20,
justifyContent: 'center', justifyContent: 'center',
...@@ -108,7 +108,7 @@ const QuizOptionsPage = ({navigation}) => { ...@@ -108,7 +108,7 @@ const QuizOptionsPage = ({navigation}) => {
<View style={{marginTop: 7}}> <View style={{marginTop: 7}}>
<TouchableOpacity <TouchableOpacity
style={{ style={{
backgroundColor: COLORS.pink_new, backgroundColor: COLORS.pastal_blue,
height: 50, height: 50,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
......
...@@ -41,7 +41,6 @@ const QuizScoreDisplayPage = ({route, navigation}) => { ...@@ -41,7 +41,6 @@ const QuizScoreDisplayPage = ({route, navigation}) => {
const musicKeys = Object.keys(musicFields); const musicKeys = Object.keys(musicFields);
const randomIndex = Math.floor(Math.random() * musicKeys.length); const randomIndex = Math.floor(Math.random() * musicKeys.length);
musicFields[musicKeys[randomIndex]] = 1; musicFields[musicKeys[randomIndex]] = 1;
console.log(musicFields, 'musicFields');
try { try {
const response = await gameLevelPredict( const response = await gameLevelPredict(
formData.age, // Assuming formData contains 'age' formData.age, // Assuming formData contains 'age'
...@@ -60,27 +59,7 @@ const QuizScoreDisplayPage = ({route, navigation}) => { ...@@ -60,27 +59,7 @@ const QuizScoreDisplayPage = ({route, navigation}) => {
musicFields.music_name_e, musicFields.music_name_e,
musicFields.music_name_f, musicFields.music_name_f,
); );
console.log(formData.age, 'age'); console.log(response.data.prediction, 'response.data.prediction');
console.log(formData.depression_level, 'depression_level');
console.log(
formData.previous_child_birth_experiences,
'previous_child_birth_experiences',
);
console.log(formData.marital_status_divorced, 'marital_status_divorced');
console.log(formData.marital_status_married, 'marital_status_married');
console.log(formData.marital_status_single, 'marital_status_single');
console.log(formData.family_background_bad, 'family_background_bad');
console.log(formData.family_background_good, 'family_background_good');
console.log(
formData.family_background_normal,
'family_background_normal',
);
console.log(musicFields.music_name_a, 'a');
console.log(musicFields.music_name_b, 'b');
console.log(musicFields.music_name_c, 'c');
console.log(musicFields.music_name_d, 'd');
console.log(musicFields.music_name_e, 'e');
console.log(musicFields.music_name_f, 'f');
if (response && response.data && response.data.prediction) { if (response && response.data && response.data.prediction) {
console.log('API call successful with response:', response.data); console.log('API call successful with response:', response.data);
const predictedGameLevel = parseInt( const predictedGameLevel = parseInt(
......
...@@ -17,8 +17,8 @@ const WelcomePageGame = ({navigation}) => { ...@@ -17,8 +17,8 @@ const WelcomePageGame = ({navigation}) => {
<Image <Image
source={IMGS.game_img_1} source={IMGS.game_img_1}
style={{ style={{
height: 400, height: 360,
width: 210, width: 190,
borderRadius: 20, borderRadius: 20,
position: 'absolute', position: 'absolute',
top: 2, top: 2,
...@@ -36,7 +36,7 @@ const WelcomePageGame = ({navigation}) => { ...@@ -36,7 +36,7 @@ const WelcomePageGame = ({navigation}) => {
style={{ style={{
paddingHorizontal: 22, paddingHorizontal: 22,
position: 'absolute', position: 'absolute',
top: 450, top: 410,
width: '100%', width: '100%',
}}> }}>
<Text <Text
......
...@@ -179,6 +179,7 @@ const Game02Level01 = ({navigation, route}) => { ...@@ -179,6 +179,7 @@ const Game02Level01 = ({navigation, route}) => {
}, },
}, },
]); ]);
backgroundMusic.current.setVolume(0.0);
} }
}, 0); }, 0);
} else { } else {
......
...@@ -110,6 +110,7 @@ const CravingsPuzzleGame02Level02 = ({navigation}) => { ...@@ -110,6 +110,7 @@ const CravingsPuzzleGame02Level02 = ({navigation}) => {
}, },
}, },
]); ]);
backgroundMusic.current.setVolume(0.0);
} }
}, 0); }, 0);
} else { } else {
......
...@@ -151,6 +151,7 @@ const PuzzleGame02Level03 = ({navigation}) => { ...@@ -151,6 +151,7 @@ const PuzzleGame02Level03 = ({navigation}) => {
}, },
}, },
]); ]);
backgroundMusic.current.setVolume(0.0);
setGuess([]); setGuess([]);
} else { } else {
Alert.alert('Try Again', "That's not a match. Keep trying!"); Alert.alert('Try Again', "That's not a match. Keep trying!");
......
...@@ -110,6 +110,7 @@ const Game02Level04 = ({navigation}) => { ...@@ -110,6 +110,7 @@ const Game02Level04 = ({navigation}) => {
}, },
}, },
]); ]);
backgroundMusic.current.setVolume(0.0);
} }
} else if (foundLadyItem) { } else if (foundLadyItem) {
Alert.alert('Oops!', "This is a lady's item. Try again!", [ Alert.alert('Oops!', "This is a lady's item. Try again!", [
...@@ -259,7 +260,7 @@ const styles = StyleSheet.create({ ...@@ -259,7 +260,7 @@ const styles = StyleSheet.create({
button: { button: {
padding: 10, padding: 10,
backgroundColor: '#056676', backgroundColor: '#056676',
// marginBottom: 75, borderRadius: 5,
}, },
playerImage: { playerImage: {
width: '100%', // Adjust as needed width: '100%', // Adjust as needed
...@@ -289,10 +290,10 @@ const styles = StyleSheet.create({ ...@@ -289,10 +290,10 @@ const styles = StyleSheet.create({
top: 1, top: 1,
}, },
buttonLeft: { buttonLeft: {
left: 200, left: 130,
}, },
buttonRight: { buttonRight: {
right: 70, right: 130,
}, },
buttonDown: { buttonDown: {
bottom: 1, bottom: 1,
......
...@@ -111,6 +111,7 @@ const Game02Level05 = ({navigation}) => { ...@@ -111,6 +111,7 @@ const Game02Level05 = ({navigation}) => {
}, },
}, },
]); ]);
backgroundMusic.current.setVolume(0.0);
} }
} else if (foundLadyItem) { } else if (foundLadyItem) {
Alert.alert('Oops!', "This is a lady's item. Try again!", [ Alert.alert('Oops!', "This is a lady's item. Try again!", [
...@@ -259,7 +260,7 @@ const styles = StyleSheet.create({ ...@@ -259,7 +260,7 @@ const styles = StyleSheet.create({
button: { button: {
padding: 10, padding: 10,
backgroundColor: '#046582', backgroundColor: '#046582',
// marginBottom: 75, borderRadius: 5,
}, },
playerImage: { playerImage: {
width: '100%', // Adjust as needed width: '100%', // Adjust as needed
...@@ -289,10 +290,10 @@ const styles = StyleSheet.create({ ...@@ -289,10 +290,10 @@ const styles = StyleSheet.create({
top: 1, top: 1,
}, },
buttonLeft: { buttonLeft: {
left: 200, left: 140,
}, },
buttonRight: { buttonRight: {
right: 70, right: 140,
}, },
buttonDown: { buttonDown: {
bottom: 1, bottom: 1,
......
...@@ -114,6 +114,7 @@ const Game02Level06 = ({navigation}) => { ...@@ -114,6 +114,7 @@ const Game02Level06 = ({navigation}) => {
}, },
}, },
]); ]);
backgroundMusic.current.setVolume(0.0);
} }
} else if (foundLadyItem) { } else if (foundLadyItem) {
Alert.alert('Oops!', "This is a lady's item. Try again!", [ Alert.alert('Oops!', "This is a lady's item. Try again!", [
...@@ -261,8 +262,8 @@ const styles = StyleSheet.create({ ...@@ -261,8 +262,8 @@ const styles = StyleSheet.create({
}, },
button: { button: {
padding: 10, padding: 10,
backgroundColor: '#056676', backgroundColor: '#554994',
// marginBottom: 75, borderRadius: 5,
}, },
playerImage: { playerImage: {
width: '100%', // Adjust as needed width: '100%', // Adjust as needed
...@@ -292,10 +293,10 @@ const styles = StyleSheet.create({ ...@@ -292,10 +293,10 @@ const styles = StyleSheet.create({
top: 1, top: 1,
}, },
buttonLeft: { buttonLeft: {
left: 200, left: 130,
}, },
buttonRight: { buttonRight: {
right: 70, right: 130,
}, },
buttonDown: { buttonDown: {
bottom: 1, bottom: 1,
......
...@@ -111,7 +111,15 @@ const Game02Level07 = ({navigation}) => { ...@@ -111,7 +111,15 @@ const Game02Level07 = ({navigation}) => {
// Check if two baby items have been collected // Check if two baby items have been collected
if (collectedItems.length + 1 >= 4) { if (collectedItems.length + 1 >= 4) {
Alert.alert('Congratulations 🥳🥳! You won the game.'); Alert.alert('Congratulations 🥳🥳! You won the game.', [
{
text: 'OK',
onPress: () => {
navigation.navigate(ROUTES.Game02ProgressLevel02);
},
},
]);
backgroundMusic.current.setVolume(0.0);
} }
} else if (foundLadyItem) { } else if (foundLadyItem) {
Alert.alert('Oops!', "This is a lady's item. Try again!", [ Alert.alert('Oops!', "This is a lady's item. Try again!", [
...@@ -227,10 +235,10 @@ const styles = StyleSheet.create({ ...@@ -227,10 +235,10 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
}, },
gameBoard: { gameBoard: {
width: 370, width: 360,
height: 420, height: 400,
borderWidth: 2, borderWidth: 2,
marginBottom: 10, marginBottom: 5,
backgroundColor: '#003333', backgroundColor: '#003333',
borderColor: 'white', borderColor: 'white',
}, },
...@@ -256,7 +264,7 @@ const styles = StyleSheet.create({ ...@@ -256,7 +264,7 @@ const styles = StyleSheet.create({
button: { button: {
padding: 10, padding: 10,
backgroundColor: '#056676', backgroundColor: '#056676',
// marginBottom: 15, borderRadius: 5,
}, },
playerImage: { playerImage: {
width: '100%', // Adjust as needed width: '100%', // Adjust as needed
...@@ -286,10 +294,10 @@ const styles = StyleSheet.create({ ...@@ -286,10 +294,10 @@ const styles = StyleSheet.create({
top: 1, top: 1,
}, },
buttonLeft: { buttonLeft: {
left: 200, left: 130,
}, },
buttonRight: { buttonRight: {
right: 70, right: 130,
}, },
buttonDown: { buttonDown: {
bottom: 1, bottom: 1,
......
import axios from "axios"; import axios from 'axios';
const BASE_PATH = 'http://10.0.2.2:8070/api/mother'; const BASE_PATH = 'http://16.16.97.48/api/mother';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
//signIn API Call //signIn API Call
export let signin = async (email, password) => { export let signin = async (email, password) => {
try { try {
let value = await axios.post(BASE_PATH + '/login', { let value = await axios.post(BASE_PATH + '/login', {
email: email, email: email,
password: password, password: password,
}) });
console.log("data1", value.data) console.log('data1', value.data);
if (value.data.success === true) { if (value.data.success === true) {
await AsyncStorage.setItem('userData', JSON.stringify(value.data.data)); await AsyncStorage.setItem('userData', JSON.stringify(value.data.data));
console.log("data") console.log('data');
}
return value;
} catch (error) {
return error
} }
} return value;
} catch (error) {
return error;
}
};
//signIn API Call //signIn API Call
export let signup = async (name, password, email, age, week) => { export let signup = async (name, password, email, age, week) => {
try { try {
let value = await axios.post(BASE_PATH + '/add_mother', { let value = await axios.post(BASE_PATH + '/add_mother', {
name: name, name: name,
password: password, password: password,
email: email, email: email,
age: age, age: age,
week: week, week: week,
}) });
console.log("data1", value.data) console.log('data1', value.data);
if (value.data.success === true) { if (value.data.success === true) {
await AsyncStorage.setItem('userData', JSON.stringify(value.data.data)); await AsyncStorage.setItem('userData', JSON.stringify(value.data.data));
console.log("data") console.log('data');
}
return value;
} catch (error) {
return error
} }
} return value;
\ No newline at end of file } catch (error) {
return error;
}
};
import axios from 'axios'; import axios from 'axios';
// const BASE_PATH = 'http://10.0.2.2:8000'; // const BASE_PATH = 'http://10.0.2.2:8000';
const BASE_PATH = 'http://172.104.34.100:8000/'; const BASE_PATH = 'http://172.104.34.100:8000';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
//initialize payment API Call //initialize payment API Call
......
...@@ -7497,7 +7497,7 @@ typed-array-length@^1.0.6: ...@@ -7497,7 +7497,7 @@ typed-array-length@^1.0.6:
is-typed-array "^1.1.13" is-typed-array "^1.1.13"
possible-typed-array-names "^1.0.0" possible-typed-array-names "^1.0.0"
"typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta", typescript@>=4.9.5, typescript@5.0.4: typescript@5.0.4:
version "5.0.4" version "5.0.4"
resolved "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz" resolved "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz"
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
......
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