Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Telemedicine_App_Development
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
Shashini Thilakarathne
Telemedicine_App_Development
Commits
293360a7
Commit
293360a7
authored
Mar 16, 2024
by
Shashini Thilakarathne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update DB Connection & Other changes
parent
7486cb3f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
240 deletions
+92
-240
StressPrediction/config.js
StressPrediction/config.js
+9
-9
StressPrediction/src/addData.js
StressPrediction/src/addData.js
+0
-0
StressPrediction/src/index.js
StressPrediction/src/index.js
+0
-73
StressPrediction/src/newJournalEntry.js
StressPrediction/src/newJournalEntry.js
+83
-158
No files found.
StressPrediction/config.js
View file @
293360a7
...
...
@@ -2,15 +2,15 @@ import firebase from 'firebase/compat/app';
import
{
getDatabase
}
from
'
firebase/database
'
;
const
firebaseConfig
=
{
apiKey
:
"
AIzaSyC
Gepr7j41wWYOcq2KgfT2TU9U7ye723Ko
"
,
authDomain
:
"
research
project-ded92
.firebaseapp.com
"
,
databaseURL
:
"
https://research
project-ded92-default-rtdb.asia-southeast1.firebasedatabase.app
"
,
projectId
:
"
research
project-ded92
"
,
storageBucket
:
"
research
project-ded92
.appspot.com
"
,
messagingSenderId
:
"
315494030749
"
,
appId
:
"
1:
315494030749:web:4f25e1e9f44228e2b02374
"
,
measurementId
:
"
G-
52Y793E4LV
"
}
apiKey
:
"
AIzaSyC
r8EgrdjVYrI936R0MY2xTdNvLW9d_IVc
"
,
authDomain
:
"
research
-4aa0d
.firebaseapp.com
"
,
databaseURL
:
"
https://research
-4aa0d-default-rtdb.firebaseio.com
"
,
projectId
:
"
research
-4aa0d
"
,
storageBucket
:
"
research
-4aa0d
.appspot.com
"
,
messagingSenderId
:
"
953444486465
"
,
appId
:
"
1:
953444486465:web:68681174589c1d1c54e5c0
"
,
measurementId
:
"
G-
SDEQKTS8D4
"
}
if
(
firebase
.
apps
.
length
===
0
){
firebase
.
initializeApp
(
firebaseConfig
);
...
...
StressPrediction/src/addData.js
0 → 100644
View file @
293360a7
StressPrediction/src/index.js
deleted
100644 → 0
View file @
7486cb3f
import
{
View
,
Text
,
StyleSheet
,
TextInput
,
Button
,
Image
}
from
'
react-native
'
import
React
,
{
useState
}
from
'
react
'
import
{
db
}
from
'
../config
'
import
{
ref
,
set
}
from
'
firebase/database
'
const
AddData
=
()
=>
{
const
[
title
,
setTitle
]
=
useState
(
''
);
const
[
body
,
setBody
]
=
useState
(
''
);
//function to add data to forebase realtime db
const
dataAddOn
=
()
=>
{
set
(
ref
(
db
,
'
posts/
'
+
title
),{
title
:
title
,
body
:
body
,
});
setTitle
(
''
)
setBody
(
''
)
}
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
style
=
{
styles
.
header
}
>
STRESS
TRACKER
<
/Text
>
<
Image
source
=
{
require
(
'
../images/Home.jpg
'
)}
style
=
{
styles
.
image
}
/
>
<
TextInput
placeholder
=
'
Job Satisfication
'
value
=
{
title
}
onChangeText
=
{(
text
)
=>
setTitle
(
text
)}
style
=
{
styles
.
input
}
/
>
<
TextInput
placeholder
=
'
Body
'
value
=
{
body
}
onChangeText
=
{(
text
)
=>
setBody
(
text
)}
style
=
{
styles
.
input
}
/
>
<
Button
title
=
'
Add Data
'
onPress
=
{
dataAddOn
}
/
>
<
/View
>
)
}
export
default
AddData
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
backgroundColor
:
'
#fff
'
,
},
header
:{
fontSize
:
40
,
textAlign
:
'
center
'
,
marginTop
:
50
,
color
:
'
black
'
,
fontWeight
:
'
bold
'
},
input
:{
borderWidth
:
1
,
borderColor
:
'
black
'
,
margin
:
10
,
padding
:
10
,
fontSize
:
18
,
borderRadius
:
6
,
},
image
:
{
width
:
'
100%
'
,
height
:
200
,
}
});
\ No newline at end of file
StressPrediction/src/newJournalEntry.js
View file @
293360a7
import
React
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
TouchableOpacity
,
Image
}
from
'
react-native
'
;
import
{
View
,
Text
,
StyleSheet
,
TextInput
,
Button
,
Image
}
from
'
react-native
'
import
React
,
{
useState
}
from
'
react
'
import
{
db
}
from
'
../config
'
import
{
ref
,
set
}
from
'
firebase/database
'
const
NewJournalEntry
=
({
onGoBack
})
=>
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
rectangle
}
>
<
Text
style
=
{
styles
.
text
}
>
HELLO
SHASHINI
!
{
'
\n
'
}
WHAT
WOULD
YOU
LIKE
TO
DO
?
<
/Text
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{
onGoBack
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Go
Back
<
/Text
>
<
/TouchableOpacity
>
<
View
style
=
{
styles
.
innerRectangle
}
>
<
Text
style
=
{
styles
.
whiteText
}
>
Journal
Entry
<
/Text
>
<
Image
source
=
{
require
(
'
../images/redCircle.png
'
)}
style
=
{
styles
.
backgroundImage
}
/
>
<
View
style
=
{
styles
.
innerRectangle1
}
>
<
Text
style
=
{
styles
.
whiteText
}
>
View
History
<
/Text
>
const
AddData
=
()
=>
{
const
[
Job_Satisfaction
,
setTitle
]
=
useState
(
''
);
const
[
Sleep_Hours
,
setSleepHours
]
=
useState
(
''
);
const
[
Additional_Text
,
setText
]
=
useState
(
''
);
// function to update data in Firebase Realtime DB
const
updateData
=
()
=>
{
const
jobSatisfactionValue
=
parseInt
(
Job_Satisfaction
);
const
sleepHoursValue
=
parseInt
(
Sleep_Hours
);
if
(
!
isNaN
(
jobSatisfactionValue
)
&&
!
isNaN
(
sleepHoursValue
))
{
const
postData
=
{
Job_Satisfaction
:
jobSatisfactionValue
,
Sleep_Hours
:
sleepHoursValue
,
Text
:
Additional_Text
,
isNew
:
false
};
set
(
ref
(
db
,
'
live_data
'
),
postData
);
}
else
{
console
.
error
(
"
Invalid input for Job Satisfaction or Sleep Hours. Please enter valid numbers.
"
);
}
}
return
(
<
View
style
=
{
styles
.
container
}
>
<
Text
style
=
{
styles
.
header
}
>
STRESS
TRACKER
<
/Text
>
<
Image
source
=
{
require
(
'
../images/historyicon.png
'
)}
style
=
{
styles
.
backgroundImage
}
source
=
{
require
(
'
../images/Home.jpg
'
)}
style
=
{
styles
.
image
}
/
>
<
TextInput
placeholder
=
'
Job Satisfaction
'
value
=
{
Job_Satisfaction
}
onChangeText
=
{(
text
)
=>
setTitle
(
text
)}
style
=
{
styles
.
input
}
keyboardType
=
'
numeric
'
/>
<
TextInput
placeholder
=
'
Sleep hours
'
value
=
{
Sleep_Hours
}
onChangeText
=
{(
text
)
=>
setSleepHours
(
text
)}
style
=
{
styles
.
input
}
keyboardType
=
'
numeric
'
/>
<
TextInput
placeholder
=
'
Additional text
'
value
=
{
Additional_Text
}
onChangeText
=
{(
text
)
=>
setText
(
text
)}
style
=
{
styles
.
input
}
/
>
<
Button
title
=
'
Update Data
'
onPress
=
{
updateData
}
/
>
<
/View
>
<
View
style
=
{
styles
.
innerRectangle2
}
>
<
Text
style
=
{
styles
.
whiteText1
}
>
MOOD
HISTORY
{
'
\n
'
}
<
/Text
>
<
View
style
=
{
styles
.
daysContainer
}
>
<
View
style
=
{
styles
.
dayContainer
}
>
<
Text
style
=
{
styles
.
emoji
}
>
😊
<
/Text
>
<
Text
style
=
{
styles
.
dayText
}
>
Mon
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
dayContainer
}
>
<
Text
style
=
{
styles
.
emoji
}
>
😊
<
/Text
>
<
Text
style
=
{
styles
.
dayText
}
>
Tue
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
dayContainer
}
>
<
Text
style
=
{
styles
.
emoji
}
>
😊
<
/Text
>
<
Text
style
=
{
styles
.
dayText
}
>
Wed
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
dayContainer
}
>
<
Text
style
=
{
styles
.
emoji
}
>
😊
<
/Text
>
<
Text
style
=
{
styles
.
dayText
}
>
Thu
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
dayContainer
}
>
<
Text
style
=
{
styles
.
emoji
}
>
😊
<
/Text
>
<
Text
style
=
{
styles
.
dayText
}
>
Fri
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
dayContainer
}
>
<
Text
style
=
{
styles
.
emoji
}
>
😊
<
/Text
>
<
Text
style
=
{
styles
.
dayText
}
>
Sat
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
dayContainer
}
>
<
Text
style
=
{
styles
.
emoji
}
>
😊
<
/Text
>
<
Text
style
=
{
styles
.
dayText
}
>
Sun
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
);
};
)
}
export
default
AddData
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
},
rectangle
:
{
width
:
320
,
height
:
650
,
justifyContent
:
'
space-between
'
,
alignItems
:
'
center
'
,
borderColor
:
'
black
'
,
borderWidth
:
1
,
borderRadius
:
10
,
padding
:
30
,
backgroundColor
:
'
#FDEDEC
'
,
},
text
:
{
marginLeft
:
-
70
,
},
button
:
{
backgroundColor
:
'
blue
'
,
paddingVertical
:
10
,
paddingHorizontal
:
20
,
borderRadius
:
5
,
alignSelf
:
'
flex-end
'
,
},
buttonText
:
{
color
:
'
white
'
,
fontWeight
:
'
bold
'
,
},
innerRectangle
:
{
width
:
130
,
height
:
100
,
borderColor
:
'
#F1948A
'
,
borderWidth
:
1
,
borderRadius
:
10
,
marginTop
:
-
600
,
top
:
-
410
,
marginLeft
:
-
150
,
backgroundColor
:
'
#F1948A
'
,
},
innerRectangle1
:
{
width
:
130
,
height
:
100
,
borderColor
:
'
#F1948A
'
,
borderWidth
:
1
,
borderRadius
:
10
,
top
:
-
85
,
marginLeft
:
150
,
backgroundColor
:
'
#F1948A
'
,
},
innerRectangle2
:
{
width
:
300
,
height
:
120
,
borderColor
:
'
white
'
,
borderWidth
:
1
,
borderRadius
:
12
,
top
:
-
70
,
marginLeft
:
-
10
,
backgroundColor
:
'
white
'
,
paddingTop
:
10
,
alignItems
:
'
center
'
,
},
whiteText
:
{
color
:
'
white
'
,
textAlign
:
'
center
'
,
fontWeight
:
'
bold
'
,
fontSize
:
18
,
},
whiteText1
:
{
color
:
'
#E74C3C
'
,
fontWeight
:
'
bold
'
,
fontSize
:
15
,
},
backgroundImage
:
{
width
:
60
,
height
:
60
,
marginLeft
:
30
,
},
daysContainer
:
{
flexDirection
:
'
row
'
,
justifyContent
:
'
space-between
'
,
width
:
'
100%
'
,
paddingHorizontal
:
20
,
},
dayContainer
:
{
alignItems
:
'
center
'
,
},
dayText
:
{
fontSize
:
16
,
fontWeight
:
'
bold
'
,
color
:
'
#273746
'
,
},
emoji
:
{
fontSize
:
20
,
},
container
:
{
flex
:
1
,
backgroundColor
:
'
#fff
'
,
},
header
:{
fontSize
:
40
,
textAlign
:
'
center
'
,
marginTop
:
50
,
color
:
'
black
'
,
fontWeight
:
'
bold
'
},
input
:{
borderWidth
:
1
,
borderColor
:
'
black
'
,
margin
:
10
,
padding
:
10
,
fontSize
:
18
,
borderRadius
:
6
,
},
image
:
{
width
:
'
100%
'
,
height
:
200
,
}
});
export
default
NewJournalEntry
;
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