Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-113
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-113
2023-113
Commits
a4f7f641
Commit
a4f7f641
authored
May 22, 2023
by
di-nethra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
home screen added
parent
117c1cf5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
43 deletions
+140
-43
.DS_Store
.DS_Store
+0
-0
Soil Analyzer and Optimized Crop Finder - IT20233808/.DS_Store
...Analyzer and Optimized Crop Finder - IT20233808/.DS_Store
+0
-0
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/App.js
...Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/App.js
+3
-1
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/assets/homepage.png
...p Finder - IT20233808/RP-MobileAPP-FE/assets/homepage.png
+0
-0
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/components/common/Home.js
...er - IT20233808/RP-MobileAPP-FE/components/common/Home.js
+73
-0
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/components/recomendationComponentsBySoil/ManualSoilData.js
...omponents/recomendationComponentsBySoil/ManualSoilData.js
+1
-1
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/components/recomendationComponentsBySoil/MostSutaibleCrops.js
...onents/recomendationComponentsBySoil/MostSutaibleCrops.js
+21
-30
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/components/recomendationComponentsBySoil/SoilDataOptions.js
...mponents/recomendationComponentsBySoil/SoilDataOptions.js
+42
-11
No files found.
.DS_Store
View file @
a4f7f641
No preview for this file type
Soil Analyzer and Optimized Crop Finder - IT20233808/.DS_Store
View file @
a4f7f641
No preview for this file type
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/App.js
View file @
a4f7f641
...
@@ -5,6 +5,7 @@ import TestWithButton from './components/recomendationComponentsBySoil/TestWithB
...
@@ -5,6 +5,7 @@ import TestWithButton from './components/recomendationComponentsBySoil/TestWithB
import
SoilDataOptions
from
'
./components/recomendationComponentsBySoil/SoilDataOptions
'
;
import
SoilDataOptions
from
'
./components/recomendationComponentsBySoil/SoilDataOptions
'
;
import
ManualSoilData
from
'
./components/recomendationComponentsBySoil/ManualSoilData
'
;
import
ManualSoilData
from
'
./components/recomendationComponentsBySoil/ManualSoilData
'
;
import
MostSutaibleCrops
from
'
./components/recomendationComponentsBySoil/MostSutaibleCrops
'
;
import
MostSutaibleCrops
from
'
./components/recomendationComponentsBySoil/MostSutaibleCrops
'
;
import
HomePage
from
'
./components/common/Home
'
;
...
@@ -13,8 +14,9 @@ export default function App() {
...
@@ -13,8 +14,9 @@ export default function App() {
return
(
return
(
<
NavigationContainer
>
<
NavigationContainer
>
<
Stack
.
Navigator
>
<
Stack
.
Navigator
>
<
Stack
.
Screen
name
=
"
Home
"
component
=
{
HomePage
}
/
>
<
Stack
.
Screen
name
=
"
Soil Data Options
"
component
=
{
SoilDataOptions
}
/
>
<
Stack
.
Screen
name
=
"
Soil Data Options
"
component
=
{
SoilDataOptions
}
/
>
<
Stack
.
Screen
name
=
"
Most Su
tai
ble Crops
"
component
=
{
MostSutaibleCrops
}
/
>
<
Stack
.
Screen
name
=
"
Most Su
ita
ble Crops
"
component
=
{
MostSutaibleCrops
}
/
>
<
Stack
.
Screen
name
=
"
Add Soil Data Manually
"
component
=
{
ManualSoilData
}
/
>
<
Stack
.
Screen
name
=
"
Add Soil Data Manually
"
component
=
{
ManualSoilData
}
/
>
<
Stack
.
Screen
name
=
"
TestWithButton
"
component
=
{
TestWithButton
}
/
>
<
Stack
.
Screen
name
=
"
TestWithButton
"
component
=
{
TestWithButton
}
/
>
<
/Stack.Navigator
>
<
/Stack.Navigator
>
...
...
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/assets/homepage.png
0 → 100644
View file @
a4f7f641
138 KB
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/components/common/Home.js
0 → 100644
View file @
a4f7f641
import
React
from
'
react
'
;
import
{
View
,
Text
,
TouchableOpacity
,
StyleSheet
,
ImageBackground
}
from
'
react-native
'
;
const
HomePage
=
({
navigation
})
=>
{
const
handleOptionSelect
=
(
option
)
=>
{
// Handle navigation to the selected option
if
(
option
===
'
pestDisease
'
)
{
navigation
.
navigate
(
'
PestDiseasePage
'
);
}
else
if
(
option
===
'
soilData
'
)
{
navigation
.
navigate
(
'
Soil Data Options
'
);
}
else
if
(
option
===
'
weatherData
'
)
{
navigation
.
navigate
(
'
Weather Data Options
'
);
}
else
if
(
option
===
'
cropRotationPlan
'
)
{
navigation
.
navigate
(
'
CropRotationPlanPage
'
);
}
};
return
(
<
ImageBackground
source
=
{
require
(
'
../../assets/homepage.png
'
)}
style
=
{
styles
.
backgroundImage
}
>
<
View
style
=
{
styles
.
container
}
>
<
TouchableOpacity
style
=
{
styles
.
optionButton
}
onPress
=
{()
=>
handleOptionSelect
(
'
pestDisease
'
)}
>
<
Text
style
=
{
styles
.
optionText
}
>
Pest
and
Disease
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
optionButton
}
onPress
=
{()
=>
handleOptionSelect
(
'
soilData
'
)}
>
<
Text
style
=
{
styles
.
optionText
}
>
Soil
Data
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
optionButton
}
onPress
=
{()
=>
handleOptionSelect
(
'
weatherData
'
)}
>
<
Text
style
=
{
styles
.
optionText
}
>
Weather
Data
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
optionButton
}
onPress
=
{()
=>
handleOptionSelect
(
'
cropRotationPlan
'
)}
>
<
Text
style
=
{
styles
.
optionText
}
>
Crop
Rotation
Plan
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/ImageBackground
>
);
};
const
styles
=
StyleSheet
.
create
({
backgroundImage
:
{
flex
:
1
,
resizeMode
:
'
cover
'
,
justifyContent
:
'
center
'
,
},
container
:
{
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
paddingHorizontal
:
20
,
},
optionButton
:
{
backgroundColor
:
'
#fff
'
,
borderRadius
:
8
,
paddingVertical
:
20
,
marginBottom
:
20
,
shadowColor
:
'
#000
'
,
shadowOffset
:
{
width
:
0
,
height
:
2
,
},
shadowOpacity
:
0.25
,
shadowRadius
:
3.84
,
elevation
:
5
,
width
:
'
100%
'
,
// Set the width to occupy the entire container
},
optionText
:
{
fontSize
:
20
,
fontWeight
:
'
bold
'
,
color
:
'
#000
'
,
textAlign
:
'
center
'
,
},
});
export
default
HomePage
;
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/components/recomendationComponentsBySoil/ManualSoilData.js
View file @
a4f7f641
...
@@ -18,7 +18,7 @@ const ManualSoilData = ({navigation}) => {
...
@@ -18,7 +18,7 @@ const ManualSoilData = ({navigation}) => {
Potassium
:
parsedPotassiumLevel
Potassium
:
parsedPotassiumLevel
}
}
console
.
log
(
userNpkData
);
console
.
log
(
userNpkData
);
navigation
.
navigate
(
"
Most Su
tai
ble Crops
"
,{
userNpkData
})
navigation
.
navigate
(
"
Most Su
ita
ble Crops
"
,{
userNpkData
})
};
};
return
(
return
(
...
...
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/components/recomendationComponentsBySoil/MostSutaibleCrops.js
View file @
a4f7f641
...
@@ -26,42 +26,31 @@ const cropImages = {
...
@@ -26,42 +26,31 @@ const cropImages = {
const
MostSuitableCrops
=
()
=>
{
const
MostSuitableCrops
=
()
=>
{
const
[
cropData
,
setCropData
]
=
useState
(
null
);
const
[
cropData
,
setCropData
]
=
useState
(
null
);
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
);
const
[
isLoading
,
setIsLoading
]
=
useState
(
true
);
// Set initial loading state to true
const
[
mapObject
,
setMapObject
]
=
useState
({});
const
[
mapObject
,
setMapObject
]
=
useState
({});
const
route
=
useRoute
();
const
route
=
useRoute
();
const
{
userNpkData
}
=
route
.
params
;
const
{
userNpkData
}
=
route
.
params
;
console
.
log
(
"
inside sutaible
"
,
userNpkData
);
// setMapObject(data)
// const { userNpkData } = route.params;
// if(data && Object.keys(data).length === 0){
// const handleArduinoClick = async () => {
// setMapObject(userNpkData)
// await axios.get('http://192.168.89.241')
// }else{
// .then(res => {
// setMapObject(data)
// setCropData(res.data);
// }
// })
// .catch(err => {
// console.log(err);
// });
// };
const
handleArduinoClick
=
async
()
=>
{
useEffect
(()
=>
{
const
timer
=
setTimeout
(()
=>
{
await
axios
.
get
(
'
http://192.168.89.241
'
).
then
(
res
=>
{
setIsLoading
(
false
);
setCropData
(
res
.
data
)
},
3000
);
}).
catch
(
err
=>
{
console
.
log
(
err
);
})
// try {
// const response = await axios.get('http://192.168.89.241');
// const data = response.data;
// setCropData(data);
// console.log(data);
// } catch (error) {
// console.error('Error fetching crop data:', error);
// } finally {
// setIsLoading(false);
// }
};
return
()
=>
clearTimeout
(
timer
);
},
[]);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
fetchCropData
=
async
()
=>
{
const
fetchCropData
=
async
()
=>
{
setIsLoading
(
true
);
try
{
try
{
const
response
=
await
axios
.
post
(
'
http://127.0.0.1:5000/npk-data
'
,
{
const
response
=
await
axios
.
post
(
'
http://127.0.0.1:5000/npk-data
'
,
{
N
:
userNpkData
[
'
Nitrogen
'
],
N
:
userNpkData
[
'
Nitrogen
'
],
...
@@ -78,7 +67,9 @@ const MostSuitableCrops = () => {
...
@@ -78,7 +67,9 @@ const MostSuitableCrops = () => {
};
};
fetchCropData
();
fetchCropData
();
},
[]);
// Empty dependency array to run effect only once on component mount
},
[]);
return
(
return
(
<
ImageBackground
source
=
{
BackgroundImage
}
style
=
{
styles
.
backgroundImage
}
>
<
ImageBackground
source
=
{
BackgroundImage
}
style
=
{
styles
.
backgroundImage
}
>
...
...
Soil Analyzer and Optimized Crop Finder - IT20233808/RP-MobileAPP-FE/components/recomendationComponentsBySoil/SoilDataOptions.js
View file @
a4f7f641
import
{
React
,
useState
}
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
View
,
TouchableOpacity
,
Text
,
StyleSheet
,
Image
}
from
'
react-native
'
;
import
{
View
,
TouchableOpacity
,
Text
,
StyleSheet
,
Image
,
ActivityIndicator
}
from
'
react-native
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
const
SoilDataOptions
=
({
navigation
})
=>
{
const
SoilDataOptions
=
({
navigation
})
=>
{
const
[
cropData
,
setCropData
]
=
useState
(
null
);
const
[
cropData
,
setCropData
]
=
useState
(
null
);
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
);
const
handleArduinoRequest
=
async
()
=>
{
const
handleArduinoRequest
=
async
()
=>
{
console
.
log
(
"
arduino hit
"
);
console
.
log
(
"
arduino hit
"
);
const
response
=
await
axios
.
get
(
'
http://192.168.89.241
'
);
setIsLoading
(
true
);
try
{
const
response
=
await
axios
.
get
(
'
http://192.168.227.241
'
);
const
userNpkData
=
response
.
data
;
const
userNpkData
=
response
.
data
;
setCropData
(
userNpkData
);
setCropData
(
userNpkData
);
console
.
log
(
userNpkData
);
console
.
log
(
userNpkData
);
navigation
.
navigate
(
"
Most Sutaible Crops
"
,{
userNpkData
})
navigation
.
navigate
(
"
Most Suitable Crops
"
,
{
userNpkData
});
}
catch
(
error
)
{
console
.
log
(
error
);
}
finally
{
setIsLoading
(
false
);
}
}
}
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
Image
source
=
{
require
(
'
../../assets/backgroundSoilData.jpg
'
)}
style
=
{
styles
.
backgroundImage
}
/
>
<
Image
source
=
{
require
(
'
../../assets/backgroudManualData.jpg
'
)}
style
=
{
styles
.
backgroundImage
}
/
>
{
isLoading
&&
(
<
View
style
=
{
styles
.
loader
}
>
<
ActivityIndicator
size
=
"
large
"
color
=
"
#3498db
"
/>
<
Text
style
=
{
styles
.
loaderText
}
>
Getting
data
from
your
sensor
.
Please
wait
...
<
/Text
>
<
/View
>
)}
<
View
style
=
{
styles
.
buttonContainer
}
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{()
=>
{
navigation
.
navigate
(
"
Add Soil Data Manually
"
)
}}
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{()
=>
{
navigation
.
navigate
(
"
Add Soil Data Manually
"
)
}}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Add
soil
data
manually
<
/Text
>
<
Text
style
=
{
styles
.
buttonText
}
>
Add
soil
data
manually
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{()
=>
{
handleArduinoRequest
()
}}
>
<
TouchableOpacity
style
=
{
styles
.
button
}
onPress
=
{()
=>
{
handleArduinoRequest
()
}}
>
<
Text
style
=
{
styles
.
buttonText
}
>
Get
soil
data
from
sensor
<
/Text
>
<
Text
style
=
{
styles
.
buttonText
}
>
Get
soil
data
from
sensor
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
...
@@ -43,7 +58,6 @@ const styles = StyleSheet.create({
...
@@ -43,7 +58,6 @@ const styles = StyleSheet.create({
left
:
0
,
left
:
0
,
width
:
'
100%
'
,
width
:
'
100%
'
,
height
:
'
100%
'
,
height
:
'
100%
'
,
opacity
:
0.8
,
},
},
buttonContainer
:
{
buttonContainer
:
{
backgroundColor
:
'
rgba(255, 255, 255, 0.8)
'
,
backgroundColor
:
'
rgba(255, 255, 255, 0.8)
'
,
...
@@ -69,6 +83,23 @@ const styles = StyleSheet.create({
...
@@ -69,6 +83,23 @@ const styles = StyleSheet.create({
fontSize
:
16
,
fontSize
:
16
,
fontWeight
:
'
bold
'
,
fontWeight
:
'
bold
'
,
},
},
loader
:
{
position
:
'
absolute
'
,
top
:
0
,
left
:
0
,
width
:
'
100%
'
,
height
:
'
100%
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
backgroundColor
:
'
rgba(0, 0, 0, 0.9)
'
,
zIndex
:
999
,
},
loaderText
:
{
color
:
'
#fff
'
,
fontSize
:
16
,
marginTop
:
10
,
textAlign
:
'
center
'
,
},
});
});
export
default
SoilDataOptions
;
export
default
SoilDataOptions
;
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