Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
EmidWife-New
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-24-005
EmidWife-New
Commits
24be488e
Commit
24be488e
authored
May 19, 2024
by
Madiwilage Isura Eranda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'final-app' of
http://gitlab.sliit.lk/2023-24-005/emidwife-new
into final-app
parents
629d12f0
00b60a06
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1079 additions
and
552 deletions
+1079
-552
src/assets/games/motherAndMidWife.jpg
src/assets/games/motherAndMidWife.jpg
+0
-0
src/assets/games/wellBeing.jpg
src/assets/games/wellBeing.jpg
+0
-0
src/assets/user_profile.png
src/assets/user_profile.png
+0
-0
src/constants/colors.js
src/constants/colors.js
+1
-0
src/constants/imgs.js
src/constants/imgs.js
+3
-1
src/constants/routes.js
src/constants/routes.js
+2
-2
src/navigations/AuthNavigator.js
src/navigations/AuthNavigator.js
+113
-98
src/navigations/GameNavigator.js
src/navigations/GameNavigator.js
+6
-1
src/navigations/ProfileNavigator.js
src/navigations/ProfileNavigator.js
+19
-0
src/screens/auth/ProfilePage.js
src/screens/auth/ProfilePage.js
+175
-0
src/screens/home/Home.js
src/screens/home/Home.js
+13
-28
src/screens/home/game/MainDetailsForm.js
src/screens/home/game/MainDetailsForm.js
+104
-28
src/screens/home/game/MainDetailsFormInSinhala.js
src/screens/home/game/MainDetailsFormInSinhala.js
+105
-24
src/screens/home/game/MentalWellBeingTypes.js
src/screens/home/game/MentalWellBeingTypes.js
+115
-0
src/screens/home/game/QuestionsInEnglish.js
src/screens/home/game/QuestionsInEnglish.js
+181
-170
src/screens/home/game/QuestionsInShinhala.js
src/screens/home/game/QuestionsInShinhala.js
+181
-170
src/screens/home/game/QuizOptions.js
src/screens/home/game/QuizOptions.js
+22
-22
src/screens/home/game/QuizScore.js
src/screens/home/game/QuizScore.js
+5
-4
src/screens/home/game/WelcomeGame.js
src/screens/home/game/WelcomeGame.js
+8
-4
src/services/auth/index.js
src/services/auth/index.js
+26
-0
No files found.
src/assets/games/motherAndMidWife.jpg
0 → 100644
View file @
24be488e
111 KB
src/assets/games/wellBeing.jpg
0 → 100644
View file @
24be488e
120 KB
src/assets/user_profile.png
0 → 100644
View file @
24be488e
28.7 KB
src/constants/colors.js
View file @
24be488e
...
...
@@ -21,4 +21,5 @@ export default {
purple_new
:
'
#AC87C5
'
,
pink_new
:
'
#FF8080
'
,
pastal_blue
:
'
#7469B6
'
,
red
:
'
#DC143C
'
,
};
src/constants/imgs.js
View file @
24be488e
...
...
@@ -16,7 +16,6 @@ export default {
sk_15
:
require
(
'
../assets/sk_15.png
'
),
sk_16
:
require
(
'
../assets/sk_16.png
'
),
//games
game_img_1
:
require
(
'
../assets/game_img_1.png
'
),
game_img_2
:
require
(
'
../assets/game_img_2.png
'
),
...
...
@@ -64,4 +63,7 @@ export default {
game_img_44
:
require
(
'
../assets/games/game02Backgroundnew.jpeg
'
),
game_img_45
:
require
(
'
../assets/games/game02Backgroundnew02.jpeg
'
),
home_page
:
require
(
'
../assets/home_page.png
'
),
well_being
:
require
(
'
../assets/games/wellBeing.jpg
'
),
motherWithMidWife
:
require
(
'
../assets/games/motherAndMidWife.jpg
'
),
user_profile_image
:
require
(
'
../assets/user_profile.png
'
),
};
src/constants/routes.js
View file @
24be488e
...
...
@@ -2,7 +2,7 @@ export default {
LOGIN
:
'
Login
'
,
REGISTER
:
'
Register
'
,
FORGOT_PASSWORD
:
'
Forgot_Password
'
,
PROFILE
:
'
UserProfile
'
,
HOME
:
'
Home
'
,
HOME_TAB
:
'
Home_Tab
'
,
...
...
@@ -83,6 +83,6 @@ export default {
Game02ProgressLevel04
:
'
Game02ProgressLevel04
'
,
Game02ProgressLevel05
:
'
Game02ProgressLevel05
'
,
Game02ProgressLevel06
:
'
Game02ProgressLevel06
'
,
MentalWellBeingTypes
:
'
MentalWellBeingTypes
'
,
};
src/navigations/AuthNavigator.js
View file @
24be488e
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
createStackNavigator
}
from
'
@react-navigation/stack
'
;
import
{
createStackNavigator
}
from
'
@react-navigation/stack
'
;
import
Login
from
'
../screens/auth/Login
'
;
import
Register
from
'
../screens/auth/Register
'
;
import
ForgotPassword
from
'
../screens/auth/ForgotPassword
'
;
// import { Login, Register, ForgotPassword} from '../screens';
import
{
ROUTES
}
from
"
../constants
"
import
BottomTabNavigator
from
'
./BottomTabNavigator
'
import
{
ROUTES
}
from
'
../constants
'
;
import
BottomTabNavigator
from
'
./BottomTabNavigator
'
;
const
Stack
=
createStackNavigator
();
import
AsyncStorage
from
'
@react-native-async-storage/async-storage
'
;
import
ProfileNavigator
from
'
./ProfileNavigator
'
;
function
AuthNavigator
()
{
const
[
isLoggedIn
,
setIsLoggedIn
]
=
useState
(
false
);
useEffect
(()
=>
{
...
...
@@ -60,23 +60,31 @@ function AuthNavigator() {
// </Stack.Navigator>
<
Stack
.
Navigator
screenOptions
=
{{
headerBackTitleVisible
:
false
headerBackTitleVisible
:
false
,
}}
initialRouteName
=
{
ROUTES
.
LOGIN
}
>
initialRouteName
=
{
ROUTES
.
LOGIN
}
>
{
isLoggedIn
?
(
<>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
headerShown
:
false
,
}}
name
=
{
ROUTES
.
HOME
}
component
=
{
BottomTabNavigator
}
/
>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
,
}}
name
=
{
ROUTES
.
PROFILE
}
component
=
{
ProfileNavigator
}
/
>
<
/
>
)
:
(
<>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
headerShown
:
false
,
}}
name
=
{
ROUTES
.
LOGIN
}
component
=
{
Login
}
...
...
@@ -84,7 +92,7 @@ function AuthNavigator() {
<
Stack
.
Screen
options
=
{{
headerShown
:
false
,
headerBackTitleVisible
:
false
headerBackTitleVisible
:
false
,
}}
name
=
{
ROUTES
.
REGISTER
}
component
=
{
Register
}
...
...
@@ -95,11 +103,18 @@ function AuthNavigator() {
/
>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
headerShown
:
false
,
}}
name
=
{
ROUTES
.
HOME
}
component
=
{
BottomTabNavigator
}
/
>
<
Stack
.
Screen
options
=
{{
headerShown
:
false
,
}}
name
=
{
ROUTES
.
PROFILE
}
component
=
{
ProfileNavigator
}
/
>
<
/
>
)}
<
/Stack.Navigator
>
...
...
src/navigations/GameNavigator.js
View file @
24be488e
...
...
@@ -41,6 +41,7 @@ import Game02ProgressLevel03 from '../screens/home/game/game02/progress/Level03'
import
Game02ProgressLevel04
from
'
../screens/home/game/game02/progress/Level04
'
;
import
Game02ProgressLevel05
from
'
../screens/home/game/game02/progress/Level05
'
;
import
Game02ProgressLevel06
from
'
../screens/home/game/game02/progress/Level06
'
;
import
MentalWellBeingTypes
from
'
../screens/home/game/MentalWellBeingTypes
'
;
const
Stack
=
createStackNavigator
();
function
GameNavigator
()
{
...
...
@@ -50,7 +51,7 @@ function GameNavigator() {
headerBackTitleVisible
:
false
,
headerShown
:
false
,
}}
initialRouteName
=
{
ROUTES
.
EXERCISE_MAIN_MENU
}
>
initialRouteName
=
{
ROUTES
.
GAME_HOME
}
>
<
Stack
.
Screen
name
=
{
ROUTES
.
GAME_WELCOME
}
component
=
{
WelcomePageGame
}
/
>
<
Stack
.
Screen
name
=
{
ROUTES
.
GAME_QUIZ_OPTIONS
}
...
...
@@ -113,6 +114,10 @@ function GameNavigator() {
name
=
{
ROUTES
.
MainDetailsFormInSinhala
}
component
=
{
MainDetailsFormInSinhala
}
/
>
<
Stack
.
Screen
name
=
{
ROUTES
.
MentalWellBeingTypes
}
component
=
{
MentalWellBeingTypes
}
/
>
<
Stack
.
Screen
name
=
{
ROUTES
.
GameLevelPage
}
component
=
{
GameLevelPage
}
/
>
<
Stack
.
Screen
name
=
{
ROUTES
.
Level01
}
component
=
{
Level01
}
/
>
<
Stack
.
Screen
name
=
{
ROUTES
.
Level02
}
component
=
{
Level02
}
/
>
...
...
src/navigations/ProfileNavigator.js
0 → 100644
View file @
24be488e
import
React
from
'
react
'
;
import
{
createStackNavigator
}
from
'
@react-navigation/stack
'
;
import
{
ROUTES
}
from
'
../constants
'
;
import
UserProfile
from
'
../screens/auth/ProfilePage
'
;
const
Stack
=
createStackNavigator
();
function
ProfileNavigator
()
{
return
(
<
Stack
.
Navigator
screenOptions
=
{{
headerBackTitleVisible
:
false
,
headerShown
:
false
,
}}
initialRouteName
=
{
ROUTES
.
HOME
}
>
<
Stack
.
Screen
name
=
{
ROUTES
.
PROFILE
}
component
=
{
UserProfile
}
/
>
<
/Stack.Navigator
>
);
}
export
default
ProfileNavigator
;
src/screens/auth/ProfilePage.js
0 → 100644
View file @
24be488e
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
StyleSheet
,
View
,
Text
,
Image
,
TouchableOpacity
}
from
'
react-native
'
;
import
Icon
from
'
react-native-vector-icons/Ionicons
'
;
import
{
COLORS
,
IMGS
,
ROUTES
}
from
'
../../constants
'
;
import
LinearGradient
from
'
react-native-linear-gradient
'
;
import
{
Formik
}
from
'
formik
'
;
// import {getUserDetails} from '../../services/auth/index';
const
UserProfile
=
({
navigation
})
=>
{
const
[
userDetails
,
setUserDetails
]
=
useState
(
null
);
const
[
error
,
setError
]
=
useState
(
null
);
// const handleFetchDetails = async () => {
// try {
// const email = 'user@example.com'; // This should be dynamically sourced, perhaps from user state or AsyncStorage
// const details = await getUserDetails(email);
// setUserDetails(details.data);
// } catch (err) {
// setError('Failed to fetch details');
// console.error(err);
// }
// };
console
.
log
(
userDetails
,
'
userDetails
'
);
// useEffect(() => {
// handleFetchDetails();
// }, []);
return
(
<
LinearGradient
style
=
{
styles
.
container
}
colors
=
{[
COLORS
.
dark_purple
,
COLORS
.
white
,
COLORS
.
pink
]}
>
<
View
style
=
{
styles
.
profileHeader
}
>
<
Image
source
=
{
IMGS
.
user_profile_image
}
style
=
{
styles
.
profileImage
}
/
>
<
Text
style
=
{
styles
.
name
}
>
{
userDetails
?.
name
?
userDetails
?.
name
:
'
Malsha Geethmi
'
}
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
infoContainer
}
>
<
View
style
=
{
styles
.
infoItem
}
>
<
Text
style
=
{
styles
.
infoLabel
}
>
Email
<
/Text
>
<
Text
style
=
{
styles
.
infoContent
}
>
{
userDetails
?.
email
?
userDetails
?.
email
:
'
malsha@gmail.com
'
}
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
infoItem
}
>
<
Text
style
=
{
styles
.
infoLabel
}
>
Age
<
/Text
>
<
Text
style
=
{
styles
.
infoContent
}
>
{
userDetails
?.
age
?
userDetails
?.
age
:
'
24
'
}
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
infoItem
}
>
<
Text
style
=
{
styles
.
infoLabel
}
>
Week
<
/Text
>
<
Text
style
=
{
styles
.
infoContent
}
>
{
userDetails
?.
week
?
userDetails
?.
week
:
'
14
'
}
<
/Text
>
<
/View
>
<
/View
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{()
=>
navigation
.
navigate
(
ROUTES
.
FORGOT_PASSWORD
)}
>
<
View
style
=
{
styles
.
new
}
>
<
Icon
name
=
"
key
"
size
=
{
30
}
color
=
{
COLORS
.
white
}
style
=
{
styles
.
icon1
}
/
>
<
Text
style
=
{
styles
.
buttonText
}
>
Change
Password
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
button2
}
>
<
Text
style
=
{
styles
.
buttonText2
}
>
LOGOUT
<
/Text
>
<
/TouchableOpacity
>
<
/LinearGradient
>
);
};
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
backgroundColor
:
COLORS
.
pastalBlue
,
alignItems
:
'
center
'
,
paddingTop
:
50
,
},
profileHeader
:
{
backgroundColor
:
'
white
'
,
width
:
'
90%
'
,
borderRadius
:
20
,
alignItems
:
'
center
'
,
marginBottom
:
20
,
paddingVertical
:
20
,
},
profileImage
:
{
width
:
80
,
height
:
80
,
borderRadius
:
40
,
marginBottom
:
10
,
},
name
:
{
fontSize
:
18
,
fontWeight
:
'
bold
'
,
color
:
COLORS
.
navyBlue
,
},
phoneNumber
:
{
fontSize
:
16
,
color
:
'
gray
'
,
},
infoContainer
:
{
width
:
'
90%
'
,
backgroundColor
:
'
white
'
,
borderRadius
:
20
,
paddingVertical
:
10
,
},
infoItem
:
{
flexDirection
:
'
row
'
,
justifyContent
:
'
space-between
'
,
paddingHorizontal
:
20
,
paddingVertical
:
10
,
},
infoLabel
:
{
fontWeight
:
'
bold
'
,
color
:
'
gray
'
,
},
infoContent
:
{
color
:
'
black
'
,
},
button
:
{
flexDirection
:
'
row
'
,
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
,
backgroundColor
:
COLORS
.
purple_new
,
borderRadius
:
20
,
width
:
'
90%
'
,
padding
:
15
,
marginVertical
:
5
,
marginTop
:
40
,
},
button2
:
{
flexDirection
:
'
row
'
,
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
,
backgroundColor
:
COLORS
.
red
,
borderRadius
:
20
,
width
:
'
90%
'
,
padding
:
15
,
marginVertical
:
5
,
marginTop
:
230
,
},
buttonText
:
{
textAlign
:
'
center
'
,
fontSize
:
18
,
color
:
COLORS
.
white
,
fontWeight
:
'
bold
'
,
},
buttonText2
:
{
textAlign
:
'
center
'
,
fontSize
:
20
,
color
:
COLORS
.
white
,
fontWeight
:
'
bold
'
,
},
icon1
:
{
justifyContent
:
'
flex-start
'
,
display
:
'
flex
'
,
},
new
:
{
marginRight
:
90
,
flexDirection
:
'
row
'
,
gap
:
20
,
},
});
export
default
UserProfile
;
src/screens/home/Home.js
View file @
24be488e
import
React
from
'
react
'
;
import
{
Image
,
TouchableOpacity
,
Text
,
View
}
from
'
react-native
'
;
import
{
COLORS
,
IMGS
}
from
'
../../constants
'
;
import
{
COLORS
,
IMGS
,
ROUTES
}
from
'
../../constants
'
;
import
LinearGradient
from
'
react-native-linear-gradient
'
;
import
Icon
from
'
react-native-vector-icons/Ionicons
'
;
const
Home
=
()
=>
{
const
Home
=
(
{
navigation
}
)
=>
{
return
(
<
LinearGradient
style
=
{{
...
...
@@ -22,7 +23,16 @@ const Home = () => {
}}
/
>
<
/View
>
<
TouchableOpacity
style
=
{{
position
:
'
absolute
'
,
top
:
25
,
// Adjust top and right values as needed
right
:
20
,
zIndex
:
5
,
// Ensure the icon is on top of other elements
}}
onPress
=
{()
=>
navigation
.
navigate
(
ROUTES
.
PROFILE
)}
>
<
Icon
name
=
"
person-circle-sharp
"
size
=
{
35
}
color
=
{
COLORS
.
black
}
/
>
<
/TouchableOpacity
>
<
View
style
=
{{
paddingHorizontal
:
67
,
...
...
@@ -50,31 +60,6 @@ const Home = () => {
}}
>
e
-
MidWife
<
/Text
>
{
/* <View style={{marginTop: 1}}>
<TouchableOpacity
style={{
backgroundColor: COLORS.purple_new,
borderColor: COLORS.purple_new,
height: 50,
marginBottom: 50,
justifyContent: 'center',
alignItems: 'center',
borderRadius: 14,
width: '100%',
zIndex: 3,
elevation: 10,
}}
onPress={() => navigation.navigate(ROUTES.GAME_QUIZ_OPTIONS)}
>
<Text
medium
center
style={{color: 'white', fontSize: 24, fontWeight: 'bold'}}>
Start
</Text>
</TouchableOpacity>
</View> */
}
<
/View
>
<
/View
>
<
/LinearGradient
>
...
...
src/screens/home/game/MainDetailsForm.js
View file @
24be488e
...
...
@@ -17,6 +17,27 @@ const MainDetailsForm = ({navigation}) => {
const
[
age
,
setAge
]
=
useState
(
''
);
const
[
previousChildBirthExperiences
,
setPreviousChildBirthExperiences
]
=
useState
(
''
);
const
[
ageError
,
setAgeError
]
=
useState
(
''
);
const
[
childBirthError
,
setChildBirthError
]
=
useState
(
''
);
const
handleValidation
=
()
=>
{
let
valid
=
true
;
if
(
age
.
trim
()
===
''
)
{
setAgeError
(
'
Age is required
'
);
valid
=
false
;
}
else
{
setAgeError
(
''
);
}
if
(
previousChildBirthExperiences
.
trim
()
===
''
)
{
setChildBirthError
(
'
Number of previous child births is required
'
);
valid
=
false
;
}
else
{
setChildBirthError
(
''
);
}
return
valid
;
};
const
maritalStatusOptions
=
[
{
...
...
@@ -62,9 +83,28 @@ const MainDetailsForm = ({navigation}) => {
setFamilyBackground
(
key
);
};
const
handleNext
=
()
=>
{
if
(
handleValidation
())
{
navigation
.
navigate
(
ROUTES
.
GAME_QUIZ_IN_ENGLISH
,
{
formData
:
{
age
:
age
,
marital_status_divorced
:
maritalStatus
===
'
divorced
'
?
1
:
0
,
marital_status_married
:
maritalStatus
===
'
married
'
?
1
:
0
,
marital_status_single
:
maritalStatus
===
'
single
'
?
1
:
0
,
family_background_bad
:
familyBackground
===
'
bad
'
?
1
:
0
,
family_background_good
:
familyBackground
===
'
good
'
?
1
:
0
,
family_background_normal
:
familyBackground
===
'
normal
'
?
1
:
0
,
previous_child_birth_experiences
:
previousChildBirthExperiences
,
},
});
}
};
return
(
<>
<
ScrollView
style
=
{
styles
.
container
}
>
<
ScrollView
style
=
{
styles
.
scrollContainer
}
contentContainerStyle
=
{
styles
.
contentContainer
}
>
<
LinearGradient
style
=
{{
flex
:
1
,
...
...
@@ -84,7 +124,7 @@ const MainDetailsForm = ({navigation}) => {
color
:
COLORS
.
black
,
fontSize
:
20
,
fontWeight
:
'
bold
'
,
marginTop
:
4
0
,
marginTop
:
2
0
,
marginBottom
:
40
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
...
...
@@ -99,7 +139,7 @@ const MainDetailsForm = ({navigation}) => {
style
=
{{
fontSize
:
15
,
fontWeight
:
'
bold
'
,
marginTop
:
20
,
marginTop
:
1
,
marginBottom
:
20
,
color
:
COLORS
.
black
,
}}
>
...
...
@@ -123,10 +163,16 @@ const MainDetailsForm = ({navigation}) => {
color
:
COLORS
.
black
,
elevation
:
17
,
}}
onChangeText
=
{
text
=>
setAge
(
text
)}
// Use setAge for the age field
onChangeText
=
{
text
=>
{
setAge
(
text
);
if
(
text
.
trim
()
!==
''
)
{
setAgeError
(
''
);
}
}}
keyboardType
=
"
numeric
"
// Set keyboardType appropriately
value
=
{
age
}
/
>
{
!!
ageError
&&
<
Text
style
=
{
styles
.
errorText
}
>
{
ageError
}
<
/Text>
}
<
/View
>
<
View
style
=
{{
marginTop
:
15
}}
>
<
Text
...
...
@@ -165,7 +211,8 @@ const MainDetailsForm = ({navigation}) => {
marginBottom
:
20
,
color
:
COLORS
.
black
,
}}
>
Current
Situation
of
Family
Background
:
Current
Situation
of
Family
Background
(
Financial
/
Economic
/
Partner
'
s Supportness):
</Text>
<View style={styles.radioContainer}>
{familyBackgroundOptions.map(item => (
...
...
@@ -213,41 +260,63 @@ const MainDetailsForm = ({navigation}) => {
elevation: 17,
}}
keyboardType="number-pad"
onChangeText
=
{
text
=>
setPreviousChildBirthExperiences
(
text
)}
// Use setAge for the age field // Set keyboardType appropriately
onChangeText={text => {
setPreviousChildBirthExperiences(text);
if (text.trim() !==
''
) {
setChildBirthError(
''
);
}
}}
value={previousChildBirthExperiences}
/>
{!!childBirthError && (
<Text style={styles.errorText}>{childBirthError}</Text>
)}
</View>
<View style={{marginTop: 15}}>
<Text
semi
style={{
fontSize: 15,
fontWeight:
'
bold
'
,
marginTop: 20,
marginBottom: 20,
color: COLORS.black,
}}>
Experience of Previous Child Birth:
</Text>
<TextInput
style={{
backgroundColor:
'
#
ffffff
'
,
borderRadius: 15,
height: 48,
marginBottom: 10,
marginTop: 10,
shadowColor:
'
#
000
'
,
shadowOffset: {
width: 0,
height: 8,
},
shadowOpacity: 0.46,
shadowRadius: 11.14,
fontSize: 13,
color: COLORS.black,
elevation: 17,
}}
/>
</View>
<View style={{marginTop: 55}}>
<TouchableOpacity
style={{
backgroundColor: COLORS.pastal_blue,
height: 50,
marginBottom
:
2
0
,
marginBottom:
5
0,
justifyContent:
'
center
'
,
alignItems:
'
center
'
,
elevation: 10,
borderRadius: 14,
width:
'
100
%
'
,
}}
onPress
=
{()
=>
navigation
.
navigate
(
ROUTES
.
GAME_QUIZ_IN_ENGLISH
,
{
formData
:
{
age
:
age
,
marital_status_divorced
:
maritalStatus
===
'
divorced
'
?
1
:
0
,
marital_status_married
:
maritalStatus
===
'
married
'
?
1
:
0
,
marital_status_single
:
maritalStatus
===
'
single
'
?
1
:
0
,
family_background_bad
:
familyBackground
===
'
bad
'
?
1
:
0
,
family_background_good
:
familyBackground
===
'
good
'
?
1
:
0
,
family_background_normal
:
familyBackground
===
'
normal
'
?
1
:
0
,
previous_child_birth_experiences
:
previousChildBirthExperiences
,
},
})
}
>
onPress={handleNext}>
<Text
bold
medium
...
...
@@ -269,6 +338,12 @@ const MainDetailsForm = ({navigation}) => {
};
const styles = StyleSheet.create({
scrollContainer: {
flexGrow: 1,
},
contentContainer: {
paddingBottom: 40, // Adds padding at the bottom
},
brandViewText: {
color:
'
#
FFFFFF
'
,
fontSize: 40,
...
...
@@ -278,8 +353,6 @@ const styles = StyleSheet.create({
flex: 1,
height: 860,
backgroundColor: COLORS.purple,
// borderTopStartRadius: 30,
// borderTopEndRadius: 30,
},
radioContainer: {
flexDirection:
'
row
'
,
...
...
@@ -314,6 +387,9 @@ const styles = StyleSheet.create({
container: {
flex: 1,
},
errorText: {
color:
'
red
'
,
},
});
export default MainDetailsForm;
src/screens/home/game/MainDetailsFormInSinhala.js
View file @
24be488e
...
...
@@ -17,6 +17,27 @@ const MainDetailsFormInSinhala = ({navigation}) => {
const
[
age
,
setAge
]
=
useState
(
''
);
const
[
previousChildBirthExperiences
,
setPreviousChildBirthExperiences
]
=
useState
(
''
);
const
[
ageError
,
setAgeError
]
=
useState
(
''
);
const
[
childBirthError
,
setChildBirthError
]
=
useState
(
''
);
const
handleValidation
=
()
=>
{
let
valid
=
true
;
if
(
age
.
trim
()
===
''
)
{
setAgeError
(
'
වයස අනිවාර්ය වේ
'
);
valid
=
false
;
}
else
{
setAgeError
(
''
);
}
if
(
previousChildBirthExperiences
.
trim
()
===
''
)
{
setChildBirthError
(
'
පෙර දරු උපත් සංඛ්යාව අනිවාර්ය වේ.
'
);
valid
=
false
;
}
else
{
setChildBirthError
(
''
);
}
return
valid
;
};
const
maritalStatusOptions
=
[
{
...
...
@@ -62,9 +83,28 @@ const MainDetailsFormInSinhala = ({navigation}) => {
setFamilyBackground
(
key
);
};
const
handleNext
=
()
=>
{
if
(
handleValidation
())
{
navigation
.
navigate
(
ROUTES
.
GAME_QUIZ_IN_SINHALA
,
{
formData
:
{
age
:
age
,
marital_status_divorced
:
maritalStatus
===
'
divorced
'
?
1
:
0
,
marital_status_married
:
maritalStatus
===
'
married
'
?
1
:
0
,
marital_status_single
:
maritalStatus
===
'
single
'
?
1
:
0
,
family_background_bad
:
familyBackground
===
'
bad
'
?
1
:
0
,
family_background_good
:
familyBackground
===
'
good
'
?
1
:
0
,
family_background_normal
:
familyBackground
===
'
normal
'
?
1
:
0
,
previous_child_birth_experiences
:
previousChildBirthExperiences
,
},
});
}
};
return
(
<>
<
ScrollView
style
=
{
styles
.
container
}
>
<
ScrollView
style
=
{
styles
.
scrollContainer
}
contentContainerStyle
=
{
styles
.
contentContainer
}
>
<
LinearGradient
style
=
{{
flex
:
1
,
...
...
@@ -123,11 +163,17 @@ const MainDetailsFormInSinhala = ({navigation}) => {
color
:
COLORS
.
black
,
elevation
:
17
,
}}
onChangeText
=
{
text
=>
setAge
(
text
)}
// Use setAge for the age field
onChangeText
=
{
text
=>
{
setAge
(
text
);
if
(
text
.
trim
()
!==
''
)
{
setAgeError
(
''
);
}
}}
keyboardType
=
"
numeric
"
// Set keyboardType appropriately
value
=
{
age
}
required
/>
{
!!
ageError
&&
<
Text
style
=
{
styles
.
errorText
}
>
{
ageError
}
<
/Text>
}
<
/View
>
<
View
style
=
{{
marginTop
:
15
}}
>
<
Text
...
...
@@ -166,7 +212,8 @@ const MainDetailsFormInSinhala = ({navigation}) => {
marginBottom
:
20
,
color
:
COLORS
.
black
,
}}
>
වත්මන්
පවුල්
පසුබිම්
තත්ත්වය
:
වත්මන්
පවුල්
පසුබිම්
තත්ත්වය
(
මූල්යමය
/
ආර්ථිකමය
/
හවුල්කරුගේ
සහාය
):
<
/Text
>
<
View
style
=
{
styles
.
radioContainer
}
>
{
familyBackgroundOptions
.
map
(
item
=>
(
...
...
@@ -214,41 +261,66 @@ const MainDetailsFormInSinhala = ({navigation}) => {
elevation
:
17
,
}}
keyboardType
=
"
number-pad
"
onChangeText
=
{
text
=>
setPreviousChildBirthExperiences
(
text
)}
// Use setAge for the age field // Set keyboardType appropriately
onChangeText
=
{
text
=>
{
setPreviousChildBirthExperiences
(
text
);
if
(
text
.
trim
()
!==
''
)
{
setChildBirthError
(
''
);
}
}}
value
=
{
previousChildBirthExperiences
}
/
>
{
!!
childBirthError
&&
(
<
Text
style
=
{
styles
.
errorText
}
>
{
childBirthError
}
<
/Text
>
)}
<
/View
>
<
View
style
=
{{
marginTop
:
15
}}
>
<
Text
semi
style
=
{{
fontSize
:
15
,
fontWeight
:
'
bold
'
,
marginTop
:
20
,
marginBottom
:
20
,
color
:
COLORS
.
black
,
}}
>
පෙර
දරු
උපත
පිළිබඳ
අත්දැකීම්
:
<
/Text
>
<
TextInput
style
=
{{
backgroundColor
:
'
#ffffff
'
,
borderRadius
:
15
,
height
:
48
,
marginBottom
:
10
,
marginTop
:
10
,
shadowColor
:
'
#000
'
,
shadowOffset
:
{
width
:
0
,
height
:
8
,
},
shadowOpacity
:
0.46
,
shadowRadius
:
11.14
,
fontSize
:
13
,
color
:
COLORS
.
black
,
elevation
:
17
,
}}
// keyboardType="number-pad"
// onChangeText={text => setPreviousChildBirthExperiences(text)} // Use setAge for the age field // Set keyboardType appropriately
// value={previousChildBirthExperiences}
/
>
<
/View
>
<
View
style
=
{{
marginTop
:
35
}}
>
<
TouchableOpacity
style
=
{{
backgroundColor
:
COLORS
.
pastal_blue
,
height
:
50
,
marginBottom
:
1
0
,
marginBottom
:
5
0
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
elevation
:
10
,
borderRadius
:
14
,
width
:
'
100%
'
,
}}
onPress
=
{()
=>
navigation
.
navigate
(
ROUTES
.
GAME_QUIZ_IN_SINHALA
,
{
formData
:
{
age
:
age
,
marital_status_divorced
:
maritalStatus
===
'
divorced
'
?
1
:
0
,
marital_status_married
:
maritalStatus
===
'
married
'
?
1
:
0
,
marital_status_single
:
maritalStatus
===
'
single
'
?
1
:
0
,
family_background_bad
:
familyBackground
===
'
bad
'
?
1
:
0
,
family_background_good
:
familyBackground
===
'
good
'
?
1
:
0
,
family_background_normal
:
familyBackground
===
'
normal
'
?
1
:
0
,
previous_child_birth_experiences
:
previousChildBirthExperiences
,
},
})
}
>
onPress
=
{
handleNext
}
>
<
Text
bold
medium
...
...
@@ -269,6 +341,12 @@ const MainDetailsFormInSinhala = ({navigation}) => {
};
const
styles
=
StyleSheet
.
create
({
scrollContainer
:
{
flexGrow
:
1
,
},
contentContainer
:
{
paddingBottom
:
40
,
// Adds padding at the bottom
},
brandViewText
:
{
color
:
'
#FFFFFF
'
,
fontSize
:
40
,
...
...
@@ -312,6 +390,9 @@ const styles = StyleSheet.create({
container
:
{
flex
:
1
,
},
errorText
:
{
color
:
'
red
'
,
},
});
export
default
MainDetailsFormInSinhala
;
src/screens/home/game/MentalWellBeingTypes.js
0 → 100644
View file @
24be488e
/* eslint-disable react-native/no-inline-styles */
import
React
from
'
react
'
;
import
{
ImageBackground
,
Text
,
View
,
StyleSheet
,
TouchableOpacity
,
}
from
'
react-native
'
;
import
{
COLORS
,
IMGS
,
ROUTES
}
from
'
../../../constants
'
;
const
MentalWellBeingTypes
=
({
navigation
,
route
})
=>
{
const
{
predictedGameLevel
}
=
route
.
params
;
return
(
<>
<
View
style
=
{
styles
.
bottomView
}
>
<
View
style
=
{{
padding
:
25
}}
>
<
View
style
=
{{
marginTop
:
40
}}
>
<
TouchableOpacity
style
=
{{
backgroundColor
:
'
#260B8C
'
,
height
:
400
,
marginBottom
:
20
,
alignItems
:
'
center
'
,
marginHorizontal
:
10
,
borderRadius
:
24
,
width
:
350
,
}}
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
ImageBackground
source
=
{
IMGS
.
well_being
}
style
=
{
styles
.
backgroundImage
}
resizeMode
=
"
cover
"
><
/ImageBackground
>
<
/View
>
<
View
style
=
{
styles
.
box
}
><
/View
>
<
Text
bold
medium
style
=
{{
color
:
'
black
'
,
fontSize
:
16
,
marginTop
:
-
50
,
// marginLeft: 20,
fontWeight
:
'
bold
'
,
textAlign
:
'
center
'
,
}}
>
Playing
games
can
contribute
to
making
you
happy
,
perhaps
even
without
therapy
.
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{()
=>
{
navigation
.
navigate
(
ROUTES
.
GameLevelPage
,
{
predictedGameLevel
,
});
}}
>
<
Text
bold
medium
center
style
=
{
styles
.
buttonText
}
>
Check
Your
Gaming
Level
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
/
>
);
};
const
styles
=
StyleSheet
.
create
({
brandViewText
:
{
color
:
'
#FFFFFF
'
,
fontSize
:
40
,
},
bottomView
:
{
flex
:
1.5
,
backgroundColor
:
COLORS
.
blue
,
},
backgroundImage
:
{
flex
:
1
,
width
:
350
,
height
:
400
,
borderRadius
:
50
,
},
imageContainer
:
{
borderRadius
:
24
,
overflow
:
'
hidden
'
,
width
:
'
100%
'
,
height
:
'
100%
'
,
},
box
:
{
backgroundColor
:
'
white
'
,
height
:
70
,
marginTop
:
-
38
,
opacity
:
0.5
,
},
button
:
{
backgroundColor
:
COLORS
.
dark
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
borderRadius
:
14
,
width
:
350
,
height
:
50
,
marginTop
:
190
,
},
buttonText
:
{
color
:
'
white
'
,
fontWeight
:
'
bold
'
,
fontSize
:
17
,
},
});
export
default
MentalWellBeingTypes
;
src/screens/home/game/QuestionsInEnglish.js
View file @
24be488e
...
...
@@ -6,6 +6,7 @@ import {
TouchableOpacity
,
Text
,
ActivityIndicator
,
ScrollView
,
}
from
'
react-native
'
;
import
axios
from
'
axios
'
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
...
...
@@ -94,6 +95,9 @@ const QuestionInEnglishPage = ({navigation, route}) => {
<
ActivityIndicator
size
=
{
150
}
color
=
{
COLORS
.
dark_purple
}
/
>
<
/View
>
)
:
(
<
ScrollView
style
=
{
styles
.
scrollContainer
}
contentContainerStyle
=
{
styles
.
contentContainer
}
>
<
LinearGradient
style
=
{{
flex
:
1
,
...
...
@@ -201,7 +205,7 @@ const QuestionInEnglishPage = ({navigation, route}) => {
flexDirection
:
'
row
'
,
justifyContent
:
'
space-between
'
,
marginTop
:
50
,
marginBottom
:
3
0
,
marginBottom
:
10
0
,
}}
>
{
!
isOnFirstQuestions
&&
(
<
TouchableOpacity
...
...
@@ -283,6 +287,7 @@ const QuestionInEnglishPage = ({navigation, route}) => {
)}
<
/View
>
<
/LinearGradient
>
<
/ScrollView
>
)}
<
/
>
);
...
...
@@ -303,4 +308,10 @@ const styles = StyleSheet.create({
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
},
scrollContainer
:
{
flexGrow
:
1
,
},
contentContainer
:
{
paddingBottom
:
40
,
// Adds padding at the bottom
},
});
src/screens/home/game/QuestionsInShinhala.js
View file @
24be488e
...
...
@@ -6,6 +6,7 @@ import {
TouchableOpacity
,
Text
,
ActivityIndicator
,
ScrollView
,
}
from
'
react-native
'
;
import
axios
from
'
axios
'
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
...
...
@@ -91,6 +92,9 @@ const QuestionInSinhalaPage = ({navigation, route}) => {
<
ActivityIndicator
size
=
{
150
}
color
=
{
COLORS
.
dark_purple
}
/
>
<
/View
>
)
:
(
<
ScrollView
style
=
{
styles
.
scrollContainer
}
contentContainerStyle
=
{
styles
.
contentContainer
}
>
<
LinearGradient
style
=
{{
flex
:
1
,
...
...
@@ -198,7 +202,7 @@ const QuestionInSinhalaPage = ({navigation, route}) => {
flexDirection
:
'
row
'
,
justifyContent
:
'
space-between
'
,
marginTop
:
50
,
marginBottom
:
3
0
,
marginBottom
:
10
0
,
}}
>
{
!
isOnFirstQuestions
&&
(
<
TouchableOpacity
...
...
@@ -280,6 +284,7 @@ const QuestionInSinhalaPage = ({navigation, route}) => {
)}
<
/View
>
<
/LinearGradient
>
<
/ScrollView
>
)}
<
/
>
);
...
...
@@ -302,4 +307,10 @@ const styles = StyleSheet.create({
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
},
scrollContainer
:
{
flexGrow
:
1
,
},
contentContainer
:
{
paddingBottom
:
40
,
// Adds padding at the bottom
},
});
src/screens/home/game/QuizOptions.js
View file @
24be488e
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable react/self-closing-comp */
import
React
from
'
react
'
;
import
{
Text
,
Image
,
View
,
StyleSheet
,
TouchableOpacity
}
from
'
react-native
'
;
import
{
COLORS
,
ROUTES
}
from
'
../../../constants
'
;
import
{
Text
,
ImageBackground
,
View
,
StyleSheet
,
TouchableOpacity
,
}
from
'
react-native
'
;
import
{
COLORS
,
ROUTES
,
IMGS
}
from
'
../../../constants
'
;
const
QuizOptionsPage
=
({
navigation
})
=>
{
return
(
...
...
@@ -12,13 +19,10 @@ const QuizOptionsPage = ({navigation}) => {
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
}}
>
<
Image
source
=
{{
uri
:
'
https://www.cdc.gov/reproductivehealth/features/maternal-depression/images/feature-maternal-health-depression-2021.png?_=20351
'
,
}}
style
=
{{
width
:
450
,
height
:
400
}}
resizeMode
=
"
contain
"
/>
<
ImageBackground
source
=
{
IMGS
.
motherWithMidWife
}
style
=
{
styles
.
backgroundImage
}
resizeMode
=
"
cover
"
><
/ImageBackground
>
<
/View
>
<
View
style
=
{
styles
.
bottomView
}
>
<
View
style
=
{{
padding
:
25
}}
>
...
...
@@ -32,7 +36,7 @@ const QuizOptionsPage = ({navigation}) => {
color
:
COLORS
.
navyBlue
,
fontSize
:
22
,
fontWeight
:
'
bold
'
,
marginBottom
:
2
5
,
marginBottom
:
2
0
,
fontFamily
:
'
monospace
'
,
textAlign
:
'
center
'
,
}}
>
...
...
@@ -55,16 +59,6 @@ const QuizOptionsPage = ({navigation}) => {
}}
>
Try
with
Us
&
Have
a
fun
<
/Text
>
<
Text
style
=
{{
color
:
'
black
'
,
fontSize
:
18
,
fontWeight
:
'
bold
'
,
fontFamily
:
'
monospace
'
,
textAlign
:
'
center
'
,
}}
>
Play
Games
&
Enjoy
your
time
<
/Text
>
<
/View
>
<
View
style
=
{{
...
...
@@ -76,7 +70,7 @@ const QuizOptionsPage = ({navigation}) => {
color
:
'
black
'
,
fontSize
:
16
,
fontWeight
:
'
bold
'
,
marginTop
:
3
0
,
marginTop
:
2
0
,
textAlign
:
'
center
'
,
fontFamily
:
'
monospace
'
,
}}
>
...
...
@@ -93,7 +87,7 @@ const QuizOptionsPage = ({navigation}) => {
color
:
'
black
'
,
fontSize
:
16
,
fontWeight
:
'
bold
'
,
marginTop
:
4
0
,
marginTop
:
3
0
,
textAlign
:
'
center
'
,
fontFamily
:
'
monospace
'
,
}}
>
...
...
@@ -160,6 +154,12 @@ const styles = StyleSheet.create({
flex
:
2
,
backgroundColor
:
'
#FFC0D9
'
,
},
backgroundImage
:
{
flex
:
1
,
width
:
350
,
height
:
400
,
borderRadius
:
50
,
},
});
export
default
QuizOptionsPage
;
src/screens/home/game/QuizScore.js
View file @
24be488e
...
...
@@ -64,7 +64,7 @@ const QuizScoreDisplayPage = ({route, navigation}) => {
response
.
data
.
prediction
.
match
(
/
\d
+/
)[
0
],
10
,
);
navigation
.
navigate
(
ROUTES
.
GameLevelPage
,
{
predictedGameLevel
});
navigation
.
navigate
(
ROUTES
.
MentalWellBeingTypes
,
{
predictedGameLevel
});
}
else
{
console
.
error
(
'
API call failed with response:
'
,
response
.
data
);
}
...
...
@@ -85,7 +85,7 @@ const QuizScoreDisplayPage = ({route, navigation}) => {
style
=
{
styles
.
backgroundImage
}
resizeMode
=
"
cover
"
>
<
View
style
=
{
styles
.
container
}
>
<
Text
style
=
{
styles
.
mainText
}
>
Your
Depression
Level
<
/Text
>
<
Text
style
=
{
styles
.
mainText
}
>
Your
Mental
Well
-
Being
<
/Text
>
<
View
style
=
{
styles
.
mainCircle
}
>
<
View
style
=
{
styles
.
circle
}
>
<
Text
style
=
{
styles
.
scoreText
}
>
...
...
@@ -98,7 +98,7 @@ const QuizScoreDisplayPage = ({route, navigation}) => {
style
=
{
styles
.
button
}
onPress
=
{
handleChooseGamePress
}
>
<
Text
bold
medium
center
style
=
{
styles
.
buttonText
}
>
Check
Your
Gaming
Level
How
to
Improve
Mental
Well
-
Being
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
...
...
@@ -155,7 +155,7 @@ const styles = StyleSheet.create({
marginBottom
:
30
,
fontWeight
:
'
bold
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
textAlign
:
'
center
'
,
display
:
'
flex
'
,
marginTop
:
22
,
},
...
...
@@ -173,6 +173,7 @@ const styles = StyleSheet.create({
},
buttonText
:
{
color
:
'
white
'
,
fontWeight
:
'
bold
'
,
fontSize
:
17
,
},
bottomContainer
:
{
...
...
src/screens/home/game/WelcomeGame.js
View file @
24be488e
...
...
@@ -16,7 +16,7 @@ const WelcomePageGame = ({navigation}) => {
<
Image
source
=
{
IMGS
.
game_img_1
}
style
=
{{
height
:
3
6
0
,
height
:
3
4
0
,
width
:
190
,
borderRadius
:
20
,
position
:
'
absolute
'
,
...
...
@@ -35,7 +35,7 @@ const WelcomePageGame = ({navigation}) => {
style
=
{{
paddingHorizontal
:
22
,
position
:
'
absolute
'
,
top
:
41
0
,
top
:
39
0
,
width
:
'
100%
'
,
}}
>
<
Text
...
...
@@ -80,7 +80,7 @@ const WelcomePageGame = ({navigation}) => {
backgroundColor: COLORS.purple_new,
borderColor: COLORS.purple_new,
height: 50,
marginBottom:
5
0,
marginBottom:
7
0,
justifyContent:
'
center
'
,
alignItems:
'
center
'
,
borderRadius: 14,
...
...
@@ -92,7 +92,11 @@ const WelcomePageGame = ({navigation}) => {
<Text
medium
center
style={{color:
'
white
'
, fontSize: 24, fontWeight:
'
bold
'
}}>
style={{
color:
'
white
'
,
fontSize: 24,
fontWeight:
'
bold
'
,
}}>
Let Us Help You
</Text>
</TouchableOpacity>
...
...
src/services/auth/index.js
View file @
24be488e
...
...
@@ -40,3 +40,29 @@ export let signup = async (name, password, email, age, week) => {
return
error
;
}
};
// getUserDetails API Call
// export const getUserDetails = async email => {
// try {
// const token = await AsyncStorage.getItem('userToken'); // Assuming you store token after login
// let response = await axios.get(
// `${BASE_PATH}/user-details?email=${encodeURIComponent(email)}`,
// {
// headers: {
// Authorization: `Bearer ${token}`, // Assuming you use Bearer token for authentication
// },
// },
// );
// console.log('userDetails', response.data);
// if (response.data.success === true) {
// await AsyncStorage.setItem(
// 'userDetails',
// JSON.stringify(response.data.data),
// );
// }
// return response.data;
// } catch (error) {
// console.error('Failed to fetch user details', error);
// throw error; // You might want to handle this differently depending on your error handling strategy
// }
// };
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment