import React, { useState, useEffect } from 'react';
import { Clock, Search, AlertTriangle } from 'lucide-react';
import { environmentalKnowledgeBase, environmentalIndicators } from '../utils/environmentalKnowledgeBase';
import realTimeEnvironmentalData from '../utils/realTimeEnvironmentalData';
const Learn = () => {
const [selectedCategory, setSelectedCategory] = useState('all');
const [searchTerm, setSearchTerm] = useState('');
const [selectedTopic, setSelectedTopic] = useState(null);
const [realTimeData, setRealTimeData] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
const fetchRealTimeData = async () => {
try {
const [climateData, carbonData] = await Promise.all([
realTimeEnvironmentalData.getClimateData(40.7128, -74.0060), // NYC coordinates
realTimeEnvironmentalData.getCarbonEmissionsData('US')
]);
setRealTimeData({ climate: climateData, carbon: carbonData });
} catch (error) {
console.error('Failed to fetch real-time data:', error);
} finally {
setLoading(false);
}
};
fetchRealTimeData();
}, []);
const categories = [
{ id: 'all', name: 'All Topics', icon: '📚' },
{ id: 'climate', name: 'Climate Change', icon: '🌡️' },
{ id: 'biodiversity', name: 'Biodiversity', icon: '🦋' },
{ id: 'renewable', name: 'Renewable Energy', icon: '⚡' },
{ id: 'pollution', name: 'Pollution & Waste', icon: '🏭' },
{ id: 'conservation', name: 'Conservation', icon: '🌳' },
{ id: 'technology', name: 'Green Technology', icon: '🔬' },
{ id: 'policy', name: 'Environmental Policy', icon: '📋' },
];
// Generate comprehensive learning topics from our knowledge base
const learningTopics = [
// Advanced Climate Science Topics
{
id: 'climate-tipping-points',
title: 'Climate Tipping Points and Cascading Effects',
category: 'climate',
icon: '🌡️',
description: 'Understanding critical thresholds in Earth\'s climate system that could trigger irreversible changes, including Arctic ice loss, Amazon rainforest dieback, and permafrost thaw.',
level: 'Advanced',
duration: '25 min read',
urgency: 'Critical',
source: 'IPCC AR6 Working Group I Report 2023',
impact: 'Could affect 3.3-3.6 billion people by 2050',
content: `
Climate Tipping Points: The Point of No Return
Critical Insight: Scientists have identified 16 major climate tipping points, with 5 already showing signs of activation as of 2023.
Currently Active Tipping Points:
Arctic Sea Ice Loss: 13% decline per decade since 1979
Greenland Ice Sheet: Losing 280 billion tons annually
West Antarctic Ice Sheet: Irreversible retreat underway
Amazon Rainforest: 17% already lost, approaching 20-25% tipping point
Boreal Forest Shifts: Increased fire frequency and pest outbreaks
Cascading Effects:
When one tipping point is crossed, it can trigger others in a domino effect. For example, Arctic ice loss reduces albedo (reflectivity), causing more warming, which accelerates permafrost thaw, releasing methane and CO2, further accelerating warming.
`,
solutions: [
{
solution: 'Rapid Decarbonization',
description: 'Achieve net-zero emissions by 2050 to limit warming to 1.5°C',
potential: 'Could prevent 3-5 additional tipping points',
timeline: '2024-2050',
cost: '$130 trillion global investment',
benefits: ['Avoided climate damages worth $23 trillion', 'Prevented displacement of 1 billion people']
}
]
},
{
id: 'ocean-acidification-crisis',
title: 'Ocean Acidification: The Other CO2 Problem',
category: 'climate',
icon: '🌊',
description: 'Exploring how increased atmospheric CO2 is making oceans 30% more acidic since pre-industrial times, threatening marine ecosystems and food security for 3 billion people.',
level: 'Intermediate',
duration: '18 min read',
urgency: 'High',
source: 'Nature Climate Change 2023',
impact: 'Threatens $1 trillion marine economy',
content: `
Ocean Acidification: Silent Crisis Beneath the Waves
Alarming Trend: Ocean pH has dropped from 8.2 to 8.1 since 1750 - a 30% increase in acidity.
The Chemistry:
When CO2 dissolves in seawater, it forms carbonic acid, lowering pH and reducing carbonate ions needed for shell and coral formation.
Current rate: 100x faster than any natural change in 20 million years
By 2100: pH could drop to 7.7 (150% more acidic than today)
Carbonate saturation: Declining in 60% of ocean surface
Ecosystem Impacts:
Coral Reefs: 50% already bleached, 99% at risk by 2050
Shellfish: 25% decline in shell formation rates
Fish Behavior: Impaired navigation and predator detection
Food Web: Disruption of phytoplankton (ocean's base)
`
},
{
id: 'carbon-capture-technologies',
title: 'Direct Air Capture and Carbon Removal Technologies',
category: 'technology',
icon: '🔬',
description: 'Comprehensive analysis of emerging carbon removal technologies including DAC, BECCS, enhanced weathering, and blue carbon solutions with current deployment status and scalability potential.',
level: 'Advanced',
duration: '30 min read',
urgency: 'High',
source: 'IEA Carbon Capture Report 2023',
impact: 'Could remove 1-10 Gt CO2/year by 2050',
content: `
Carbon Removal: Engineering Solutions for Climate Crisis
Direct Air Capture (DAC) Technologies:
Solid Sorbent DAC: Uses solid materials to capture CO2 from air
Liquid Solvent DAC: Chemical solutions absorb CO2
Current Capacity: 0.01 Mt CO2/year globally
Target by 2030: 85 Mt CO2/year needed
Cost: $150-600 per ton CO2 (decreasing rapidly)
Current Deployments:
Climeworks (Switzerland): 4,000 tons/year capacity
Carbon Engineering (Canada): 1 Mt/year plant planned
Global Thermostat (USA): Modular systems deployment
Heirloom Carbon (USA): Enhanced mineralization approach
`
},
{
id: 'biodiversity-genomics',
title: 'Environmental DNA and Biodiversity Monitoring',
category: 'biodiversity',
icon: '🧬',
description: 'Revolutionary eDNA techniques allowing scientists to detect species presence from water, soil, and air samples, transforming biodiversity assessment and conservation strategies.',
level: 'Advanced',
duration: '22 min read',
urgency: 'Medium',
source: 'Nature Ecology & Evolution 2023',
impact: 'Could monitor 90% of species vs 20% traditional methods',
content: `
Environmental DNA: Reading Nature's Genetic Fingerprints
What is eDNA? Genetic material shed by organisms into their environment through skin cells, scales, feces, mucus, and other biological materials.
Revolutionary Applications:
Aquatic Monitoring: Detect fish, amphibians, and invertebrates from water samples
Soil Biodiversity: Identify microorganisms, fungi, and soil fauna
Airborne eDNA: Monitor flying insects, pollen, and spores
Invasive Species: Early detection before visual confirmation
Rare Species: Find endangered species without disturbance
Success Stories:
Great Barrier Reef: eDNA detected 30% more fish species than visual surveys
Amazon River: Identified 2,500+ species from single water sample
Urban Biodiversity: NYC parks revealed 3x more species than expected
`
},
{
id: 'renewable-energy-storage',
title: 'Next-Generation Energy Storage Solutions',
category: 'renewable',
icon: '🔋',
description: 'Comprehensive overview of breakthrough energy storage technologies including solid-state batteries, liquid air storage, gravity systems, and green hydrogen production.',
level: 'Intermediate',
duration: '28 min read',
urgency: 'High',
source: 'International Renewable Energy Agency 2023',
impact: 'Could enable 100% renewable grid by 2035',
content: `
Energy Storage: The Key to Renewable Revolution
Breakthrough Technologies:
Solid-State Batteries: 2-10x energy density, 10x longer life
Liquid Air Energy Storage: 200+ MWh capacity, 30+ year lifespan
Gravity Storage: 80-90% efficiency, unlimited cycles
Green Hydrogen: Long-term storage, industrial applications
Compressed Air: Large-scale, low-cost solution
Market Growth:
Global Capacity: 191 GW in 2023, targeting 1,200 GW by 2030
Investment: $120 billion in 2023, $300 billion needed annually
Cost Decline: Battery costs down 85% since 2010
Deployment: China leads with 35 GW, US 8.8 GW
`
},
{
id: 'circular-economy-innovations',
title: 'Circular Economy: Waste to Resource Innovations',
category: 'pollution',
icon: '♻️',
description: 'Exploring cutting-edge circular economy solutions including chemical recycling, bio-based materials, industrial symbiosis, and zero-waste manufacturing processes.',
level: 'Intermediate',
duration: '24 min read',
urgency: 'Medium',
source: 'Ellen MacArthur Foundation 2023',
impact: 'Could reduce waste by 80% and create $4.5 trillion value',
content: `
Circular Economy: Redesigning Our Relationship with Resources
Core Principles:
Design Out Waste: Products designed for disassembly and reuse
Keep Products in Use: Sharing, repair, refurbishment models
Regenerate Natural Systems: Return nutrients to biosphere
Breakthrough Innovations:
Chemical Recycling: Break plastics to molecular level for infinite recycling
Mycelium Materials: Mushroom-based leather and packaging
Algae Bioplastics: Marine-degradable alternatives
Industrial Symbiosis: Waste from one industry feeds another
Digital Product Passports: Track materials through lifecycle
Economic Benefits:
Material Savings: $1 trillion annually by 2025
Job Creation: 6 million new jobs in Europe alone
Reduced Emissions: 39% reduction in manufacturing emissions
`
},
{
id: 'nature-based-solutions',
title: 'Nature-Based Solutions for Climate Adaptation',
category: 'conservation',
icon: '🌿',
description: 'Comprehensive guide to ecosystem-based approaches for climate resilience including urban forests, wetland restoration, regenerative agriculture, and coastal protection.',
level: 'Intermediate',
duration: '26 min read',
urgency: 'High',
source: 'UNEP Nature-Based Solutions Report 2023',
impact: 'Could provide 37% of climate mitigation needed',
content: `
Nature-Based Solutions: Working with Ecosystems for Climate Resilience
Key Solution Types:
Forest Restoration: 2 billion hectares available globally
Wetland Conservation: 3x more effective than forests for carbon storage
Regenerative Agriculture: Soil carbon sequestration potential
Urban Green Infrastructure: Reduce city temperatures by 2-8°C
Coastal Ecosystems: Mangroves, seagrass, salt marshes protection
Global Implementation Examples:
China's Sponge Cities: 30 cities using natural water management
Netherlands Room for River: Flood management through ecosystem restoration
Costa Rica PES: Payment for ecosystem services program
New York Watershed: $1.5 billion saved through natural filtration
`
},
{
id: 'environmental-justice',
title: 'Environmental Justice and Climate Equity',
category: 'policy',
icon: '⚖️',
description: 'Understanding how environmental impacts disproportionately affect marginalized communities and exploring policy solutions for equitable climate action and environmental protection.',
level: 'Advanced',
duration: '32 min read',
urgency: 'Critical',
source: 'EPA Environmental Justice Report 2023',
impact: 'Affects 40% of US population in disadvantaged communities',
content: `
Environmental Justice: Ensuring Equitable Environmental Protection
Key Principles:
Distributive Justice: Fair distribution of environmental benefits and burdens
Procedural Justice: Meaningful participation in environmental decisions
Recognition Justice: Acknowledging diverse values and ways of life
Corrective Justice: Addressing historical environmental harms
Disproportionate Environmental Impacts:
Air Pollution: Communities of color face 40% higher exposure
Climate Change: Low-income areas 5x more vulnerable to extreme heat
Toxic Facilities: 56% of residents near hazardous sites are people of color
Water Quality: 2 million Americans lack access to safe drinking water
Policy Solutions:
Justice40 Initiative: 40% of climate investments to disadvantaged communities
Community-Led Monitoring: Resident-driven environmental data collection
Green Jobs Training: Workforce development in environmental sectors
Cumulative Impact Assessment: Consider multiple environmental stressors
`
},
// Original topics from knowledge base
...environmentalKnowledgeBase.climateChange.keyFacts.map((fact, index) => ({
id: `climate-${index}`,
title: fact.title,
category: 'climate',
icon: '🌡️',
description: fact.fact,
level: fact.urgency === 'Critical' ? 'Advanced' : 'Intermediate',
duration: '15 min read',
urgency: fact.urgency,
source: fact.source,
impact: fact.impact,
content: `
${fact.title}
Key Fact: ${fact.fact}
Impact: ${fact.impact}
Source: ${fact.source}
Urgency Level: ${fact.urgency}
`,
realTimeData: realTimeData?.climate,
solutions: environmentalKnowledgeBase.climateChange.solutions
})),
// Biodiversity Topics
...environmentalKnowledgeBase.biodiversity.keyFacts.map((fact, index) => ({
id: `biodiversity-${index}`,
title: fact.title,
category: 'biodiversity',
icon: '🦋',
description: fact.fact,
level: fact.urgency === 'Critical' ? 'Advanced' : 'Intermediate',
duration: '12 min read',
urgency: fact.urgency,
source: fact.source,
impact: fact.impact,
content: `
${fact.title}
Key Fact: ${fact.fact}
Impact: ${fact.impact}
Source: ${fact.source}
Urgency Level: ${fact.urgency}
`,
solutions: environmentalKnowledgeBase.biodiversity.solutions
})),
// Pollution Topics
...environmentalKnowledgeBase.pollution.keyFacts.map((fact, index) => ({
id: `pollution-${index}`,
title: fact.title,
category: 'pollution',
icon: '🏭',
description: fact.fact,
level: fact.urgency === 'Critical' ? 'Advanced' : 'Intermediate',
duration: '10 min read',
urgency: fact.urgency,
source: fact.source,
impact: fact.impact,
content: `
${fact.title}
Key Fact: ${fact.fact}
Impact: ${fact.impact}
Source: ${fact.source}
Urgency Level: ${fact.urgency}
`,
solutions: environmentalKnowledgeBase.pollution.solutions
})),
// Technology Topics
...environmentalKnowledgeBase.technologies.renewable.map((tech, index) => ({
id: `tech-renewable-${index}`,
title: tech.name,
category: 'technology',
icon: '⚡',
description: tech.description,
level: 'Intermediate',
duration: '18 min read',
efficiency: tech.efficiency,
cost: tech.cost,
growth: tech.growth,
potential: tech.potential,
challenges: tech.challenges,
content: `
${tech.name}
${tech.description}
Efficiency: ${tech.efficiency}
Cost: ${tech.cost}
Growth: ${tech.growth}
Potential: ${tech.potential}
Challenges:
${tech.challenges.map(challenge => `${challenge} `).join('')}
`
})),
// Policy Topics
...environmentalKnowledgeBase.policies.international.map((policy, index) => ({
id: `policy-${index}`,
title: policy.name,
category: 'policy',
icon: '📋',
description: `${policy.goal} - ${policy.participants}`,
level: 'Advanced',
duration: '20 min read',
year: policy.year,
participants: policy.participants,
goal: policy.goal,
status: policy.status,
progress: policy.progress,
nextSteps: policy.nextSteps,
content: `
${policy.name} (${policy.year})
Participants: ${policy.participants}
Goal: ${policy.goal}
Status: ${policy.status}
Current Progress: ${policy.progress}
Next Steps:
${policy.nextSteps.map(step => `${step} `).join('')}
`
})),
// Success Stories
...environmentalKnowledgeBase.successStories.map((story, index) => ({
id: `success-${index}`,
title: story.title,
category: 'conservation',
icon: '🌳',
description: story.description,
level: 'Beginner',
duration: '8 min read',
location: story.location,
results: story.results,
lessons: story.lessons,
content: `
${story.title}
📍 ${story.location}
${story.description}
Results Achieved:
${Object.entries(story.results).map(([key, value]) => `${key}: ${value} `).join('')}
Key Lessons:
${story.lessons.map(lesson => `${lesson} `).join('')}
`
}))
];
const filteredTopics = learningTopics.filter(topic => {
const matchesCategory = selectedCategory === 'all' || topic.category === selectedCategory;
const matchesSearch = topic.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
topic.description.toLowerCase().includes(searchTerm.toLowerCase());
return matchesCategory && matchesSearch;
});
const getLevelColor = (level) => {
switch (level) {
case 'Beginner': return '#4CAF50';
case 'Intermediate': return '#FF9800';
case 'Advanced': return '#f44336';
default: return '#666';
}
};
const getUrgencyColor = (urgency) => {
switch (urgency) {
case 'Critical': return '#f44336';
case 'High': return '#FF9800';
case 'Medium': return '#FFC107';
default: return '#4CAF50';
}
};
if (selectedTopic) {
return (
setSelectedTopic(null)}
className="btn btn-secondary"
style={{ marginBottom: '20px' }}
>
← Back to Learning Hub
{selectedTopic.icon}
{selectedTopic.title}
{selectedTopic.level}
{selectedTopic.duration}
{selectedTopic.urgency && (
{selectedTopic.urgency} Priority
)}
{/* Real-time Data Integration */}
{selectedTopic.realTimeData && (
📡 Real-Time Environmental Data
{selectedTopic.realTimeData.current?.temperature}°C
Current Temperature
{selectedTopic.realTimeData.current?.humidity}%
Humidity
{selectedTopic.realTimeData.climateIndicators?.temperatureTrend}
Temperature Trend
)}
{/* Topic Content */}
{/* Solutions Section */}
{selectedTopic.solutions && (
💡 Solutions & Actions
{selectedTopic.solutions.map((solution, index) => (
{solution.solution}
{solution.description}
Potential: {solution.potential}
Timeline: {solution.timeline}
Investment: {solution.cost}
Benefits: {solution.benefits?.join(', ')}
))}
)}
{/* Additional Information */}
{selectedTopic.source && (
📚 Source & Further Reading
Primary Source: {selectedTopic.source}
{selectedTopic.impact &&
Global Impact: {selectedTopic.impact}
}
)}
);
}
return (
{/* Header */}
📚 GreenPlus by GXS Learning Hub
Master environmental science with real-time data and expert insights
🎓 Science-Based • 📡 Real-Time Data • 🌍 Global Impact
{/* Real-Time Environmental Indicators */}
{!loading && realTimeData && (
📡 Live Environmental Indicators
{environmentalIndicators.climate.globalTemperature.current}°C
Global Temperature Rise
{environmentalIndicators.climate.globalTemperature.trend}
{environmentalIndicators.climate.co2Concentration.current}
CO₂ Concentration (ppm)
{environmentalIndicators.climate.co2Concentration.trend}
{realTimeData.carbon?.carbonIntensity || 'N/A'}
Carbon Intensity
gCO₂/kWh
{realTimeData.carbon?.renewablePercentage || 'N/A'}%
Renewable Energy
Current Mix
)}
{/* Search and Filter */}
{/* Category Filter */}
{categories.map(category => (
setSelectedCategory(category.id)}
style={{
padding: '10px 20px',
borderRadius: '25px',
border: 'none',
background: selectedCategory === category.id ? '#2E7D32' : '#f0f0f0',
color: selectedCategory === category.id ? 'white' : '#666',
cursor: 'pointer',
fontSize: '0.9rem',
fontWeight: selectedCategory === category.id ? 'bold' : 'normal',
transition: 'all 0.3s ease',
display: 'flex',
alignItems: 'center',
gap: '8px'
}}
>
{category.icon}
{category.name}
))}
{/* Topics Grid */}
{filteredTopics.map(topic => (
setSelectedTopic(topic)}
onMouseEnter={(e) => e.currentTarget.style.transform = 'translateY(-5px)'}
onMouseLeave={(e) => e.currentTarget.style.transform = 'translateY(0)'}
>
{/* Header Section - Fixed Height */}
{topic.icon}
{topic.title}
{topic.level}
{topic.duration}
{topic.urgency && (
{topic.urgency}
)}
{/* Description Section - Fixed Height */}
{/* Spacer to push footer to bottom */}
{/* Footer Section - Always at bottom */}
📖 Start Learning
{topic.source && (
📚 {topic.source.split(' ')[0]}
)}
))}
{/* Learning Progress Stats */}
📊 Global Environmental Learning Impact
{filteredTopics.length}
Available Topics
{/* Research Partnerships */}
🔬 Research Partnerships & Data Sources
🌍
Climate Science
• IPCC AR6 Reports
• NASA Climate Data
• NOAA Global Monitoring
• Met Office Hadley Centre
🧬
Biodiversity Research
• IUCN Red List
• Global Biodiversity Facility
• Living Planet Index
• Convention on Biological Diversity
⚡
Energy Technology
• International Energy Agency
• IRENA Global Data
• BloombergNEF
• MIT Energy Initiative
{/* Latest Environmental Breakthroughs */}
🚀 Latest Environmental Breakthroughs (2023-2024)
🔬 Scientific Discoveries
Fusion Energy Milestone: National Ignition Facility achieved net energy gain (Dec 2022)
Carbon Capture Breakthrough: New MOF materials capture 90% more CO2
Ocean Cleanup Success: System 002 removed 100,000 kg of plastic from Pacific
Renewable Record: Solar efficiency reached 47.1% in lab conditions
Battery Innovation: Solid-state batteries achieve 1000+ cycle life
📈 Market Developments
Green Hydrogen Scale-up: Production costs dropped 50% in 2023
EV Adoption: 14% of global car sales now electric
Carbon Markets: Voluntary carbon credits reached $2B market
Renewable Investment: $1.8T invested globally in 2023
Climate Tech Funding: $70B raised by climate startups
{/* Featured Success Stories */}
🌟 Environmental Success Stories
{environmentalKnowledgeBase.successStories.slice(0, 3).map((story, index) => (
🏆
{story.title}
📍 {story.location}
{/* Spacer to push achievement to bottom */}
Key Achievement: {Object.values(story.results)[0]}
))}
);
};
export default Learn;