Redesign the logged-in area with a left icon sidebar layout
Replaces the top navbar with a fixed vertical sidebar (brand, nav links with inline SVG icons, active-link highlighting, user info and logout pinned to the bottom) for a more modern dashboard feel. Public pages (login, install, logged-out landing) keep the simple top bar. Collapses to an icon-only horizontal bar under 860px since there's no JS toggle. Dashboard quick-links get matching icon badges. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
a96fdd1b16
commit
5811019908
5 changed files with 243 additions and 44 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
--gold-hover: #e0b930;
|
--gold-hover: #e0b930;
|
||||||
--danger: #d9534f;
|
--danger: #d9534f;
|
||||||
--success: #4caf50;
|
--success: #4caf50;
|
||||||
|
--sidebar-width: 260px;
|
||||||
}
|
}
|
||||||
|
|
||||||
* { box-sizing: border-box; }
|
* { box-sizing: border-box; }
|
||||||
|
|
@ -24,6 +25,9 @@ body {
|
||||||
a { color: var(--gold); text-decoration: none; }
|
a { color: var(--gold); text-decoration: none; }
|
||||||
a:hover { color: var(--gold-hover); text-decoration: underline; }
|
a:hover { color: var(--gold-hover); text-decoration: underline; }
|
||||||
|
|
||||||
|
.icon { flex-shrink: 0; }
|
||||||
|
|
||||||
|
/* Oeffentliche/nicht eingeloggte Seiten: schlichte Kopfzeile */
|
||||||
.navbar {
|
.navbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -32,7 +36,6 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
|
||||||
padding: 0.75rem 1.5rem;
|
padding: 0.75rem 1.5rem;
|
||||||
background: var(--bg-panel);
|
background: var(--bg-panel);
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-brand a {
|
.navbar-brand a {
|
||||||
|
|
@ -41,19 +44,6 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
|
||||||
color: var(--gold);
|
color: var(--gold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-links {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 1rem;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-group {
|
|
||||||
color: var(--text-muted);
|
|
||||||
font-size: 0.85rem;
|
|
||||||
margin-left: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-user {
|
.navbar-user {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -61,8 +51,98 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Eingeloggter Bereich: Sidebar-Layout */
|
||||||
|
.app-shell {
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
width: var(--sidebar-width);
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background: var(--bg-panel);
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
padding: 1.5rem 1rem;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
height: 100vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-brand {
|
||||||
|
padding: 0 0.65rem 1.5rem;
|
||||||
|
font-size: 1.15rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-brand a { color: var(--gold); }
|
||||||
|
|
||||||
|
.sidebar-nav {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-section-label {
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding: 0.5rem 0.65rem 0.25rem;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-link {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.65rem 0.75rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
color: var(--text);
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-link:hover {
|
||||||
|
background: var(--bg-panel-alt);
|
||||||
|
color: var(--text);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-link.active {
|
||||||
|
background: rgba(201, 162, 39, 0.15);
|
||||||
|
color: var(--gold);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-footer {
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding-top: 1rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-user {
|
||||||
|
padding: 0 0.65rem;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-user strong { color: var(--text); }
|
||||||
|
|
||||||
|
.app-content {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
max-width: 1000px;
|
max-width: 1100px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 2rem 1.5rem;
|
padding: 2rem 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
@ -70,9 +150,10 @@ a:hover { color: var(--gold-hover); text-decoration: underline; }
|
||||||
.panel {
|
.panel {
|
||||||
background: var(--bg-panel);
|
background: var(--bg-panel);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 8px;
|
border-radius: 10px;
|
||||||
padding: 1.5rem 2rem;
|
padding: 1.5rem 2rem;
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-narrow {
|
.panel-narrow {
|
||||||
|
|
@ -115,7 +196,7 @@ textarea,
|
||||||
select {
|
select {
|
||||||
background: var(--bg-panel-alt);
|
background: var(--bg-panel-alt);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 4px;
|
border-radius: 6px;
|
||||||
padding: 0.6rem 0.75rem;
|
padding: 0.6rem 0.75rem;
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
|
@ -138,7 +219,7 @@ input:focus, select:focus, textarea:focus {
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
background: var(--bg-panel-alt);
|
background: var(--bg-panel-alt);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 4px;
|
border-radius: 6px;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,13 +237,14 @@ input:focus, select:focus, textarea:focus {
|
||||||
background: var(--gold);
|
background: var(--gold);
|
||||||
color: #1a1a1a;
|
color: #1a1a1a;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 6px;
|
||||||
padding: 0.6rem 1.25rem;
|
padding: 0.6rem 1.25rem;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
|
transition: background 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button:hover, button:hover { background: var(--gold-hover); text-decoration: none; }
|
.button:hover, button:hover { background: var(--gold-hover); text-decoration: none; }
|
||||||
|
|
@ -190,7 +272,7 @@ input:focus, select:focus, textarea:focus {
|
||||||
|
|
||||||
.flash {
|
.flash {
|
||||||
padding: 0.75rem 1rem;
|
padding: 0.75rem 1rem;
|
||||||
border-radius: 4px;
|
border-radius: 6px;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
}
|
}
|
||||||
|
|
@ -212,3 +294,66 @@ input:focus, select:focus, textarea:focus {
|
||||||
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stat-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card .icon-badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: rgba(201, 162, 39, 0.15);
|
||||||
|
color: var(--gold);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card h3 { margin: 0 0 0.15rem; color: var(--text); font-size: 1rem; }
|
||||||
|
.stat-card p { margin: 0; }
|
||||||
|
|
||||||
|
@media (max-width: 860px) {
|
||||||
|
.app-shell {
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
position: static;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0.6rem 0.75rem;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-brand { padding: 0 0.75rem 0 0; }
|
||||||
|
|
||||||
|
.sidebar-nav {
|
||||||
|
flex-direction: row;
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-section-label { display: none; }
|
||||||
|
|
||||||
|
.sidebar-link .label { display: none; }
|
||||||
|
|
||||||
|
.sidebar-footer {
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-left: auto;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-left: 0.75rem;
|
||||||
|
border-top: none;
|
||||||
|
border-left: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-user { display: none; }
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,21 @@ include __DIR__ . '/includes/header.php';
|
||||||
<h2>Administration</h2>
|
<h2>Administration</h2>
|
||||||
<div class="card-grid">
|
<div class="card-grid">
|
||||||
<?php if ($canViewUsers): ?>
|
<?php if ($canViewUsers): ?>
|
||||||
<div class="panel">
|
<div class="panel stat-card">
|
||||||
<h3>Benutzerverwaltung</h3>
|
<div class="icon-badge"><?= icon('users') ?></div>
|
||||||
<p class="text-muted">Mitglieder anlegen, bearbeiten, deaktivieren.</p>
|
<div>
|
||||||
<a class="button" href="/admin/users.php">Oeffnen</a>
|
<h3>Benutzerverwaltung</h3>
|
||||||
|
<p class="text-muted"><a href="/admin/users.php">Mitglieder anlegen, bearbeiten, deaktivieren</a></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($canManageRoles): ?>
|
<?php if ($canManageRoles): ?>
|
||||||
<div class="panel">
|
<div class="panel stat-card">
|
||||||
<h3>Berechtigungsgruppen</h3>
|
<div class="icon-badge"><?= icon('shield') ?></div>
|
||||||
<p class="text-muted">Rollen und deren Berechtigungen verwalten.</p>
|
<div>
|
||||||
<a class="button" href="/admin/roles.php">Oeffnen</a>
|
<h3>Berechtigungsgruppen</h3>
|
||||||
|
<p class="text-muted"><a href="/admin/roles.php">Rollen und Berechtigungen verwalten</a></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
<?php if (!empty($currentUser)): ?>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
</main>
|
</main>
|
||||||
|
<?php endif; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -58,3 +58,21 @@ function generate_temp_password(int $length = 12): string
|
||||||
}
|
}
|
||||||
return $password;
|
return $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Kleine, abhaengigkeitsfreie Icon-Sammlung (Strichgrafiken, angelehnt an
|
||||||
|
// Feather Icons) fuer die Sidebar-Navigation.
|
||||||
|
function icon(string $name): string
|
||||||
|
{
|
||||||
|
$paths = [
|
||||||
|
'home' => '<path d="M3 9.5 12 3l9 6.5V20a1 1 0 0 1-1 1h-5v-7H9v7H4a1 1 0 0 1-1-1z"/>',
|
||||||
|
'users' => '<path d="M16 19v-1.5a3.5 3.5 0 0 0-3.5-3.5h-5A3.5 3.5 0 0 0 4 17.5V19"/><circle cx="9" cy="8" r="3"/><path d="M20 19v-1.5a3.5 3.5 0 0 0-2.5-3.36"/><path d="M14.5 4.6a3 3 0 0 1 0 5.8"/>',
|
||||||
|
'shield' => '<path d="M12 21c4.5-1.8 7-5.2 7-9.5V6l-7-3-7 3v5.5c0 4.3 2.5 7.7 7 9.5z"/>',
|
||||||
|
'log-out' => '<path d="M9 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h3"/><path d="m14 16 4-4-4-4"/><path d="M18 12H9"/>',
|
||||||
|
'lock' => '<rect x="4" y="11" width="16" height="9" rx="2"/><path d="M7.5 11V7.5a4.5 4.5 0 0 1 9 0V11"/>',
|
||||||
|
];
|
||||||
|
|
||||||
|
$path = $paths[$name] ?? '';
|
||||||
|
|
||||||
|
return '<svg class="icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" '
|
||||||
|
. 'stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' . $path . '</svg>';
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@ $currentUser = current_user();
|
||||||
$canViewUsers = $currentUser && user_has_permission('users.view');
|
$canViewUsers = $currentUser && user_has_permission('users.view');
|
||||||
$canManageRoles = $currentUser && user_has_permission('roles.manage');
|
$canManageRoles = $currentUser && user_has_permission('roles.manage');
|
||||||
$showAdminMenu = $canViewUsers || $canManageRoles;
|
$showAdminMenu = $canViewUsers || $canManageRoles;
|
||||||
|
|
||||||
|
$currentScript = basename((string) ($_SERVER['SCRIPT_NAME'] ?? ''));
|
||||||
|
$isDashboardActive = $currentScript === 'dashboard.php';
|
||||||
|
$isUsersActive = in_array($currentScript, ['users.php', 'user_form.php', 'user_delete.php'], true);
|
||||||
|
$isRolesActive = in_array($currentScript, ['roles.php', 'role_form.php', 'role_delete.php'], true);
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
|
|
@ -14,28 +19,49 @@ $showAdminMenu = $canViewUsers || $canManageRoles;
|
||||||
<link rel="stylesheet" href="/assets/css/style.css">
|
<link rel="stylesheet" href="/assets/css/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<?php if ($currentUser): ?>
|
||||||
|
<div class="app-shell">
|
||||||
|
<aside class="sidebar">
|
||||||
|
<div class="sidebar-brand"><a href="/">Aion2 Gilde</a></div>
|
||||||
|
<nav class="sidebar-nav">
|
||||||
|
<a href="/dashboard.php" class="sidebar-link<?= $isDashboardActive ? ' active' : '' ?>" title="Dashboard">
|
||||||
|
<?= icon('home') ?><span class="label">Dashboard</span>
|
||||||
|
</a>
|
||||||
|
<?php if ($showAdminMenu): ?>
|
||||||
|
<div class="sidebar-section-label">Admin</div>
|
||||||
|
<?php if ($canViewUsers): ?>
|
||||||
|
<a href="/admin/users.php" class="sidebar-link<?= $isUsersActive ? ' active' : '' ?>" title="Benutzerverwaltung">
|
||||||
|
<?= icon('users') ?><span class="label">Benutzerverwaltung</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($canManageRoles): ?>
|
||||||
|
<a href="/admin/roles.php" class="sidebar-link<?= $isRolesActive ? ' active' : '' ?>" title="Berechtigungsgruppen">
|
||||||
|
<?= icon('shield') ?><span class="label">Berechtigungsgruppen</span>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</nav>
|
||||||
|
<div class="sidebar-footer">
|
||||||
|
<div class="sidebar-user">Angemeldet als<br><strong><?= e($currentUser['display_name'] !== '' ? $currentUser['display_name'] : $currentUser['username']) ?></strong></div>
|
||||||
|
<a href="/logout.php" class="sidebar-link" title="Abmelden">
|
||||||
|
<?= icon('log-out') ?><span class="label">Abmelden</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
<div class="app-content">
|
||||||
|
<main class="container">
|
||||||
|
<?php foreach (get_flashes() as $flash): ?>
|
||||||
|
<div class="flash flash-<?= e($flash['type']) ?>"><?= e($flash['message']) ?></div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else: ?>
|
||||||
<header class="navbar">
|
<header class="navbar">
|
||||||
<div class="navbar-brand"><a href="/">Aion2 Gilde</a></div>
|
<div class="navbar-brand"><a href="/">Aion2 Gilde</a></div>
|
||||||
<nav class="navbar-links">
|
|
||||||
<?php if ($currentUser): ?>
|
|
||||||
<a href="/dashboard.php">Dashboard</a>
|
|
||||||
<?php if ($showAdminMenu): ?>
|
|
||||||
<span class="navbar-group">Admin:</span>
|
|
||||||
<?php if ($canViewUsers): ?><a href="/admin/users.php">Benutzerverwaltung</a><?php endif; ?>
|
|
||||||
<?php if ($canManageRoles): ?><a href="/admin/roles.php">Berechtigungsgruppen</a><?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</nav>
|
|
||||||
<div class="navbar-user">
|
<div class="navbar-user">
|
||||||
<?php if ($currentUser): ?>
|
<a href="/login.php">Login</a>
|
||||||
<span>Angemeldet als <strong><?= e($currentUser['display_name'] !== '' ? $currentUser['display_name'] : $currentUser['username']) ?></strong></span>
|
|
||||||
<a href="/logout.php">Abmelden</a>
|
|
||||||
<?php else: ?>
|
|
||||||
<a href="/login.php">Login</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<main class="container">
|
<main class="container">
|
||||||
<?php foreach (get_flashes() as $flash): ?>
|
<?php foreach (get_flashes() as $flash): ?>
|
||||||
<div class="flash flash-<?= e($flash['type']) ?>"><?= e($flash['message']) ?></div>
|
<div class="flash flash-<?= e($flash['type']) ?>"><?= e($flash['message']) ?></div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue