Charakterverwalter (westreiche_website) ergänzen, Website-Nav "Charaktere"
This commit is contained in:
parent
d107f90c93
commit
01dae01c7c
84 changed files with 8915 additions and 17 deletions
91
westreiche_website/views/layout.php
Normal file
91
westreiche_website/views/layout.php
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
/** @var string $title */
|
||||
/** @var string $content */
|
||||
/** @var array|null $user */
|
||||
$flashes = flash_pull();
|
||||
$path = current_path();
|
||||
$isAdmin = ($user['role'] ?? '') === 'admin';
|
||||
$navCurrent = static function (string $area) use ($path): string {
|
||||
$active = match ($area) {
|
||||
'home' => $path === '/',
|
||||
'new' => $path === '/characters/new',
|
||||
'admin' => str_starts_with($path, '/admin'),
|
||||
'account' => $path === '/account',
|
||||
default => false,
|
||||
};
|
||||
return $active ? ' aria-current="page"' : '';
|
||||
};
|
||||
$displayName = (string) ($user['display_name'] ?? '');
|
||||
if ($displayName === '') {
|
||||
$displayName = (string) ($user['username'] ?? '');
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="theme-color" content="#0a0d16">
|
||||
<meta name="csrf-token" content="<?= e(csrf_token()) ?>">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title><?= e($title) ?> · Westreiche</title>
|
||||
<link rel="icon" href="<?= e(asset('crest.svg')) ?>" type="image/svg+xml">
|
||||
<link rel="stylesheet" href="<?= e(asset('app.css')) ?>">
|
||||
<script src="<?= e(asset('app.js')) ?>" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<a class="skip-link" href="#main">Zum Inhalt springen</a>
|
||||
<div class="embers" aria-hidden="true">
|
||||
<span></span><span></span><span></span><span></span>
|
||||
<span></span><span></span><span></span><span></span>
|
||||
</div>
|
||||
|
||||
<header class="topbar">
|
||||
<div class="topbar-inner">
|
||||
<a class="brand" href="<?= e(url('/')) ?>">
|
||||
<svg class="brand-crest" viewBox="0 0 40 44" aria-hidden="true" focusable="false">
|
||||
<path d="M20 1.5 37 8v14c0 10-7.4 17.6-17 20.5C10.4 39.6 3 32 3 22V8z"
|
||||
fill="none" stroke="#e8c766" stroke-width="1.6"/>
|
||||
<path d="M20 5.5 33.5 10.6v11.4c0 8-5.7 14.3-13.5 17-7.8-2.7-13.5-9-13.5-17V10.6z"
|
||||
fill="rgba(201,162,39,0.10)" stroke="#7a6320" stroke-width="0.8"/>
|
||||
<path d="M12 15.5h3l2.6 9 2.9-11 3 11 2.6-9h3" fill="none" stroke="#e8c766" stroke-width="1.4"
|
||||
stroke-linejoin="round" stroke-linecap="round"/>
|
||||
</svg>
|
||||
<span>Westreiche
|
||||
<small>Charakterverwalter</small>
|
||||
</span>
|
||||
</a>
|
||||
<?php if ($user !== null): ?>
|
||||
<nav class="nav" aria-label="Hauptnavigation">
|
||||
<a href="<?= e(url('/')) ?>"<?= $navCurrent('home') ?>>Charaktere</a>
|
||||
<a href="<?= e(url('/characters/new')) ?>"<?= $navCurrent('new') ?>>Neu</a>
|
||||
<?php if ($isAdmin): ?>
|
||||
<a href="<?= e(url('/admin/users')) ?>"<?= $navCurrent('admin') ?>>Leitung</a>
|
||||
<?php endif; ?>
|
||||
<a href="<?= e(url('/account')) ?>"<?= $navCurrent('account') ?>><?= e($displayName) ?></a>
|
||||
<form method="post" action="<?= e(url('/logout')) ?>">
|
||||
<?= csrf_field() ?>
|
||||
<button type="submit" class="btn-ghost">Abmelden</button>
|
||||
</form>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="shell">
|
||||
<main id="main">
|
||||
<?php foreach ($flashes as $flashItem): ?>
|
||||
<p class="alert alert-<?= e($flashItem['type'] === 'success' ? 'success' : ($flashItem['type'] === 'info' ? 'info' : 'error')) ?>">
|
||||
<?= e($flashItem['message']) ?>
|
||||
</p>
|
||||
<?php endforeach; ?>
|
||||
<?= $content ?>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<p>Westreiche · Chronik am Zauberturm · <a href="https://zauberturm.de/">zauberturm.de</a></p>
|
||||
<p class="muted">Geschlossene Runde. Keine Registrierung – Konten vergibt der Spielleiter.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue