import React, { useState, useEffect } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { FaLeaf, FaBars, FaTimes, FaSearch, FaChartBar, FaDatabase, FaMoon, FaSun } from 'react-icons/fa'; import { useTheme } from '../context/ThemeContext'; import api, { endpoints } from '../config/api'; const Navbar = () => { const [isOpen, setIsOpen] = useState(false); const [logos, setLogos] = useState([]); const location = useLocation(); const { darkMode, toggleDarkMode } = useTheme(); useEffect(() => { const fetchLogos = async () => { try { const response = await api.get(endpoints.mediaByType('Logo')); setLogos(response.data.data || []); } catch (error) { console.error('Error fetching logos:', error); } }; fetchLogos(); }, []); const isActive = (path) => location.pathname === path; const navItems = [ { path: '/', label: 'Dashboard', icon: FaChartBar }, { path: '/plants', label: 'Plants', icon: FaLeaf }, { path: '/surveys', label: 'Surveys', icon: FaDatabase }, { path: '/search', label: 'Search', icon: FaSearch }, { path: '/statistics', label: 'Statistics', icon: FaChartBar }, { path: '/about', label: 'About', icon: FaLeaf }, ]; return ( ); }; export default Navbar;