Files
edgeguard-native/management-ui/src/components/Layout/AppLayout.tsx
Debian fa86b14635 fix(layout): Header-Titel für SSL, DNS, NTP, WireGuard, ForwardProxy
PAGE_TITLES in AppLayout fehlten 5 Einträge — diese Seiten zeigten
statt dem Seitennamen nur den generischen App-Titel im Header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 16:20:02 +02:00

71 lines
2.2 KiB
TypeScript

import { useState } from 'react'
import { Outlet, useLocation } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import Sidebar from './Sidebar'
import Header from './Header'
import UpdateBanner from '../UpdateBanner'
import LicenseBanner from '../LicenseBanner'
import MaintenanceBanner from '../MaintenanceBanner'
// PAGE_TITLES maps the pathname to an i18n nav key. Header reads
// this to render "where you are". Empty fallback = app.title.
const PAGE_TITLES: Record<string, string> = {
'/dashboard': 'nav.dashboard',
'/domains': 'nav.domains',
'/backends': 'nav.backends',
'/routing-rules': 'nav.routing',
'/networks': 'nav.networks',
'/ip-addresses': 'nav.ipAddresses',
'/ssl': 'nav.ssl',
'/dns': 'nav.dns',
'/ntp': 'nav.ntp',
'/vpn/wireguard': 'nav.wireguard',
'/forward-proxy': 'nav.forwardProxy',
'/firewall/live': 'nav.firewallLive',
'/firewall': 'nav.firewall',
'/cluster': 'nav.cluster',
'/logs': 'nav.logs',
'/audit': 'nav.audit',
'/backups': 'nav.backups',
'/diagnostics': 'nav.diagnostics',
'/alerts': 'nav.alerts',
'/license': 'nav.license',
'/users': 'nav.users',
'/settings': 'nav.settings',
}
export default function AppLayout() {
const [sidebarOpen, setSidebarOpen] = useState(false)
const location = useLocation()
const { t } = useTranslation()
const titleKey = Object.entries(PAGE_TITLES)
.find(([p]) => location.pathname === p || location.pathname.startsWith(p + '/'))?.[1]
const title = titleKey ? t(titleKey) : t('app.title')
return (
<div className="app-layout">
{sidebarOpen && (
<div
className="sidebar-overlay"
onClick={() => setSidebarOpen(false)}
aria-hidden="true"
/>
)}
<Sidebar isOpen={sidebarOpen} onClose={() => setSidebarOpen(false)} />
<main className="main-content">
<Header pageTitle={title} onMenuToggle={() => setSidebarOpen(true)} />
<MaintenanceBanner />
<LicenseBanner />
<UpdateBanner />
<div className="content-area">
<Outlet />
</div>
</main>
</div>
)
}