import React, { useState, useEffect, useRef } from 'react'; import { Link } from 'react-router-dom'; const NavBar = () => { const [isOpen, setIsOpen] = useState(false); const dropdownRef = useRef(null); // Close dropdown when clicking outside useEffect(() => { const handleClickOutside = (event) => { if (dropdownRef.current && !dropdownRef.current.contains(event.target)) { setIsOpen(false); } }; document.addEventListener('mousedown', handleClickOutside); return () => { document.removeEventListener('mousedown', handleClickOutside); }; }, []); const toggleMenu = () => { setIsOpen(!isOpen); }; const reportLinks = [ { to: "/rapor-yonetimi/alt-rapor-1", text: "Kasalar" }, { to: "/rapor-yonetimi/alt-rapor-2", text: "Kasa Takviyeleri" }, { to: "/rapor-yonetimi/alt-rapor-3", text: "Hesap Kasa Takviyeleri" }, { to: "/rapor-yonetimi/alt-rapor-4", text: "Hesap Yatırımları" }, { to: "/rapor-yonetimi/alt-rapor-5", text: "Hesap Eklemeleri" } ]; const mainLinks = [ { to: "/", text: "Anasayfa" }, { to: "/yatırım-talepleri", text: "Yatırım Talepleri" }, { to: "/cekim-talepleri", text: "Çekim Talepleri" }, { to: "/hesap-yonetimi", text: "Hesap Yönetimi" }, { to: "/admin-yonetimi", text: "Admin Yönetimi" }, { to: "/yetki-yonetimi", text: "Yetki Yönetimi" }, { to: "/blacklist", text: "Blacklist" }, { to: "/siteler", text: "Refs" } ]; return (