From a1a0d6adc471a4cb02bb4a9f96121bbb00d986d7 Mon Sep 17 00:00:00 2001 From: Karan Date: Sun, 23 Feb 2025 10:47:58 +0530 Subject: [PATCH] Made changes to honepage. --- Frontend/src/App.jsx | 2 +- Frontend/src/components/Navbar2.jsx | 60 ++++++++++------ Frontend/src/pages/Home/Cards.jsx | 54 +++++++++++--- Frontend/src/pages/Home/Hero2.jsx | 71 ++++++++++++++----- Frontend/src/pages/Home/HomePage.jsx | 2 +- Frontend/src/pages/Home/Testimonial.jsx | 48 ++++--------- Frontend/src/pages/Login/SignupPage.jsx | 17 ++--- .../src/pages/UserPanel/MainUserPanel.jsx | 2 + 8 files changed, 157 insertions(+), 99 deletions(-) diff --git a/Frontend/src/App.jsx b/Frontend/src/App.jsx index 464137a..b2f0bab 100644 --- a/Frontend/src/App.jsx +++ b/Frontend/src/App.jsx @@ -38,7 +38,7 @@ function App() { <>
-
+
{ + const user = useSelector((store) => store.user); - const [isLoggedIn, setLoggedIn] = useState(false) - return ( -
-
- ); - }; - - export default Navbar2; - \ No newline at end of file + ); +}; + +export default Navbar2; diff --git a/Frontend/src/pages/Home/Cards.jsx b/Frontend/src/pages/Home/Cards.jsx index 2ea0007..0aaff9f 100644 --- a/Frontend/src/pages/Home/Cards.jsx +++ b/Frontend/src/pages/Home/Cards.jsx @@ -1,18 +1,53 @@ -import React from "react"; +import React, { useState } from "react"; +import { useSelector } from "react-redux"; +import { useEffect } from "react"; + +import { Link } from "react-router-dom"; export const HeroSecn = () => { + const user = useSelector((store) => store.user); + + console.log("User is : ", user); + + const [isLoggedIn, setLoggedIn] = useState(false); + + useEffect(() => { + if (user.name !== "Unloggedin User") { + setLoggedIn(true); + } + }, [user]); + + const handleUserSession = async (event) => { + event.preventDefault(); + const responce = await fetch(`http://localhost:8000/api/v1/me`, { + credentials: "include", + }); + + const user = await responce.json(); + + //console.log("User Login Data is here : ", user); + + dispatch(userSliceActions.addUser(user.data)); + }; return (
-

- Anything and Everything you Need to know About +

+ One stop solution for every farmer's need.

-

- Your crops and their Health! -

+
{ export const CardWithImage = () => { return ( -
+
{ export const CardWithButton = () => { return (
- +
Empowering smallholder farmers with AI tools can bolster global food security diff --git a/Frontend/src/pages/Home/Hero2.jsx b/Frontend/src/pages/Home/Hero2.jsx index 8184f33..cfa4818 100644 --- a/Frontend/src/pages/Home/Hero2.jsx +++ b/Frontend/src/pages/Home/Hero2.jsx @@ -1,7 +1,14 @@ -import React from 'react' +import React from "react"; import { motion } from "framer-motion"; import { useInView } from "react-intersection-observer"; -import { CardOnlyText, CardWithButton, CardWithImage, CardWithOnlyImage, HeroSecn, } from "./Cards"; +import { + CardOnlyText, + CardWithButton, + CardWithImage, + CardWithOnlyImage, + HeroSecn, +} from "./Cards"; +import Testimonial from "./Testimonial"; const ScrollReveal = ({ children, direction = "left" }) => { const { ref, inView } = useInView({ triggerOnce: true, threshold: 0.2 }); @@ -26,33 +33,63 @@ const ScrollReveal = ({ children, direction = "left" }) => { }; function Hero2() { - const myRef = document.querySelector('.scrollable-div') + const myRef = document.querySelector(".scrollable-div"); return (
- + +
- - + - -
- - -
-
- - -
+
+ + {" "} + {" "} + + + {" "} + {" "} + +
+ +
+ + {" "} + {" "} + + + {" "} + {" "} + +
- ) + ); } -export default Hero2 \ No newline at end of file +export default Hero2; diff --git a/Frontend/src/pages/Home/HomePage.jsx b/Frontend/src/pages/Home/HomePage.jsx index b953d63..221278c 100644 --- a/Frontend/src/pages/Home/HomePage.jsx +++ b/Frontend/src/pages/Home/HomePage.jsx @@ -10,7 +10,7 @@ const HomePage = () => { <>
- +
diff --git a/Frontend/src/pages/Home/Testimonial.jsx b/Frontend/src/pages/Home/Testimonial.jsx index 26fcb74..61dcb6a 100644 --- a/Frontend/src/pages/Home/Testimonial.jsx +++ b/Frontend/src/pages/Home/Testimonial.jsx @@ -35,8 +35,8 @@ const Testimonial = () => { return ( <>
-
-
+
+

WHY CHOOSE US? @@ -57,18 +57,14 @@ const Testimonial = () => {

-
+
- + dashboard
Excellent Dashboards @@ -76,7 +72,7 @@ const Testimonial = () => {

Our descriptive dashboards give insights into your crop's - health and keeps track of your burning expenses + health and keeps track of your burning expenses.

{ -
- +
+
{" "} @@ -121,7 +109,7 @@ const Testimonial = () => {

Predict the possible crop diseases based on their shown - symptoms + symptoms.

{
- +
Crop Planner @@ -166,7 +146,7 @@ const Testimonial = () => {

Based on previous season's crop and used pertilizers and pesticides, plan what crops would best suit the present state - of your soil + of your soil.

{ const handleRegisteration = async (event) => { event.preventDefault(); - let userRole; - if (roleElement.current.value == "Student") { - userRole = "user"; - } else { - userRole = "mentor"; - } + const user = { name: firstNameElement.current.value + " " + lastNameElement.current.value, email: emailElement.current.value, password: passwordElement.current.value, - role: userRole, }; event.preventDefault(); @@ -45,7 +39,6 @@ const SignupPage = () => { lastNameElement.current.value = ""; emailElement.current.value = ""; passwordElement.current.value = ""; - roleElement.current.value = ""; if (data.success == true) { navigate("/user/login"); @@ -72,11 +65,9 @@ const SignupPage = () => {

Register Your account

-

- Welcome to Crop Compass. -

+

Welcome to Crop Compass.

- Please register your new account. + Please register your new account.

{ type="email" id="email" ref={emailElement} - className="bg-gray-50 border border-gray-300 text-gray-100 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" + className="bg-gray-50 border border-gray-300 text-black text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="user@mail.com" required /> diff --git a/Frontend/src/pages/UserPanel/MainUserPanel.jsx b/Frontend/src/pages/UserPanel/MainUserPanel.jsx index c88d34d..c1aeabc 100644 --- a/Frontend/src/pages/UserPanel/MainUserPanel.jsx +++ b/Frontend/src/pages/UserPanel/MainUserPanel.jsx @@ -32,6 +32,8 @@ const MainUserPanel = () => { } }; + + const user = useSelector((store) => store.user); return ( <>