import { Link, useLocation, useNavigate } from 'react-router-dom'; const NavigationTabs = ({ isAdmin, onProtectedNavigate }) => { const location = useLocation(); const navigate = useNavigate(); const tabs = [ { to: '/', label: 'Konfiguration' }, { to: '/store-watch', label: 'Betriebs-Monitoring' } ]; if (isAdmin) { tabs.push({ to: '/admin', label: 'Admin' }); } const handleClick = (event, to) => { event.preventDefault(); if (to === location.pathname) { return; } const label = tabs.find((tab) => tab.to === to)?.label || ''; const proceed = () => navigate(to); if (onProtectedNavigate) { onProtectedNavigate(`zur Seite "${label}" zu wechseln`, proceed); return; } proceed(); }; return ( ); }; export default NavigationTabs;