// frontend/src/components/Layout/Navigation.tsx import React, { useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { useAuth } from '../../contexts/AuthContext'; const Navigation: React.FC = () => { const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const { user, logout, hasRole } = useAuth(); const location = useLocation(); const isActive = (path: string) => location.pathname === path; const navigationItems = [ { path: '/', label: '🏠 Dashboard', icon: '🏠', roles: ['admin', 'instandhalter', 'user'] }, { path: '/shift-plans', label: '📅 Schichtpläne', icon: '📅', roles: ['admin', 'instandhalter', 'user'] }, { path: '/employees', label: '👥 Mitarbeiter', icon: '👥', roles: ['admin', 'instandhalter'] }, { path: '/settings', label: '⚙️ Einstellungen', icon: '⚙️', roles: ['admin'] }, { path: '/help', label: '❓ Hilfe', icon: '❓', roles: ['admin', 'instandhalter', 'user'] }, ]; const filteredNavigation = navigationItems.filter(item => hasRole(item.roles) ); return ( <> {/* Desktop Navigation */} {/* Breadcrumbs */}
{/* Breadcrumb wird dynamisch basierend auf der Route gefüllt */} 🏠 Dashboard {location.pathname !== '/' && '>'} {location.pathname === '/shift-plans' && ' 📅 Schichtpläne'} {location.pathname === '/employees' && ' 👥 Mitarbeiter'} {location.pathname === '/settings' && ' ⚙️ Einstellungen'} {location.pathname === '/help' && ' ❓ Hilfe'}
); }; export default Navigation;