This commit is contained in:
2025-11-22 03:21:07 +01:00
parent be2bc4634d
commit 99098fa678
4 changed files with 166 additions and 25 deletions

View File

@@ -6,13 +6,13 @@ $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https'
$host = $_SERVER['HTTP_HOST'] ?? 'usbcheck.it';
$baseUrl = $scheme . '://' . $host;
// Wenn $navAnchors NICHT gesetzt ist → leeres Array
// Falls navAnchors nicht gesetzt sind → leeres Array
if (!isset($navAnchors) || !is_array($navAnchors)) {
$navAnchors = [];
}
// Session sollte in config/fileload.php bereits gestartet sein.
// Falls nicht, hier Fallback:
// Fallback:
if (session_status() !== PHP_SESSION_ACTIVE) {
@session_start();
}
@@ -66,7 +66,7 @@ if ($isLoggedIn) {
</a>
</div>
<!-- Navigation + Controls -->
<!-- Navigation / Controls -->
<div class="flex items-center gap-6">
<!-- Hauptnavigation -->
@@ -119,19 +119,18 @@ if ($isLoggedIn) {
</div>
</div>
<!-- Login Button / Avatar -->
<?php if (!$isLoggedIn): ?>
<!-- Nicht eingeloggt: Login-Button anzeigen -->
<button id="loginButton"
class="relative inline-flex items-center justify-center rounded-full bg-brand-primary px-4 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-brand-bg shadow-soft hover:bg-cyan-400 transition-colors"
data-i18n="header_btn_login">
Login
</button>
<?php else: ?>
<!-- Eingeloggt: Avatar + User-Menü -->
<div class="relative">
<!-- Login / Avatar -->
<div class="relative">
<?php if (!$isLoggedIn): ?>
<!-- Nicht eingeloggt: Login-Button -->
<button id="loginButton"
class="relative inline-flex items-center justify-center rounded-full bg-brand-primary px-4 py-1.5 text-xs font-semibold uppercase tracking-[0.18em] text-brand-bg shadow-soft hover:bg-cyan-400 transition-colors"
data-i18n="header_btn_login">
Login
</button>
<?php else: ?>
<!-- Eingeloggt: Avatar + Menü -->
<button id="userAvatar"
type="button"
class="h-9 w-9 rounded-full border border-brand-border bg-brand-surface flex items-center justify-center text-xs font-semibold text-brand-text shadow-soft hover:border-brand-primary transition"
aria-haspopup="true"
aria-expanded="false"
@@ -140,19 +139,23 @@ if ($isLoggedIn) {
</button>
<div id="userMenu"
class="hidden absolute right-0 mt-2 w-40 rounded-xl bg-brand-surface border border-brand-border shadow-lg py-1 text-xs text-brand-muted">
class="hidden absolute right-0 mt-2 w-44 rounded-xl bg-brand-surface border border-brand-border shadow-lg py-1 text-xs">
<a href="/dashboard/?lang=<?= urlencode($lang) ?>"
class="flex items-center gap-2 px-3 py-1.5 hover:bg-brand-bg/60 hover:text-brand-primary transition-colors">
class="flex items-center justify-between px-3 py-2 hover:bg-brand-bg/60 text-brand-muted hover:text-brand-primary transition-colors"
data-i18n="header_menu_dashboard">
<span>Dashboard</span>
</a>
<a href="/auth/logout?lang=<?= urlencode($lang) ?>"
id="userMenuLogout"
class="flex items-center gap-2 px-3 py-1.5 hover:bg-brand-bg/60 hover:text-red-300 transition-colors">
<button type="button"
data-logout-link="true"
data-logout-href="/auth/logout?lang=<?= urlencode($lang) ?>"
class="flex w-full items-center justify-between px-3 py-2 hover:bg-red-500/10 text-brand-muted hover:text-red-400 transition-colors"
data-i18n="header_menu_logout">
<span>Logout</span>
</a>
</button>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>