import { useEffect, useState } from 'react'; import { NavLink } from 'react-router-dom'; import homeIcon from '../assets/icons/home.svg'; import cacheIcon from '../assets/icons/cache.svg'; import apiIcon from '../assets/icons/api.svg'; import testPlayerIcon from '../assets/icons/testplayer.svg'; import discordIcon from '../assets/icons/discord.svg'; import telegramIcon from '../assets/icons/telegram.svg'; import giteaIcon from '../assets/icons/gitea.svg'; function NavBar() { const [externalLinks, setExternalLinks] = useState({ discord: '#', telegram: '#', gitea: '#', }); useEffect(() => { fetch('/api/links') .then(response => response.json()) .then(data => setExternalLinks(data)) .catch(error => console.error('Error fetching links:', error)); }, []); return (

CDRM-Project

{/* Static routes */} {[{ to: '/', label: 'Home', icon: homeIcon, color: 'sky' }, { to: '/cache', label: 'Cache', icon: cacheIcon, color: 'emerald' }, { to: '/api', label: 'API', icon: apiIcon, color: 'indigo' }, { to: '/testplayer', label: 'Test Player', icon: testPlayerIcon, color: 'rose-700' }].map(({ to, label, icon, color }) => ( `flex flex-row p-3 border-l-3 ${ isActive ? `border-l-${color}-500/50 bg-black/50` : `hover:border-l-${color}-500/50 hover:bg-white/5` }` } >

{label}

))}
{/* External links */}
Discord Telegram Gitea
); } export default NavBar;