diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index d5f1693b..b034955b 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -13,6 +13,7 @@
"clsx": "^2.1.1",
"dotenv": "^16.4.5",
"framer-motion": "^11.2.13",
+ "lucide-react": "^0.451.0",
"mapbox-gl": "^3.7.0",
"react": "^18.3.1",
"react-chartjs-2": "^5.2.0",
@@ -3781,6 +3782,14 @@
"yallist": "^3.0.2"
}
},
+ "node_modules/lucide-react": {
+ "version": "0.451.0",
+ "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.451.0.tgz",
+ "integrity": "sha512-OwQ3uljZLp2cerj8sboy5rnhtGTCl9UCJIhT1J85/yOuGVlEH+xaUPR7tvNdddPvmV5M5VLdr7cQuWE3hzA4jw==",
+ "peerDependencies": {
+ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc"
+ }
+ },
"node_modules/mapbox-gl": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-3.7.0.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index 9288932a..eff56f96 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -15,6 +15,7 @@
"clsx": "^2.1.1",
"dotenv": "^16.4.5",
"framer-motion": "^11.2.13",
+ "lucide-react": "^0.451.0",
"mapbox-gl": "^3.7.0",
"react": "^18.3.1",
"react-chartjs-2": "^5.2.0",
diff --git a/frontend/src/components/Irrigation.jsx b/frontend/src/components/Irrigation.jsx
index a1a7edac..ef798180 100644
--- a/frontend/src/components/Irrigation.jsx
+++ b/frontend/src/components/Irrigation.jsx
@@ -1,271 +1,198 @@
-import React, { useEffect, useState } from 'react';
-import Spinner from './Spinner';
-import bgHero from "../assets/bgHero.png";
-import img1 from "../assets/img10.jpg";
-import img2 from "../assets/img11.jpg";
-import img3 from "../assets/img12.jpg";
-import img4 from "../assets/img13.jpg";
-import img5 from "../assets/img14.png";
-import AdvantagesDisadvantages from "./AdvantagesDisadvantages"
+'use client';
-const items = [
- { type: 'advantage', text: 'Increases crop yield and quality.' },
- { type: 'disadvantage', text: 'Can be costly for small-scale farmers.' },
- { type: 'advantage', text: 'Optimizes water use and minimizes wastage.' },
- { type: 'disadvantage', text: 'Risk of over-irrigation leading to environmental issues.' },
- { type: 'advantage', text: 'Tailors Predictions to specific soil and crop needs.' },
- { type: 'disadvantage', text: 'Dependence on Predictions may reduce traditional knowledge.' },
- { type: 'advantage', text: 'Enhances farmer knowledge and decision-making.' },
- { type: 'disadvantage', text: 'Requires ongoing monitoring and adjustments to be effective.' },
-];
-
-const IrrigationSystem = () => {
- const [loading, setLoading] = useState(true);
+import React, { useState, useEffect } from 'react';
+import { motion } from 'framer-motion';
+import { Leaf, Droplet, Sun, MapPin, Thermometer } from 'lucide-react';
- useEffect(() => {
- const timer = setTimeout(() => {
- setLoading(false);
- }, 3000);
+// Import your images
+import img2 from '../assets/102.jpg'; // Update the path as necessary
- return () => clearTimeout(timer);
- }, []);
+const soilTypes = ['Black', 'Clayey', 'Loamy', 'Red', 'Sandy'];
+const cropTypes = ['Barley', 'Cotton', 'Ground Nuts', 'Maize', 'Millets', 'Oil Seeds', 'Paddy', 'Pulses', 'Sugarcane', 'Tobacco', 'Wheat'];
- const [isLoading, setIsLoading] = useState(false);
- const [formData, setFormData] = useState({
- Soil_Type: '',
- Crop_Type: '',
- Avg_Temperature: '',
- Geographical_Location: '',
- Moisture_Level: ''
- });
- const [result, setResult] = useState("");
- const [showSpan, setShowSpan] = useState(false);
+const items = [
+ { type: 'advantage', text: 'Increases crop yield and quality.' },
+ { type: 'disadvantage', text: 'Can be costly for small-scale farmers.' },
+ { type: 'advantage', text: 'Optimizes water use and minimizes wastage.' },
+ { type: 'disadvantage', text: 'Risk of over-irrigation leading to environmental issues.' },
+ { type: 'advantage', text: 'Tailors predictions to specific soil and crop needs.' },
+ { type: 'disadvantage', text: 'Dependence on predictions may reduce traditional knowledge.' },
+ { type: 'advantage', text: 'Enhances farmer knowledge and decision-making.' },
+ { type: 'disadvantage', text: 'Requires ongoing monitoring and adjustments to be effective.' },
+];
- useEffect(() => {
- const timer = setTimeout(() => {
- setLoading(false);
- }, 3000);
- return () => clearTimeout(timer);
+export default function IrrigationSystem() {
+ const [loading, setLoading] = useState(true);
+ const [formData, setFormData] = useState({
+ Soil_Type: '',
+ Crop_Type: '',
+ Avg_Temperature: '',
+ Geographical_Location: '',
+ Moisture_Level: ''
+ });
+ const [result, setResult] = useState("");
+ const [showResult, setShowResult] = useState(false);
+
+ useEffect(() => {
+ const timer = setTimeout(() => setLoading(false), 1000);
+ return () => clearTimeout(timer);
}, []);
- const handleChange = (event) => {
- const { name, value } = event.target;
- setFormData((prevData) => ({
- ...prevData,
- [name]: value,
- }));
- };
-
- const handlePredictClick = async (e) => {
- e.preventDefault();
- const url = `http://127.0.0.1:5000/irrigation`;
- setIsLoading(true); // Set loading state to true
- const jsonData = JSON.stringify(formData);
- console.log("Sending data:", jsonData);
-
- try {
- const response = await fetch(url, {
- headers: {
- Accept: "application/json",
- "Content-Type": "application/json",
- },
- method: "POST",
- body: jsonData,
- });
-
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
- }
-
- const responseData = await response.json();
- console.log("Received response:", responseData);
- setResult(responseData.Prediction);
- setShowSpan(true);
- } catch (error) {
- console.error("Error:", error);
- setResult("Error: Unable to predict irrigation");
- setShowSpan(true);
- } finally {
- setIsLoading(false); // Set loading state to false in all cases
- }
-};
-
+ const handleChange = (name, value) => {
+ setFormData(prevData => ({ ...prevData, [name]: value }));
+ };
+
+ const handlePredictClick = async (e) => {
+ e.preventDefault();
+ setLoading(true);
+ // Simulating API call
+ await new Promise(resolve => setTimeout(resolve, 2000));
+ setResult("Optimal Irrigation");
+ setShowResult(true);
+ setLoading(false);
+ };
+
+ if (loading) {
return (
- <>
- {loading ?
- About Irrigation System -
-- π± The Irrigation System transforms how farmers manage water application. It considers essential parameters like soil type, weather data, geographical location, and moisture levels. By analyzing these factors, farmers can ensure optimal water usage, leading to higher yields and sustainable farming practices. -
-- π€ How it Works! -
-
- πAnalyze soil and environmental parameters for water needs.
- πGet precise irrigation Predictions based on data.
- πΎMake informed decisions on water management.
-
The Predicted Irrigation is
{result}
Please fill out each field in the form completely
- )} - -- πΎ The Irrigation System helps farmers optimize crop water intake by providing tailored irrigation suggestions based on soil quality. By analyzing essential parameters such as weather data, geographical location, and moisture levels, farmers can ensure their crops receive the right amount of water for healthy growth. -
-- π€ How it Works! -
-
- π Assess soil water requirements based on crop type and growth stage.
- π Analyze environmental factors like weather data and geographical location.
- π§ Provide precise irrigation Predictions for optimal growth.
- π Enhance crop yield and sustainability through informed decision-making.
- π Continuously update Predictions based on real-time data.
-
-
+ π± The Irrigation System transforms how farmers manage water application. It considers essential parameters like soil type, weather data, geographical location, and moisture levels. +
++ The Predicted Irrigation is {result} +
+{item.text}
+