61 lines
3.7 KiB
PHP
Executable File
61 lines
3.7 KiB
PHP
Executable File
<?php
|
|
/** @var array $layoutContext */
|
|
$appBaseUrl = $layoutContext['app_base_url'] ?? '';
|
|
|
|
$navLinks = $navLinks ?? [
|
|
['id' => 'dashboard', 'label' => 'Dashboard', 'href' => $appBaseUrl . '/admin/dashboard.php'],
|
|
['id' => 'system', 'label' => 'Systemeinstellungen', 'href' => $appBaseUrl . '/admin/system.php'],
|
|
['id' => 'settings', 'label' => 'API & Tabellen', 'href' => $appBaseUrl . '/admin/settings.php'],
|
|
['id' => 'users', 'label' => 'Userverwaltung', 'href' => $appBaseUrl . '/admin/users.php'],
|
|
['id' => 'profile', 'label' => 'Mein Konto', 'href' => $appBaseUrl . '/admin/profile.php'],
|
|
];
|
|
|
|
$navActive = $navActive ?? null;
|
|
$headerTabs = isset($headerTabs) ? (string)$headerTabs : '';
|
|
$hasHeaderTabs = trim($headerTabs) !== '';
|
|
$showNavLinks = !$hasHeaderTabs && !empty($navLinks);
|
|
?>
|
|
<header class="site-header sticky top-0 z-40 border-b border-slate-200 bg-white/90 backdrop-blur">
|
|
<div class="max-w-6xl mx-auto px-4 lg:px-6 flex flex-wrap items-center gap-4 py-3">
|
|
<a href="<?= htmlspecialchars($appBaseUrl . '/index.php') ?>" class="flex items-center gap-2 text-slate-800 font-semibold">
|
|
<span class="inline-flex h-9 w-9 items-center justify-center rounded-xl bg-sky-500 text-white font-bold">ET</span>
|
|
<span class="hidden sm:block">Email Template System</span>
|
|
</a>
|
|
|
|
<div class="ms-auto flex items-center gap-3 flex-wrap justify-end flex-1">
|
|
<?php if ($hasHeaderTabs): ?>
|
|
<div class="header-tabs flex flex-wrap items-center gap-3 justify-end text-sm w-full md:w-auto">
|
|
<?= $headerTabs ?>
|
|
</div>
|
|
<?php elseif ($showNavLinks): ?>
|
|
<nav class="hidden md:flex items-center gap-2 text-sm font-medium text-slate-500">
|
|
<?php foreach ($navLinks as $link): ?>
|
|
<?php
|
|
$isActive = $navActive && $navActive === ($link['id'] ?? null);
|
|
$classes = 'px-3 py-1.5 rounded-full transition-colors';
|
|
$classes .= $isActive ? ' bg-sky-100 text-sky-700' : ' hover:text-slate-900';
|
|
?>
|
|
<a href="<?= htmlspecialchars($link['href']) ?>" class="<?= $classes ?>">
|
|
<?= htmlspecialchars($link['label']) ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</nav>
|
|
<?php endif; ?>
|
|
|
|
<div class="relative" id="userMenu">
|
|
<button id="btn-user" type="button" class="btn-avatar" aria-haspopup="true" aria-expanded="false">
|
|
<span id="userAvatar">U</span>
|
|
</button>
|
|
<div id="userMenuPanel" class="user-menu hidden" role="menu">
|
|
<a href="<?= htmlspecialchars($appBaseUrl . '/admin/profile.php') ?>" class="user-menu-item" data-menu="profile">Profil</a>
|
|
<a href="<?= htmlspecialchars($appBaseUrl . '/admin/dashboard.php') ?>" class="user-menu-item" data-role="admin">Dashboard</a>
|
|
<a href="<?= htmlspecialchars($appBaseUrl . '/admin/system.php') ?>" class="user-menu-item" data-role="admin">Systemverwaltung</a>
|
|
<a href="<?= htmlspecialchars($appBaseUrl . '/admin/settings.php') ?>" class="user-menu-item" data-role="admin">API & Tabellen</a>
|
|
<a href="<?= htmlspecialchars($appBaseUrl . '/admin/users.php') ?>" class="user-menu-item" data-role="owner">Userverwaltung</a>
|
|
<button id="btn-logout" type="button" class="user-menu-item text-red-600">Logout</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|