Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TMP-23-068
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
TMP-23-068
TMP-23-068
Commits
1b265668
Commit
1b265668
authored
Oct 31, 2023
by
Yasara19
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modification
parent
65faf5e0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
screens/Nutrition.js
screens/Nutrition.js
+1
-1
screens/Plan.js
screens/Plan.js
+28
-6
No files found.
screens/Nutrition.js
View file @
1b265668
...
...
@@ -105,7 +105,7 @@ export default function Nutrition({ route }) {
const
outputValue
=
response
.
data
.
prediction
;
const
customText
=
outputTexts
[
outputValue
]
||
'
Default Text for Other Outputs
'
;
// Format the meal plan text with line breaks
const
formattedMealPlan
=
customText
.
replace
(
/;/g
,
'
\n
'
);
const
formattedMealPlan
=
customText
.
replace
(
/;/g
,
'
\n
\n
'
);
setOtherModelResult
(
formattedMealPlan
);
// setOtherModelResult(customText);
console
.
log
(
response
.
data
.
prediction
);
...
...
screens/Plan.js
View file @
1b265668
...
...
@@ -2,10 +2,25 @@ import React, { useEffect } from 'react';
import
{
View
,
Text
,
TouchableOpacity
,
StyleSheet
,
ImageBackground
,
ScrollView
}
from
'
react-native
'
;
import
{
useNavigation
}
from
'
@react-navigation/native
'
;
import
{
firestore
,
firebase
}
from
'
../config
'
;
// Make sure to import 'firestore' and 'firebase' correctly.
import
AsyncStorage
from
'
@react-native-async-storage/async-storage
'
;
export
default
function
Plan
({
route
})
{
const
{
nutritionPlan
}
=
route
.
params
;
const
navigation
=
useNavigation
();
const
[
email
,
setEmail
]
=
useState
(
''
);
useEffect
(()
=>
{
// Retrieve the email from local storage
AsyncStorage
.
getItem
(
'
userEmail
'
)
.
then
(
result
=>
{
if
(
result
)
{
setEmail
(
result
);
}
})
.
catch
(
error
=>
{
console
.
error
(
'
Error retrieving email from local storage:
'
,
error
);
});
},
[]);
useEffect
(()
=>
{
...
...
@@ -16,7 +31,9 @@ export default function Plan({ route }) {
const
savePlanToDatabase
=
(
nutritionPlan
)
=>
{
const
data
=
{
nutritionPlan
:
parseFloat
(
nutritionPlan
),
email
:
email
,
nutritionPlan
:
nutritionPlan
,
};
// Assuming you have a 'nutritionPlans' collection in your database
...
...
@@ -32,8 +49,10 @@ export default function Plan({ route }) {
<
ImageBackground
source
=
{
require
(
"
../assets/plan1.png
"
)}
resizeMode
=
"
cover
"
style
=
{
styles
.
image
}
>
<
View
style
=
{
styles
.
overlay
}
>
<
View
>
<
Text
style
=
{
styles
.
nutritionPlan
}
>
{
nutritionPlan
}
<
/Text
>
<
/View
>
{
/* Save Plan Button */
}
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{
savePlanToDatabase
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Save
Plan
<
/Text
>
...
...
@@ -48,11 +67,11 @@ export default function Plan({ route }) {
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
flex
:
1
,
justifyContent
:
'
center
'
,
// Center vertically
alignItems
:
'
center
'
,
// Center horizontally
},
scrollViewContent
:
{
minHeight
:
'
120%
'
,
// Set a minimum height to enable scrolling
},
...
...
@@ -73,10 +92,13 @@ const styles = StyleSheet.create({
fontWeight
:
'
bold
'
,
marginTop
:
16
,
},
nutritionPlan
:
{
fontSize
:
16
,
marginTop
:
8
,
textAlign
:
'
center
'
,
// Center the text within the container
},
button
:
{
backgroundColor
:
'
transparent
'
,
borderWidth
:
2
,
...
...
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