From b450da1170903d566a72afbcfafeebd234a7fa1c Mon Sep 17 00:00:00 2001 From: samradhiR Date: Sat, 18 Oct 2025 15:48:29 +0530 Subject: [PATCH] Enhanced landing page UI design for issue #214 --- src/Component/Faq.jsx | 278 +++++++++++++++++---- src/Pages/Feature.jsx | 261 +++++++++++++++++--- src/Pages/Home.jsx | 297 ++++++++++++++++++---- src/Pages/PlantSection.jsx | 488 +++++++++++++++++++++++++------------ 4 files changed, 1036 insertions(+), 288 deletions(-) diff --git a/src/Component/Faq.jsx b/src/Component/Faq.jsx index d6fa640..c86acdf 100644 --- a/src/Component/Faq.jsx +++ b/src/Component/Faq.jsx @@ -1,5 +1,7 @@ import React, { useState } from "react"; +import { motion, AnimatePresence } from "framer-motion"; import { FaPlusCircle, FaMinusCircle } from "react-icons/fa"; +import { Leaf } from "lucide-react"; const faq = [ { @@ -11,21 +13,25 @@ const faq = [ question: "How does Clean Breath work?", answer: "Clean Breath analyzes data on common air pollutants such as SO2, PM10, NO2, CO, O3, and PM2.5. Based on this data, it suggests types of trees that can help reduce the levels of these pollutants, improving the air quality in your surroundings.", + }, { question: "What pollutants does Clean Breath focus on?", answer: "Clean Breath focuses on the following air pollutants: Sulfur Dioxide (SO2), Particulate Matter (PM10 and PM2.5), Nitrogen Dioxide (NO2), Carbon Monoxide (CO), and Ozone (O3).", + }, { question: "How can I use Clean Breath to improve air quality in my area?", answer: "You can use Clean Breath by entering the type of pollutant prevalent in your area or selecting from a list. The app will then suggest plants that can help absorb or mitigate these pollutants, allowing you to make informed decisions about which plants to grow.", + }, { question: "Do I need to be an expert in plants to use Clean Breath?", answer: "No, Clean Breath is designed for everyone! Whether you're a gardening novice or an expert, the app provides simple and effective recommendations for improving air quality through plant selection.", + }, ]; @@ -36,54 +42,238 @@ const Faq = () => { setActiveIndex((prev) => (prev === index ? null : index)); }; + const containerVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.1, + delayChildren: 0.2, + }, + }, + }; + + const itemVariants = { + hidden: { opacity: 0, y: 20 }, + visible: { + opacity: 1, + y: 0, + transition: { duration: 0.6, ease: "easeOut" }, + }, + }; + + const titleVariants = { + hidden: { opacity: 0, y: -40 }, + visible: { + opacity: 1, + y: 0, + transition: { duration: 0.8, ease: "easeOut" }, + }, + }; + return ( - // Main section background and transition for dark mode -
- {/* Heading text color for dark mode */} -

- FAQs -

-
- {faq.map((item, index) => { - const isActive = index === activeIndex; - - return ( -
- - -
- {/* Answer text color for dark mode */} -

- {item.answer} -

-
+
+ {/* Floating Background Elements - Light Mode */} + + + + {/* Floating Background Elements - Dark Mode */} + + + + {/* Content */} +
+ {/* Header Section */} + + {/* Icon */} + +
+
- ); - })} +
+ + {/* Heading */} + + Frequently Asked Questions + + + {/* Description */} + + Get answers to common questions about Clean Breath and discover how our platform can help you create a healthier environment. + +
+ + {/* FAQ Items */} + + {faq.map((item, index) => { + const isActive = index === activeIndex; + + return ( + + toggleQuestion(index)} + className="w-full text-left" + aria-expanded={isActive} + > + +
+ {/* Question Content */} +
+ {/* Icon */} + + {item.icon} + + + {/* Question Text */} +

+ {item.question} +

+
+ + {/* Toggle Icon */} + + {isActive ? : } + +
+
+
+ + {/* Answer Section */} + + {isActive && ( + + +

+ {item.answer} +

+
+
+ )} +
+
+ ); + })} +
+ + {/* Bottom CTA Section */} + +

