Files
budget/views/layout.php
T
Ty Clifford b7eaa81501 -
2026-06-14 15:25:31 -04:00

89 lines
4.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
$currentRoute = $route ?? (string) ($_GET['route'] ?? 'dashboard');
$currentMonth = $month ?? date('Y-m');
$previousMonth = date('Y-m', strtotime($currentMonth . '-01 -1 month'));
$nextMonth = date('Y-m', strtotime($currentMonth . '-01 +1 month'));
$appName = (string) $settings->get('app.name', 'Neon Ledger');
$defaultTheme = (string) $settings->get('theme.default', 'dark');
?>
<!doctype html>
<html lang="en" data-theme="<?= h($defaultTheme) ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark light">
<title><?= h($title ?? 'Planner') ?> · <?= h($appName) ?></title>
<link rel="stylesheet" href="/assets/app.css">
<script>document.documentElement.dataset.theme=localStorage.getItem('budget-theme')||<?= json_encode($defaultTheme) ?>;</script>
</head>
<body>
<div class="app-shell">
<aside class="sidebar" id="sidebar">
<a class="brand" href="<?= h(url('dashboard', ['month' => $currentMonth])) ?>">
<span class="brand-mark">NL</span>
<span><strong><?= h($appName) ?></strong><small>Financial command center</small></span>
</a>
<nav class="nav">
<a class="<?= $currentRoute === 'dashboard' ? 'active' : '' ?>" href="<?= h(url('dashboard', ['month' => $currentMonth])) ?>"><span>⌂</span> Command center</a>
<a class="<?= $currentRoute === 'transactions' ? 'active' : '' ?>" href="<?= h(url('transactions', ['month' => $currentMonth])) ?>"><span>↗</span> Expenses</a>
<?php if ($settings->module('calendar')): ?>
<a class="<?= $currentRoute === 'calendar' ? 'active' : '' ?>" href="<?= h(url('calendar', ['month' => $currentMonth])) ?>"><span>□</span> Bill calendar</a>
<?php endif; ?>
<?php if ($settings->module('comparisons')): ?>
<a class="<?= $currentRoute === 'comparisons' ? 'active' : '' ?>" href="<?= h(url('comparisons', ['month' => $currentMonth])) ?>"><span>⌁</span> Comparisons</a>
<?php endif; ?>
<?php if ($settings->module('dead_account')): ?>
<a class="<?= $currentRoute === 'dead-account' ? 'active' : '' ?>" href="<?= h(url('dead-account', ['month' => $currentMonth])) ?>"><span>◇</span> Dormant account</a>
<?php endif; ?>
</nav>
<div class="nav-label">Administration</div>
<nav class="nav">
<a class="<?= $currentRoute === 'settings' ? 'active' : '' ?>" href="<?= h(url('settings')) ?>"><span>⚙</span> Settings</a>
<?php if ($settings->module('import_export')): ?>
<a class="<?= $currentRoute === 'data' ? 'active' : '' ?>" href="<?= h(url('data', ['month' => $currentMonth])) ?>"><span>⇄</span> Import & export</a>
<?php endif; ?>
</nav>
<div class="sidebar-footer">
<button class="theme-toggle" type="button" data-theme-toggle aria-label="Toggle light and dark mode"><span>◐</span> <span data-theme-label>Light mode</span></button>
<form method="post">
<?= csrf_field() ?>
<input type="hidden" name="action" value="logout">
<button class="text-button" type="submit">Sign out</button>
</form>
</div>
</aside>
<main class="main">
<header class="topbar">
<button class="menu-button" type="button" data-menu-toggle aria-label="Open navigation">☰</button>
<div>
<p class="eyebrow"><?= h(date('l, F j')) ?></p>
<h1><?= h($title ?? 'Planner') ?></h1>
</div>
<?php if (!in_array($currentRoute, ['settings', 'data'], true)): ?>
<div class="month-switcher">
<a aria-label="Previous month" href="<?= h(url($currentRoute, ['month' => $previousMonth])) ?>">←</a>
<label>
<span class="sr-only">Budget month</span>
<input type="month" value="<?= h($currentMonth) ?>" data-month-picker data-route="<?= h($currentRoute) ?>">
</label>
<a aria-label="Next month" href="<?= h(url($currentRoute, ['month' => $nextMonth])) ?>">→</a>
</div>
<?php endif; ?>
</header>
<?php foreach ($flashes as $flash): ?>
<div class="flash <?= h($flash['type']) ?>" role="status">
<span><?= $flash['type'] === 'success' ? '✓' : '!' ?></span>
<?= h($flash['message']) ?>
<button type="button" aria-label="Dismiss">×</button>
</div>
<?php endforeach; ?>
<div class="page-content"><?= $content ?></div>
</main>
</div>
<script src="/assets/app.js"></script>
</body>
</html>