Files
courtside/server/views/layout.js
T
bkvargyas 6a3f966758 Release 0.2.0: changelog, version reporting, push-to-deploy
- CHANGELOG.md following Keep a Changelog, covering 0.1.0 and 0.2.0
- server/version.js reads the version from package.json; /healthz returns it
  and the footer renders it, so a deployment always states what it is serving
- bump package.json 0.1.0 -> 0.2.0
2026-09-03 17:31:21 -04:00

34 lines
1.5 KiB
JavaScript

import { VERSION } from '../version.js';
import { esc } from '../http.js';
export function layout({ title, body, state = null, script = null, bodyClass = '', admin = null, nav = '' }) {
return `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="theme-color" content="#0F1418">
<title>${esc(title)} · Courtside</title>
<link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
<link rel="manifest" href="/static/manifest.webmanifest">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Source+Sans+3:wght@400;600&family=JetBrains+Mono:wght@500&display=swap">
<link rel="stylesheet" href="/static/app.css">
</head>
<body class="${esc(bodyClass)}">
<header class="top">
<a class="brand" href="/">Courtside</a>
<nav>${nav}${admin ? `<a href="/admin">Desk</a><a href="/admin/logout">Sign out</a>` : ''}</nav>
</header>
<main>
${body}
</main>
<footer class="foot">Courtside v${VERSION} · self-hosted tournament desk · <a href="https://gitea.cloudfreeiot.com/bkvargyas/courtside">source</a></footer>
${state ? `<script id="state" type="application/json">${JSON.stringify(state).replace(/</g, '\\u003c')}</script>` : ''}
${script ? `<script src="${esc(script)}" defer></script>` : ''}
</body>
</html>`;
}
export const flash = (msg, kind = 'ok') => msg ? `<div class="flash ${kind}">${esc(msg)}</div>` : '';