* build(deps): bump askama from 0.12.1 to 0.15.4 Bumps [askama](https://github.com/askama-rs/askama) from 0.12.1 to 0.15.4. - [Release notes](https://github.com/askama-rs/askama/releases) - [Commits](https://github.com/askama-rs/askama/compare/0.12.1...v0.15.4) --- updated-dependencies: - dependency-name: askama dependency-version: 0.15.4 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * fix(deps): adapt templates and tests for askama 0.15 - Migrate macro calls from {% call %} to {{ }} expression syntax (134 occurrences) - Update test assertion for askama 0.15's numeric HTML entity encoding (& vs &) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jon Seager <jon@sgrs.uk>
93 lines
5.5 KiB
HTML
93 lines
5.5 KiB
HTML
{% import "partials/icons.html" as icons %}
|
|
<nav class="relative border-b pb-4 text-sm" data-signals:_nav-open="false">
|
|
<div class="flex items-center justify-between">
|
|
<div class="font-semibold uppercase tracking-[0.25em] text-accent"><a href="/">B{rew}log</a></div>
|
|
<div class="relative flex items-center gap-1">
|
|
<a class="rounded-md p-1.5 transition {% if nav_active == "home" %}text-accent{% else %}text-text-muted hover:text-text-secondary{% endif %}" href="/" title="Home" aria-label="Home">
|
|
{{ icons::home("h-5 w-5") }}
|
|
</a>
|
|
<button type="button" class="rounded-md p-1.5 text-text-muted transition hover:text-text-secondary" title="Toggle theme" aria-label="Toggle theme" onclick="toggleTheme()">
|
|
<span class="theme-icon-light">{{ icons::sun("h-5 w-5") }}</span>
|
|
<span class="theme-icon-dark hidden">{{ icons::moon("h-5 w-5") }}</span>
|
|
</button>
|
|
<button class="rounded-md p-1.5 text-text-muted transition hover:text-text-secondary" data-on:click="$_navOpen = !$_navOpen" title="Menu" aria-label="Toggle menu">
|
|
<span data-show="!$_navOpen">{{ icons::hamburger("h-5 w-5") }}</span>
|
|
<span data-show="$_navOpen" style="display:none">{{ icons::close("h-5 w-5") }}</span>
|
|
</button>
|
|
<!-- Backdrop (click outside to close) -->
|
|
<div class="fixed inset-0 z-40" data-show="$_navOpen" data-on:click="$_navOpen = false" style="display:none"></div>
|
|
<!-- Dropdown menu -->
|
|
<div class="absolute right-0 top-full z-50 mt-2 flex flex-col gap-1 rounded-lg border bg-surface p-3 whitespace-nowrap" data-show="$_navOpen" style="display:none">
|
|
<a class="rounded-md px-4 py-2.5 transition flex items-center justify-end gap-4 {% if nav_active == "data" %}text-accent font-medium{% else %}text-text-muted hover:text-text hover:bg-surface-alt{% endif %}" href="/data">
|
|
Data {{ icons::squares("h-4 w-4 shrink-0") }}
|
|
</a>
|
|
<a class="rounded-md px-4 py-2.5 transition flex items-center justify-end gap-4 {% if nav_active == "timeline" %}text-accent font-medium{% else %}text-text-muted hover:text-text hover:bg-surface-alt{% endif %}" href="/timeline">
|
|
Timeline {{ icons::timeline("h-4 w-4 shrink-0") }}
|
|
</a>
|
|
{% if is_authenticated %}
|
|
<a class="rounded-md px-4 py-2.5 transition flex items-center justify-end gap-4 {% if nav_active == "checkin" %}text-accent font-medium{% else %}text-text-muted hover:text-text hover:bg-surface-alt{% endif %}" href="/check-in">
|
|
Check In {{ icons::checkin("h-4 w-4 shrink-0") }}
|
|
</a>
|
|
<a class="rounded-md px-4 py-2.5 transition flex items-center justify-end gap-4 {% if nav_active == "account" %}text-accent font-medium{% else %}text-text-muted hover:text-text hover:bg-surface-alt{% endif %}" href="/account">
|
|
Admin {{ icons::cog("h-4 w-4 shrink-0") }}
|
|
</a>
|
|
<form method="post" action="/logout">
|
|
<button type="submit" class="w-full rounded-md px-4 py-2.5 transition flex items-center justify-end gap-4 text-text-muted hover:text-text hover:bg-surface-alt">
|
|
Sign Out {{ icons::logout("h-4 w-4 shrink-0") }}
|
|
</button>
|
|
</form>
|
|
{% else %}
|
|
<a class="rounded-md px-4 py-2.5 transition flex items-center justify-end gap-4 text-text-muted hover:text-text hover:bg-surface-alt" href="/login">
|
|
Login {{ icons::user("h-4 w-4 shrink-0") }}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<script>
|
|
const toggleTheme = () => {
|
|
const html = document.documentElement;
|
|
const isDark = html.getAttribute("data-theme") === "dark";
|
|
const osDark = matchMedia("(prefers-color-scheme: dark)").matches;
|
|
if (isDark) {
|
|
html.removeAttribute("data-theme");
|
|
// Only persist if this choice differs from OS preference
|
|
if (osDark) localStorage.setItem("theme", "light");
|
|
else localStorage.removeItem("theme");
|
|
} else {
|
|
html.setAttribute("data-theme", "dark");
|
|
if (!osDark) localStorage.setItem("theme", "dark");
|
|
else localStorage.removeItem("theme");
|
|
}
|
|
updateThemeIcons();
|
|
};
|
|
|
|
const updateThemeIcons = () => {
|
|
const isDark = document.documentElement.getAttribute("data-theme") === "dark";
|
|
document.querySelectorAll(".theme-icon-light").forEach((el) => {
|
|
el.classList.toggle("hidden", isDark);
|
|
});
|
|
document.querySelectorAll(".theme-icon-dark").forEach((el) => {
|
|
el.classList.toggle("hidden", !isDark);
|
|
});
|
|
const favicon = document.getElementById("favicon");
|
|
if (favicon) {
|
|
favicon.href = isDark ? "/favicon-dark.svg" : "/favicon-light.svg";
|
|
}
|
|
};
|
|
|
|
// Set correct icon state on load
|
|
updateThemeIcons();
|
|
|
|
// Follow OS theme changes when the user hasn't manually chosen
|
|
matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => {
|
|
if (localStorage.getItem("theme")) return;
|
|
const html = document.documentElement;
|
|
if (e.matches) {
|
|
html.setAttribute("data-theme", "dark");
|
|
} else {
|
|
html.removeAttribute("data-theme");
|
|
}
|
|
updateThemeIcons();
|
|
});
|
|
</script>
|