import React, { useState, useEffect } from 'react'; const DirectoryPage = () => { const [organizations, setOrganizations] = useState([]); const [loading, setLoading] = useState(true); const [searchTerm, setSearchTerm] = useState(''); const [sectorFilter, setSectorFilter] = useState('All'); useEffect(() => { // In a real app, this would fetch from an API // For demo purposes, we'll use mock data const mockOrganizations = [ { id: 1, name: 'Global Food Rescue Initiative', sector: 'NGO', country: 'International', description: 'Non-profit organization focused on reducing food waste through redistribution networks.', expertise: ['Food Recovery', 'Logistics', 'Volunteer Management'], projects: 42 }, { id: 2, name: 'AgriTech Solutions Ltd', sector: 'Private', country: 'Netherlands', description: 'Technology company developing smart cold chain solutions for perishable goods.', expertise: ['Cold Chain Technology', 'IoT Sensors', 'Data Analytics'], projects: 18 }, { id: 3, name: 'Sustainable Agriculture Research Institute', sector: 'Academic', country: 'United States', description: 'Research institution studying post-harvest loss reduction techniques.', expertise: ['Research', 'Post-harvest Technology', 'Training'], projects: 27 }, { id: 4, name: 'Ministry of Agriculture and Food Security', sector: 'Government', country: 'Kenya', description: 'Government agency implementing national food loss reduction programs.', expertise: ['Policy Development', 'Program Implementation', 'Farmer Support'], projects: 15 }, { id: 5, name: 'Circular Economy Food Partners', sector: 'NGO', country: 'Germany', description: 'Organization promoting circular economy approaches to food systems.', expertise: ['Circular Economy', 'Composting', 'Waste Valorization'], projects: 33 }, { id: 6, name: 'Farm to Market Logistics Co.', sector: 'Private', country: 'Brazil', description: 'Logistics company specializing in transportation of perishable agricultural products.', expertise: ['Transportation', 'Cold Chain Logistics', 'Supply Chain'], projects: 29 } ]; setTimeout(() => { setOrganizations(mockOrganizations); setLoading(false); }, 500); }, []); const sectors = ['All', ...new Set(organizations.map(org => org.sector))]; const filteredOrganizations = organizations.filter(org => { const matchesSearch = org.name.toLowerCase().includes(searchTerm.toLowerCase()) || org.description.toLowerCase().includes(searchTerm.toLowerCase()) || org.expertise.some(exp => exp.toLowerCase().includes(searchTerm.toLowerCase())); const matchesSector = sectorFilter === 'All' || org.sector === sectorFilter; return matchesSearch && matchesSector; }); if (loading) { return (
{org.description}
No organizations found matching your criteria.