This commit is contained in:
Matthias Hochmeister
2026-03-26 09:29:59 +01:00
parent 884397b520
commit d5e5f2d44e
10 changed files with 428 additions and 154 deletions

View File

@@ -8,7 +8,6 @@ import {
ListItemIcon,
Divider,
Box,
Tooltip,
Menu,
MenuItem,
} from '@mui/material';
@@ -18,12 +17,12 @@ import {
Settings,
Logout,
Menu as MenuIcon,
Chat,
} from '@mui/icons-material';
import { useAuth } from '../../contexts/AuthContext';
import { useNavigate } from 'react-router-dom';
import { useQuery } from '@tanstack/react-query';
import { configApi } from '../../services/config';
import NotificationBell from './NotificationBell';
import { useLayout } from '../../contexts/LayoutContext';
interface HeaderProps {
onMenuClick: () => void;
@@ -32,7 +31,12 @@ interface HeaderProps {
function Header({ onMenuClick }: HeaderProps) {
const { user, logout } = useAuth();
const navigate = useNavigate();
const { toggleChatPanel } = useLayout();
const { data: settings } = useQuery({
queryKey: ['pdfSettings'],
queryFn: () => configApi.getPdfSettings(),
staleTime: 5 * 60 * 1000,
});
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const handleMenuOpen = (event: React.MouseEvent<HTMLElement>) => {
@@ -83,25 +87,24 @@ function Header({ onMenuClick }: HeaderProps) {
<MenuIcon />
</IconButton>
<LocalFireDepartment sx={{ mr: 2 }} />
<Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
Feuerwehr Dashboard
</Typography>
{settings?.app_logo ? (
<Box
onClick={() => navigate('/dashboard')}
sx={{ mr: 2, cursor: 'pointer', display: 'flex', alignItems: 'center', flexGrow: 1 }}
>
<img src={settings.app_logo} alt="Logo" style={{ height: 36 }} />
</Box>
) : (
<>
<LocalFireDepartment sx={{ mr: 2 }} />
<Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
Feuerwehr Dashboard
</Typography>
</>
)}
{user && (
<>
<Tooltip title="Chat">
<IconButton
color="inherit"
onClick={toggleChatPanel}
size="small"
aria-label="Chat öffnen"
sx={{ ml: 0.5 }}
>
<Chat />
</IconButton>
</Tooltip>
<NotificationBell />
<IconButton