Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x | /**
* @file AppHeader.tsx
* @module app/layout/AppHeader
*
* @summary
* Fixed application header (AppBar) with title, system health badge, and toolbar actions.
* Thin orchestrator delegating to HealthBadge and HeaderDemoBadge sub-components.
*
* @enterprise
* - Fixed positioning with consistent z-index stacking
* - System health status via HealthBadge sub-component
* - Demo mode indicator via HeaderDemoBadge sub-component
* - Responsive toolbar with mobile drawer toggle
* - Full TypeDoc coverage for header layout and component coordination
*/
import {
AppBar,
Toolbar,
Typography,
IconButton,
Box,
} from '@mui/material';
import MenuIcon from '@mui/icons-material/Menu';
import { useTranslation } from 'react-i18next';
import AppToolbarActions from './AppToolbarActions';
import { HealthBadge, HeaderDemoBadge } from './header';
import type { SupportedLocale } from '../../theme';
interface AppHeaderProps {
/** Current theme mode (light or dark) */
themeMode: 'light' | 'dark';
/** Callback when theme mode changes */
onThemeModeChange: (mode: 'light' | 'dark') => void;
/** Current locale setting (de or en) */
locale: SupportedLocale;
/** Callback when locale changes */
onLocaleChange: (locale: SupportedLocale) => void;
/** Callback for logout action */
onLogout: () => void;
/** Help topic ID for context-sensitive help */
helpTopic: string;
/** Whether user is on demo account */
isDemo: boolean;
/** Callback to toggle mobile drawer */
onDrawerToggle: () => void;
}
/**
* Application header component.
*
* Thin orchestrator that delegates rendering to focused sub-components.
* Renders the fixed AppBar with title, health status, demo badge, and toolbar actions.
*
* @param props - Component props
* @returns JSX element rendering the application header
*/
export default function AppHeader({
themeMode,
onThemeModeChange,
locale,
onLocaleChange,
onLogout,
helpTopic,
isDemo,
onDrawerToggle,
}: AppHeaderProps) {
const { t } = useTranslation(['common']);
return (
<AppBar
position="fixed"
color="primary"
sx={{ width: '100%', zIndex: (theme) => theme.zIndex.drawer + 1 }}
>
<Toolbar>
{/* Mobile Menu Toggle (hidden on md+) */}
<IconButton
edge="start"
onClick={onDrawerToggle}
sx={{ mr: 1, display: { md: 'none' } }}
>
<MenuIcon />
</IconButton>
{/* Application Title */}
<Typography variant="h6" sx={{ fontWeight: 700 }}>
{t('app.title')}
</Typography>
{/* Demo Badge (shown if user is on demo account) */}
<HeaderDemoBadge isDemo={isDemo} />
{/* Spacer */}
<Box sx={{ flex: 1 }} />
{/* System Health Badge (hidden on xs, shown on sm+) */}
<HealthBadge />
{/* Toolbar Actions (language, help, hamburger) */}
<AppToolbarActions
themeMode={themeMode}
onThemeModeChange={onThemeModeChange}
locale={locale}
onLocaleChange={onLocaleChange}
onLogout={onLogout}
helpTopic={helpTopic}
/>
</Toolbar>
</AppBar>
);
}
|