Files
com.gregkilmer.www/services/admin/src/layout.ts
T
Claude 02437358cf Add a Before launch placeholder check to admin
Lists pages still showing built-in wording, notes holding placeholder
text, unpublished posts and live notes missing the field their page is
built around, each linked to its editor.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012aSbo2D1qP8cMFQCykf7kx
2026-10-18 16:52:56 +00:00

56 lines
1.9 KiB
TypeScript

import { html, type Html } from "./html.ts";
export interface Flash {
msg?: string;
err?: string;
reasons?: string[];
}
const nav: [string, string][] = [
["/", "Overview"],
["/site", "Site pages"],
["/launch", "Before launch"],
["/review", "Review"],
["/inbox", "Inbox"],
["/notes", "Notes"],
["/drafts", "Drafts"],
["/posts", "Posts"],
["/images", "Images"],
["/capture", "Capture"],
["/store", "Store"],
["/problems", "Problems"],
];
export function layout(p: { title: string; path: string; held: number; inbox?: number; flash?: Flash; body: Html }): Html {
const current = (href: string) => (href === "/" ? p.path === "/" : p.path.startsWith(href));
return html`<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<title>${p.title} · GregKilmer.com admin</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Cinzel:wght@600&family=Montserrat:wght@400;600;700&display=swap">
<link rel="stylesheet" href="/admin.css">
<script src="/admin.js" defer></script>
</head>
<body>
<header class="top">
<a class="brand" href="/">GregKilmer.com admin</a>
<nav>${nav.map(
([href, label]) =>
html`<a href="${href}" ${current(href) ? html`aria-current="page"` : ""}>${label}${href === "/review" && p.held ? html`<span class="count">${p.held}</span>` : ""}${href === "/inbox" && p.inbox ? html`<span class="count">${p.inbox}</span>` : ""}</a>`,
)}</nav>
</header>
<main>
${p.flash?.msg ? html`<div class="flash" role="status">${p.flash.msg}</div>` : ""}
${p.flash?.err
? html`<div class="flash err" role="alert">${p.flash.err}${p.flash.reasons?.length ? html`<ul>${p.flash.reasons.map((r) => html`<li>${r}</li>`)}</ul>` : ""}</div>`
: ""}
${p.body}
</main>
</body>
</html>`;
}