|
- <?php
-
- declare(strict_types=1);
-
- $navigationItems = [
- ['label' => 'Home', 'href' => '/'],
- ['label' => 'Campaigns', 'href' => '/campaigns'],
- ['label' => 'Campaign Types', 'href' => '/campaign-types'],
- ['label' => 'Jobs', 'href' => '/jobs'],
- ['label' => 'Job Types', 'href' => '/job-types'],
- ];
-
- $currentPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
- $currentPath = is_string($currentPath) && $currentPath !== '' ? $currentPath : '/';
- $jsVersion = filemtime(__DIR__ . '/../../../public/js/app.js') ?: time();
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title><?= e($pageTitle ?? 'Campaign Tracker') ?></title>
- <link rel="stylesheet" href="https://unpkg.com/tabulator-tables@6.3.1/dist/css/tabulator.min.css">
- <link rel="stylesheet" href="<?= e(asset('css/site.css')) ?>">
- <script>window.__csrf = '<?= e(csrf_token()) ?>';</script>
- <script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.10/dist/htmx.min.js" integrity="sha384-H5SrcfygHmAuTDZphMHqBJLc3FhssKjG7w/CeCpFReSfwBWDTKpkzPP8c+cLsK+V" crossorigin="anonymous" defer></script>
- <script src="https://unpkg.com/tabulator-tables@6.3.1/dist/js/tabulator.min.js" defer></script>
- <script src="<?= e(asset('js/app.js')) ?>?v=<?= e((string) $jsVersion) ?>" defer></script>
- <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
- </head>
- <body>
- <div class="page-shell">
- <header class="site-header">
- <div class="container header-inner">
- <a class="brand" href="/">
- <span class="brand-mark">CT</span>
- <span class="brand-copy">
- <strong>Campaign Tracker</strong>
- <small>PHP MVC</small>
- </span>
- </a>
-
- <nav class="site-nav" aria-label="Primary navigation">
- <?php foreach ($navigationItems as $item): ?>
- <?php
- $isActive = $item['href'] === '/'
- ? $currentPath === '/'
- : str_starts_with($currentPath, $item['href']);
- ?>
- <a class="nav-link<?= $isActive ? ' is-active' : '' ?>" href="<?= e($item['href']) ?>">
- <?= e($item['label']) ?>
- </a>
- <?php endforeach; ?>
-
- <?php if (auth()->check()): ?>
- <span class="nav-user"><?= e(auth()->user()?->displayName ?: auth()->user()?->username ?? '') ?></span>
- <form method="post" action="/logout" class="nav-logout-form">
- <?= csrf_field() ?>
- <button type="submit" class="button button-secondary button-sm">Log out</button>
- </form>
- <?php endif; ?>
- </nav>
- </div>
- </header>
|