summaryrefslogtreecommitdiff
path: root/web/templates/layout.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'web/templates/layout.tmpl')
-rw-r--r--web/templates/layout.tmpl94
1 files changed, 94 insertions, 0 deletions
diff --git a/web/templates/layout.tmpl b/web/templates/layout.tmpl
new file mode 100644
index 0000000..969cae6
--- /dev/null
+++ b/web/templates/layout.tmpl
@@ -0,0 +1,94 @@
+<!doctype html>
+<html lang="en"{{if .Live}} data-live="1"{{end}}>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>{{.Title}}</title>
+<link rel="icon" type="image/svg+xml" href="{{.Href "asset" "bemtevi.svg"}}">
+<link rel="stylesheet" href="{{.Href "asset" "style.css"}}">
+<script>
+// the theme is worn before the first paint. A theme that is not one of the
+// two the site was built with lives in themes.css, so pull that in too —
+// from here, after style.css, so its :root block is the one that wins.
+{const d = document.documentElement, t = localStorage.getItem("notevi-theme");
+ if (t && t !== "system") d.dataset.theme = t;
+ if (t && !/^(system|dark|light)$/.test(t)) {
+ const l = document.createElement("link");
+ l.rel = "stylesheet"; l.id = "themescss"; l.href = "{{.Href "asset" "themes.css"}}";
+ document.head.append(l);
+ }
+ d.dataset.mode = localStorage.getItem("notevi-mode") || "trace";
+ d.dataset.files = localStorage.getItem("notevi-files-hidden") === "1" ? "hidden" : "shown";}
+</script>
+{{if .Live}}<script src="{{.Href "asset" "htmx.min.js"}}"></script>{{end}}
+<script src="{{.Href "asset" "app.js"}}" defer></script>
+</head>
+<body{{if eq .Kind "file"}} class="with-aside"{{end}} data-kind="{{.Kind}}">
+
+<nav aria-label="repository files" id="nav" data-root="{{.Root}}" data-current="{{.Current}}" data-tree="{{.Href "tree"}}">
+ <header>
+ <a class="brand" href="{{.Href ""}}"><img class="mark" src="{{.Href "asset" "bemtevi.svg"}}" alt="" width="20" height="20">{{.Site.Title}}</a>
+ <div class="modes" role="group" aria-label="focus">
+ <button type="button" class="mode" data-mode="trace" title="reading coverage (t)">trace</button>
+ <button type="button" class="mode" data-mode="notes" title="notes and comments (t)">notes</button>
+ </div>
+ </header>
+ {{template "changebar" .}}
+ {{if .Live}}
+ <div id="activity" class="activity" hx-get="{{.Href "activity"}}?compact=1" hx-trigger="load, every 3s" hx-swap="innerHTML"></div>
+ {{end}}
+ <button type="button" id="filetoggle" aria-controls="filelist" aria-expanded="true">hide files</button>
+ <div id="filelist">
+ <input id="filefind" class="find" type="search" placeholder="find file…" aria-label="find file" autocomplete="off" spellcheck="false">
+ <div id="tree"><p class="meta hint">loading tree…</p></div>
+ </div>
+ <footer>
+ <span>
+ {{if and .Live (ne .Root "/")}}<a href="/">projects</a> · {{end}}
+ <a href="{{.Href "notes"}}">notes ({{len .Site.Notes}})</a> ·
+ <a href="{{.Href "files"}}">files</a>{{if .Live}} ·
+ <a href="{{.Href "jj"}}">jj</a>{{end}}
+ </span>
+ <div class="themepick" id="themepick"
+ data-js="{{.Href "asset" "themes.js"}}" data-css="{{.Href "asset" "themes.css"}}"
+ data-dark="{{.Site.Theme.Name}}" data-light="{{.Site.Light.Name}}"
+ data-darkid="{{.Site.Theme.ID}}" data-lightid="{{.Site.Light.ID}}">
+ <button type="button" id="themebtn" aria-haspopup="listbox" aria-expanded="false"
+ title="theme — every one installed here (T)">theme</button>
+ <div class="thememenu" id="thememenu" hidden>
+ <input id="themefind" type="search" placeholder="filter themes…" aria-label="filter themes"
+ role="combobox" aria-controls="themelist" aria-autocomplete="list"
+ autocomplete="off" spellcheck="false">
+ <ul id="themelist" role="listbox" aria-label="themes"></ul>
+ <p class="meta hint">↑↓ preview · enter keeps · esc puts it back</p>
+ </div>
+ </div>
+ </footer>
+</nav>
+
+<main>
+{{if .Err}}<p class="err">{{.Err}}</p>{{end}}
+{{if eq .Kind "file"}}{{template "page-file" .}}
+{{else if eq .Kind "notes"}}{{template "page-notes" .}}
+{{else if eq .Kind "note"}}{{template "page-note" .}}
+{{else if eq .Kind "files"}}{{template "page-files" .}}
+{{else if eq .Kind "jj"}}{{template "page-jj" .}}
+{{else if eq .Kind "change"}}{{template "page-change" .}}
+{{else if eq .Kind "session"}}{{template "page-session" .}}
+{{else}}{{template "page-index" .}}{{end}}
+</main>
+
+{{if eq .Kind "file"}}
+<aside aria-label="notes" class="notes-only">
+ <header class="asidehead">
+ <b>Notes (<span id="notecount">{{len .File.Notes}}</span>)</b>
+ {{if .Live}}<span class="meta">click a line to attach</span>{{end}}
+ </header>
+ {{if .Live}}{{template "noteform" .}}{{end}}
+ <div id="notelist">{{range .File.Notes}}{{template "note" (dict "N" . "P" $)}}{{end}}</div>
+ {{if not .File.Notes}}<p class="meta hint">no notes on this file yet</p>{{end}}
+</aside>
+{{end}}
+
+</body>
+</html>