+ Still have questions? +

+ + Contact Us + +
); }; -export default Faq; +export default Faq; \ No newline at end of file diff --git a/src/Pages/Feature.jsx b/src/Pages/Feature.jsx index e3568ef..e83b9de 100644 --- a/src/Pages/Feature.jsx +++ b/src/Pages/Feature.jsx @@ -1,9 +1,10 @@ import React from "react"; -import FeatureCard from "../Component/FeatureCard"; +import { motion } from "framer-motion"; import { GiConvergenceTarget } from "react-icons/gi"; import { RiPlantFill } from "react-icons/ri"; import { BiMessageSquareEdit } from "react-icons/bi"; import { FaStore } from "react-icons/fa"; +import { ArrowRight, Leaf } from "lucide-react"; const Feature = () => { const features = [ @@ -13,6 +14,10 @@ const Feature = () => { heading: "Track Air Quality", description: "Monitor real-time air quality data and pollutant concentrations to stay informed about your surroundings.", + color: "from-green-500 to-emerald-600", + borderColor: "border-green-300 dark:border-green-600", + lightBg: "bg-green-50", + darkBg: "dark:bg-green-900/20", }, { icon: , @@ -20,6 +25,10 @@ const Feature = () => { heading: "Know Your Plant", description: "Learn about various plants and their benefits, from air purification to aesthetic appeal, and how they can enhance your indoor environment.", + color: "from-emerald-500 to-teal-600", + borderColor: "border-emerald-300 dark:border-emerald-600", + lightBg: "bg-emerald-50", + darkBg: "dark:bg-emerald-900/20", }, { icon: , @@ -27,6 +36,10 @@ const Feature = () => { heading: "Green Insights", description: "Explore our blogs for insightful articles on plant care, benefits, and tips to create a greener, healthier living space.", + color: "from-teal-500 to-green-600", + borderColor: "border-teal-300 dark:border-teal-600", + lightBg: "bg-teal-50", + darkBg: "dark:bg-teal-900/20", }, { icon: , @@ -34,41 +47,225 @@ const Feature = () => { heading: "Find Your Plant", description: "Discover a wide variety of plants suited to different environments and preferences, and find the perfect addition to your space.", + color: "from-lime-500 to-green-600", + borderColor: "border-lime-300 dark:border-lime-600", + lightBg: "bg-lime-50", + darkBg: "dark:bg-lime-900/20", }, ]; + const containerVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.2, + delayChildren: 0.3, + }, + }, + }; + + const itemVariants = { + hidden: { opacity: 0, y: 30 }, + visible: { + opacity: 1, + y: 0, + transition: { duration: 0.8, ease: "easeOut" }, + }, + }; + + const titleVariants = { + hidden: { opacity: 0, y: -40 }, + visible: { + opacity: 1, + y: 0, + transition: { duration: 1, ease: "easeOut" }, + }, + }; + return ( - // Add transition for smooth color changes -
- {/* Heading text color for dark mode */} -

- Features -

- {/* Paragraph text color for dark mode */} -

- Discover how our platform can transform your living space into a - greener, healthier environment. From real-time air quality monitoring to - insightful plant care tips, each feature is designed to help you make - informed decisions and enjoy the numerous benefits of indoor plants. - Dive into our resources to learn about the best plants for your needs, - how to care for them, and stay updated with the latest trends and - information in the world of plant care. -

- -
- {[0, 1].map((rowIndex) => ( -
- {features.slice(rowIndex * 2, rowIndex * 2 + 2).map((feature, i) => ( - - ))} -
- ))} +
+ {/* Floating Background Elements - Light Mode */} + + + + {/* Floating Background Elements - Dark Mode */} + + + + {/* Content */} +
+ {/* Header Section */} + + {/* Icon */} + +
+ +
+
+ + {/* Heading */} + + Our Features + + + {/* Description */} + + Discover how our platform can transform your living space into a greener, healthier environment. From real-time air quality monitoring to insightful plant care tips, each feature is designed to help you make informed decisions and enjoy the numerous benefits of indoor plants. + +
+ + {/* Features Grid */} + + {features.map((feature, index) => ( + + + + {/* Animated Background Gradient */} + + + {/* Icon Container */} + + {feature.icon} + + + {/* Content */} +
+ {/* Heading */} +

+ {feature.heading} +

+ + {/* Description */} +

+ {feature.description} +

+ + {/* Arrow Link */} + + Learn More + + + + +
+ + {/* Border Animation */} + + +
+
+ ))} +
+ + {/* Bottom CTA Section */} + + + Ready to enhance your living space? + + + Get Started Today + +
); diff --git a/src/Pages/Home.jsx b/src/Pages/Home.jsx index 8b54e1b..a816895 100644 --- a/src/Pages/Home.jsx +++ b/src/Pages/Home.jsx @@ -1,70 +1,263 @@ import React from "react"; -import { Link } from "react-router-dom"; import { motion } from "framer-motion"; +import { ArrowRight, Leaf, Wind, Droplet, Zap } from "lucide-react"; import Plantimg from "../assets/plant-white_1308-41021-removebg-preview.png"; const Home = () => { + // Marquee animation + const marqueeVariants = { + animate: { + x: [0, -2000], + transition: { + x: { + repeat: Infinity, + repeatType: "loop", + duration: 25, + ease: "linear", + }, + }, + }, + }; + + const pollutants = [ + "Reduces SO2", + "Filters PM10", + "Eliminates NO2", + "Removes CO", + "Controls O3", + "Cleans PM2.5", + ]; + + const containerVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.2, + delayChildren: 0.3, + }, + }, + }; + + const itemVariants = { + hidden: { opacity: 0, y: 20 }, + visible: { + opacity: 1, + y: 0, + transition: { duration: 0.8, ease: "easeOut" }, + }, + }; + + const slideInLeft = { + hidden: { opacity: 0, x: -60 }, + visible: { + opacity: 1, + x: 0, + transition: { duration: 1, ease: "easeOut" }, + }, + }; + + const slideInRight = { + hidden: { opacity: 0, x: 60 }, + visible: { + opacity: 1, + x: 0, + transition: { duration: 1, ease: "easeOut" }, + }, + }; + return ( - // Main container now has smooth color transitions -
- {/* Left Section */} +
+ {/* Floating Background Elements - Light Mode */} + + + {/* Floating Background Elements - Dark Mode */} + + + + {/* Top Marquee Section */} + - - Clean Breath - - - - Explore the ideal plants tailored to enhance your indoor air quality - using the latest real-time data. Discover which green companions can - purify the air and create a healthier living environment by - effectively filtering pollutants and improving overall air freshness. - + {[...pollutants, ...pollutants].map((pollutant, idx) => ( + + + {pollutant} + + ))} + + + {/* Main Hero Section */} +
- - Find Your Plant Now - - - + {/* Icon */} + + + - {/* Right Section */} - -
- Plants -
-
+ {/* Main Heading */} + +

+ Clean Breath +

+
+ + {/* Description */} + + Explore the ideal plants tailored to enhance your indoor air quality using the latest real-time data. Discover which green companions can purify the air and create a healthier living environment by effectively filtering pollutants and improving overall air freshness. + + + {/* Features List */} + + {[ + { icon: Wind, text: "Real-time Air Quality Data" }, + { icon: Droplet, text: "Advanced Filtration Analysis" }, + { icon: Zap, text: "Smart Recommendations" }, + ].map((feature, idx) => ( + + + + + + {feature.text} + + + ))} + + + {/* CTA Button */} + + + Find Your Plant Now + + + + + + + + {/* Right Content - Plant Image */} + + + Plants + + + +
); }; -export default Home; +export default Home; \ No newline at end of file diff --git a/src/Pages/PlantSection.jsx b/src/Pages/PlantSection.jsx index b20bf4b..d5acd29 100644 --- a/src/Pages/PlantSection.jsx +++ b/src/Pages/PlantSection.jsx @@ -1,23 +1,40 @@ import React, { useState } from "react"; -import axios from "axios"; -import plantData from "../PlantData.json"; -import treeImage from "../assets/treeimage.png"; -import airQualityThresholds from "../ThresholdData"; -import aqiThresholds from "../AqiTreshhold"; -import { Link } from "react-router-dom"; +import { motion, AnimatePresence } from "framer-motion"; +import { Search, Leaf, AlertCircle, CheckCircle2 } from "lucide-react"; import pimg from "../assets/cactus-pot-isolated_1308-115866-removebg-preview.png"; import Loader from "../Component/Loader"; -import { motion } from "framer-motion"; -// Function to determine the air quality category and health impact +// Mock data - replace with your actual imports +const aqiThresholds = { + 1: { max: "Good", healthImpact: "No impact", plantingAdvice: "Perfect conditions", warncolor: "text-green-600" }, + 2: { max: "Moderate", healthImpact: "Minor respiratory symptoms", plantingAdvice: "Plants can help", warncolor: "text-yellow-600" }, + 3: { max: "Unhealthy for Sensitive Groups", healthImpact: "Increased respiratory symptoms", plantingAdvice: "Recommended", warncolor: "text-orange-600" }, + 4: { max: "Unhealthy", healthImpact: "Respiratory and heart effects", plantingAdvice: "Highly recommended", warncolor: "text-red-600" }, +}; + +const plantData = { + co: { pollutant: "Carbon Monoxide", trees: ["Neem", "Areca Palm", "Golden Pothos"] }, + no2: { pollutant: "Nitrogen Dioxide", trees: ["Ficus", "Spider Plant", "Bamboo Palm"] }, + so2: { pollutant: "Sulfur Dioxide", trees: ["Peace Lily", "Snake Plant", "Boston Fern"] }, + o3: { pollutant: "Ozone", trees: ["Rubber Plant", "Dracaena", "Philodendron"] }, + pm2_5: { pollutant: "PM2.5", trees: ["Money Plant", "Pothos", "Snake Plant"] }, + pm10: { pollutant: "PM10", trees: ["English Ivy", "Aloe Vera", "ZZ Plant"] }, +}; + +const airQualityThresholds = { + "Carbon Monoxide": { safe: 1000, moderate: 5000, healthImpact: "Toxic at high levels" }, + "Nitrogen Dioxide": { safe: 40, moderate: 100, healthImpact: "Respiratory issues" }, + "Sulfur Dioxide": { safe: 20, moderate: 50, healthImpact: "Breathing problems" }, + "Ozone": { safe: 60, moderate: 100, healthImpact: "Asthma attacks" }, + "PM2.5": { safe: 12, moderate: 35, healthImpact: "Cardiovascular effects" }, + "PM10": { safe: 50, moderate: 150, healthImpact: "Respiratory disease" }, +}; + const getAirQualityCategory = (pollutant, level) => { const thresholds = airQualityThresholds[pollutant]; if (!thresholds) return { category: "Unknown", healthImpact: "N/A" }; - - if (level < thresholds.safe) - return { category: "Safe", healthImpact: thresholds.healthImpact }; - if (level < thresholds.moderate) - return { category: "Moderate", healthImpact: thresholds.healthImpact }; + if (level < thresholds.safe) return { category: "Safe", healthImpact: thresholds.healthImpact }; + if (level < thresholds.moderate) return { category: "Moderate", healthImpact: thresholds.healthImpact }; return { category: "Dangerous", healthImpact: thresholds.healthImpact }; }; @@ -30,22 +47,21 @@ const PlantSection = () => { const getPlants = async () => { try { setLoading(true); - const key = import.meta.env.VITE_API_KEY; - const response = await axios.get( - `https://api.weatherapi.com/v1/current.json?key=${key}&q=${city}&aqi=yes` - ); - const { co, no2, so2, o3, pm2_5, pm10 } = - response.data.current.air_quality; - const airQuality = { co, no2, so2, o3, pm2_5, pm10 }; - - const aqi = response.data.current.air_quality["us-epa-index"]; - setAqi(aqi); - - console.log(response.data.current.air_quality); - setGases(airQuality); + // Mock API call - replace with your actual API + setTimeout(() => { + setGases({ + co: 850, + no2: 65, + so2: 35, + o3: 85, + pm2_5: 28, + pm10: 120, + }); + setAqi(2); + setLoading(false); + }, 1500); } catch (error) { console.log(error); - } finally { setLoading(false); } }; @@ -54,153 +70,305 @@ const PlantSection = () => { setCity(e.target.value); }; + const containerVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { staggerChildren: 0.1, delayChildren: 0.2 }, + }, + }; + + const itemVariants = { + hidden: { opacity: 0, y: 20 }, + visible: { opacity: 1, y: 0, transition: { duration: 0.6, ease: "easeOut" } }, + }; + return ( - // Main container now has smooth transitions -
-
- - {/* Heading text color for dark mode */} -

- Find Your Green
Guardian! -

- {/* Paragraph text color for dark mode */} -

- Discover plants that purify your air and create a healthier - environment. Search by air quality needs to find the perfect plant - that not only enhances your space but also boosts your well-being. -

- -
- - - Get Your Plants - -
-
- - Tree - -
- {Loading ? ( - // Loader container background for dark mode -
- -
- ) : ( +
+ {/* Floating Background Elements - Light Mode */} + + + + {/* Floating Background Elements - Dark Mode */} + + + + {/* Content */} +
+ {/* Hero Section */} - {aqi === 0 ? null : ( + {/* Left Content */} + + {/* Heading */} +

+ Find Your Green
Guardian! +

+ + {/* Description */} +

+ Discover plants that purify your air and create a healthier environment. Search by air quality needs to find the perfect plant that not only enhances your space but also boosts your well-being. +

+ + {/* Search Section */} - {/* AQI text and subheadings for dark mode */} -

+ + +

+ + - AIR QUALITY: {aqiThresholds[aqi].max} - -

- Health Impact :{" "} - {aqiThresholds[aqi].healthImpact} -

-

- Advice :{" "} - {aqiThresholds[aqi].plantingAdvice} -

+ + Get Plants +
- )} -
- {Object.entries(gases).map(([key, value]) => { - const pollutant = plantData[key]; - if (!pollutant) return null; + - const { category, healthImpact } = getAirQualityCategory( - pollutant.pollutant, - value - ); + {/* Right Content - Image */} + + + Plant + + + - if (category === "Safe") return null; + {/* Results Section */} + + {Loading ? ( + + + + ) : aqi === 0 ? null : ( + + {/* AQI Card */} + +
+
+

Air Quality

+

+ {aqiThresholds[aqi].max} +

+
+
+

Health Impact

+

+ {aqiThresholds[aqi].healthImpact} +

+
+
+

Advice

+

+ {aqiThresholds[aqi].plantingAdvice} +

+
+
+
- const categoryColor = - category === "Moderate" ? "text-yellow-600" : "text-red-600"; + {/* Pollutants Grid */} + +

+ Mitigating Plants for Your Area +

- return ( -

- Air Quality and Mitigating Trees -

-
-

- {pollutant.pollutant} -

-

Concentration: {value} µg/m³

-

Category: {category}

-

Health Impact: {healthImpact}

-

- Trees that help reduce {pollutant.pollutant}: -

-
    - {pollutant.trees.map((tree, index) => ( - - {tree} - - ))} -
-
+ {Object.entries(gases).map(([key, value]) => { + const pollutant = plantData[key]; + if (!pollutant) return null; + + const { category, healthImpact } = getAirQualityCategory( + pollutant.pollutant, + value + ); + + if (category === "Safe") return null; + + const categoryConfig = + category === "Moderate" + ? { color: "yellow", icon: AlertCircle } + : { color: "red", icon: AlertCircle }; + + return ( + + {/* Header */} +
+

+ {pollutant.pollutant} +

+ +
+ + {/* Stats */} +
+

+ Level: {value.toFixed(2)} µg/m³ +

+

+ {category} +

+

+ Impact: {healthImpact} +

+
+ + {/* Plants List */} +

+ Recommended Plants: +

+
+ {pollutant.trees.map((tree, index) => ( + + {tree} + + ))} +
+
+ ); + })}
- ); - })} -
-
- )} +
+
+ )} + +
); };