summaryrefslogtreecommitdiff
path: root/vrsite/templates
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-02 12:36:54 -0300
committerGabriel Schneider <[email protected]>2026-08-02 17:37:58 -0300
commite16f78b255bcf46d8c6f9a4b9e76dd7a3817edeb (patch)
treede0db0c369522b5bf92ff32a8351de2224c5c9dc /vrsite/templates
parent151ea12251ed876aa87bb486da1bc337e25369e9 (diff)
downloadnotevi-e16f78b255bcf46d8c6f9a4b9e76dd7a3817edeb.tar.gz
notevi-e16f78b255bcf46d8c6f9a4b9e76dd7a3817edeb.zip
Diffstat (limited to 'vrsite/templates')
-rw-r--r--vrsite/templates/frag-jj.tmpl8
-rw-r--r--vrsite/templates/layout.tmpl3
-rw-r--r--vrsite/templates/page-change.tmpl5
-rw-r--r--vrsite/templates/page-index.tmpl2
-rw-r--r--vrsite/templates/page-jj.tmpl4
-rw-r--r--vrsite/templates/page-notes.tmpl4
-rw-r--r--vrsite/templates/projects.tmpl112
7 files changed, 126 insertions, 12 deletions
diff --git a/vrsite/templates/frag-jj.tmpl b/vrsite/templates/frag-jj.tmpl
index b31af53..61040dc 100644
--- a/vrsite/templates/frag-jj.tmpl
+++ b/vrsite/templates/frag-jj.tmpl
@@ -8,7 +8,7 @@
{{else if .Op}}
<div class="jjrow">
<span class="graph">{{.Graph}}</span>
- <a class="id" href="/jj?at_op={{.ID}}" title="run the commit log as of this operation">{{.Short}}</a>
+ <a class="id" href="{{$.Root}}jj?at_op={{.ID}}" title="run the commit log as of this operation">{{.Short}}</a>
<span class="when">{{.When}}</span>
<span class="who">{{.Author}}</span>
<span class="desc">{{.Desc}}</span>
@@ -17,17 +17,17 @@
{{else}}
<div class="jjrow">
<span class="graph">{{.Graph}}</span>
- <a class="id" href="/change/{{.ID}}" title="{{.ID}}">{{.Short}}</a>
+ <a class="id" href="{{$.Root}}change/{{.ID}}" title="{{.ID}}">{{.Short}}</a>
<code class="commit">{{.CommitShort}}</code>
<span class="when">{{.When}}</span>
<span class="who">{{.Author}}</span>
{{if .Refs}}<span class="refs">{{.Refs}}</span>{{end}}
{{if .Flags}}<span class="flags">{{.Flags}}</span>{{end}}
- <a class="desc" href="/files?rev={{.ID}}" title="browse the tree at this change">{{if .Desc}}{{.Desc}}{{else}}(no description){{end}}</a>
+ <a class="desc" href="{{$.Root}}files?rev={{.ID}}" title="browse the tree at this change">{{if .Desc}}{{.Desc}}{{else}}(no description){{end}}</a>
</div>
{{end}}
{{end}}
</div>
{{else if not .Err}}<p class="meta hint">no revisions matched</p>{{end}}
-{{if .AtOp}}<p class="meta">as of operation <code>{{short .AtOp}}</code> · <a href="/jj?kind=op">back to the op log</a></p>{{end}}
+{{if .AtOp}}<p class="meta">as of operation <code>{{short .AtOp}}</code> · <a href="{{.Root}}jj?kind=op">back to the op log</a></p>{{end}}
{{end}}
diff --git a/vrsite/templates/layout.tmpl b/vrsite/templates/layout.tmpl
index 268b5b6..e83730a 100644
--- a/vrsite/templates/layout.tmpl
+++ b/vrsite/templates/layout.tmpl
@@ -33,12 +33,13 @@
</header>
{{template "changebar" .}}
{{if .Live}}
- <div id="activity" class="activity" hx-get="/activity?compact=1" hx-trigger="load, every 3s" hx-swap="innerHTML"></div>
+ <div id="activity" class="activity" hx-get="{{.Href "activity"}}?compact=1" hx-trigger="load, every 3s" hx-swap="innerHTML"></div>
{{end}}
<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>
<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}}
diff --git a/vrsite/templates/page-change.tmpl b/vrsite/templates/page-change.tmpl
index 08310e5..8641da7 100644
--- a/vrsite/templates/page-change.tmpl
+++ b/vrsite/templates/page-change.tmpl
@@ -1,5 +1,6 @@
{{define "page-change"}}
{{$c := .Change}}
+{{$p := .}}
<header class="filehead">
<h1>{{$c.Row.Short}} <span class="meta">{{$c.Row.Flags}}</span></h1>
<p class="meta">
@@ -14,7 +15,7 @@
{{if $c.Parents}}
<p class="meta">parents:
- {{range $c.Parents}}<a href="/change/{{.ID}}"><code>{{.Short}}</code></a> {{.Desc}} {{end}}
+ {{range $c.Parents}}<a href="{{$p.Href "change" .ID}}"><code>{{.Short}}</code></a> {{.Desc}} {{end}}
</p>
{{end}}
@@ -24,7 +25,7 @@
<tbody>
{{range $c.Files}}
<tr><td class="st st-{{.Status}}">{{.Status}}</td>
- <td><a href="/code/{{.Path}}?rev={{$c.Row.ID}}">{{.Path}}</a></td></tr>
+ <td><a href="{{$p.Href "code" .Path}}">{{.Path}}</a></td></tr>
{{end}}
</tbody>
</table>
diff --git a/vrsite/templates/page-index.tmpl b/vrsite/templates/page-index.tmpl
index bd377ac..93cad6b 100644
--- a/vrsite/templates/page-index.tmpl
+++ b/vrsite/templates/page-index.tmpl
@@ -12,7 +12,7 @@
{{if .Live}}
<section>
<h2>Live <span class="meta">— agents reading this codebase</span></h2>
- <div id="activity-full" hx-get="/activity" hx-trigger="load, every 3s" hx-swap="innerHTML">
+ <div id="activity-full" hx-get="{{.Href "activity"}}" hx-trigger="load, every 3s" hx-swap="innerHTML">
<p class="meta hint">…</p>
</div>
</section>
diff --git a/vrsite/templates/page-jj.tmpl b/vrsite/templates/page-jj.tmpl
index 5c1381c..24df596 100644
--- a/vrsite/templates/page-jj.tmpl
+++ b/vrsite/templates/page-jj.tmpl
@@ -8,12 +8,12 @@
<section class="jjpage">
<form class="jjform" method="get" action="{{.Href "jj"}}"
- hx-get="/jj/log" hx-target="#jjout" hx-swap="innerHTML" hx-indicator="#jjbusy">
+ hx-get="{{.Href "jj-log"}}" hx-target="#jjout" hx-swap="innerHTML" hx-indicator="#jjbusy">
<input type="hidden" name="kind" value="log">
<input type="search" name="revset" value="{{.JJ.Revset}}" placeholder="revset — e.g. @ | ancestors(trunk(), 10) | description(glob:'*fix*')" autocomplete="off" spellcheck="false">
<input type="number" name="limit" value="{{.JJ.Limit}}" min="1" max="1000" aria-label="limit" title="limit">
<button type="submit">jj log</button>
- <button type="button" hx-get="/jj/op" hx-target="#jjout" hx-include="closest form" hx-indicator="#jjbusy" title="operation log">op log</button>
+ <button type="button" hx-get="{{.Href "jj-op"}}" hx-target="#jjout" hx-include="closest form" hx-indicator="#jjbusy" title="operation log">op log</button>
<span id="jjbusy" class="busy">·</span>
</form>
<p class="meta hint">
diff --git a/vrsite/templates/page-notes.tmpl b/vrsite/templates/page-notes.tmpl
index 242c137..ebd5865 100644
--- a/vrsite/templates/page-notes.tmpl
+++ b/vrsite/templates/page-notes.tmpl
@@ -16,7 +16,7 @@
{{if .Live}}<a href="{{.ScopeHref "all"}}">{{.Elsewhere}} more at other changes</a>
{{else}}{{.Elsewhere}} more at other changes are not in this export{{end}}{{end}}
{{end}}
- {{if .Live}} · anything you add here is appended to the log at this change — the repo is never touched{{end}}
+ {{if .Live}} · anything you add here is appended to the private log sidecar at this change — the project working copy is never touched{{end}}
</p>
</header>
@@ -29,7 +29,7 @@
{{end}}
<form class="filters" id="notefilters" method="get" action="{{.Href "notes"}}"
- {{if .Live}}hx-get="/notes/list" hx-target="#notelist" hx-swap="innerHTML"
+ {{if .Live}}hx-get="{{.Href "notes-list"}}" hx-target="#notelist" hx-swap="innerHTML"
hx-trigger="input delay:250ms, change, search" hx-indicator="#notesbusy"{{end}}>
<input type="search" name="text" value="{{.Filter.Text}}" placeholder="search note text…" autocomplete="off">
<input type="search" name="file" value="{{.Filter.File}}" placeholder="file path…" list="filelist" autocomplete="off">
diff --git a/vrsite/templates/projects.tmpl b/vrsite/templates/projects.tmpl
new file mode 100644
index 0000000..3e3c670
--- /dev/null
+++ b/vrsite/templates/projects.tmpl
@@ -0,0 +1,112 @@
+{{define "projects"}}<!doctype html>
+<html lang="en" data-live="1">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>{{.Title}}</title>
+<link rel="stylesheet" href="/style.css">
+<script>
+// Match project pages: wear the saved theme before first paint, and load the
+// installed-theme stylesheet now only when that saved choice requires it.
+{const d = document.documentElement, t = localStorage.getItem("vrsite-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 = "/themes.css";
+ document.head.append(l);
+ }
+ d.dataset.mode = localStorage.getItem("vrsite-mode") || "trace";}
+</script>
+<script src="/app.js" defer></script>
+</head>
+<body class="projects">
+<nav aria-label="projects" id="nav">
+ <header><a class="brand" href="/">{{.Title}}</a></header>
+ <p class="meta">one process · every local vr sidecar</p>
+ <input id="projectfind" class="find" type="search" placeholder="find project…" aria-label="find project" autocomplete="off" spellcheck="false">
+ <form method="post" action="/projects/refresh" class="project-refresh">
+ <button type="submit">refresh repositories</button>
+ </form>
+ <p class="meta">scans <code>{{.ScanRoot}}</code></p>
+ <p class="meta">last refresh {{.Scanned}}</p>
+ <footer>
+ <span>selection and scan results stay in memory</span>
+ <div class="themepick" id="themepick"
+ data-js="/themes.js" data-css="/themes.css"
+ data-dark="{{.Theme.Name}}" data-light="{{.Light.Name}}"
+ data-darkid="{{.Theme.ID}}" data-lightid="{{.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 class="projects-main">
+ <header class="filehead">
+ <h1>Projects</h1>
+ <p class="meta">Choose a vr log, start one in a jj repository, or colocate jj with an existing Git repository.</p>
+ </header>
+ {{if .Message}}<p class="ok project-message">{{.Message}}</p>{{end}}
+ {{if .Err}}<p class="err project-message">{{.Err}}</p>{{end}}
+
+ <section>
+ <h2>Logs <span class="meta">— {{len .Active}} repositories with a private sidecar</span></h2>
+ <div class="project-grid">
+ {{range .Active}}
+ <article class="project-card" data-project="{{.Name}} {{.Relative}}">
+ <header><h3><a href="/p/{{.ID}}/">{{.Name}}</a></h3><span class="project-state active">log</span></header>
+ <p class="project-path" title="{{.Path}}"><code>{{.Relative}}</code></p>
+ <p class="meta">{{.Entries}} entries · {{.Notes}} notes · {{.Agents}} agents · {{.Updated}}</p>
+ {{if gt (len .Workspaces) 1}}<p class="meta">{{len .Workspaces}} jj workspaces share this log</p>{{end}}
+ {{if .Err}}<p class="err">{{.Err}}</p>{{end}}
+ <a class="project-action" href="/p/{{.ID}}/">open project</a>
+ </article>
+ {{end}}
+ {{if not .Active}}<p class="meta hint">no vr sidecars found yet</p>{{end}}
+ </div>
+ </section>
+
+ <section>
+ <h2>Ready to start <span class="meta">— {{len .Ready}} jj repositories without a vr sidecar</span></h2>
+ <div class="project-grid">
+ {{range .Ready}}
+ <article class="project-card" data-project="{{.Name}} {{.Relative}}">
+ <header><h3>{{.Name}}</h3><span class="project-state">jj</span></header>
+ <p class="project-path" title="{{.Path}}"><code>{{.Relative}}</code></p>
+ {{if gt (len .Workspaces) 1}}<p class="meta">{{len .Workspaces}} workspaces</p>{{end}}
+ {{if .Err}}<p class="err">{{.Err}}</p>{{end}}
+ <form method="post" action="/projects/{{.ID}}/start">
+ <button type="submit">start private sidecar</button>
+ </form>
+ </article>
+ {{end}}
+ {{if not .Ready}}<p class="meta hint">every detected jj repository already has a sidecar</p>{{end}}
+ </div>
+ </section>
+
+ <section>
+ <h2>Git repositories <span class="meta">— {{len .Git}} without jj metadata</span></h2>
+ <p class="meta">Initializing adds colocated <code>.jj</code> metadata; it does not create a sidecar until you choose “start private sidecar”.</p>
+ <div class="project-grid">
+ {{range .Git}}
+ <article class="project-card" data-project="{{.Name}} {{.Relative}}">
+ <header><h3>{{.Name}}</h3><span class="project-state git">git</span></header>
+ <p class="project-path" title="{{.Path}}"><code>{{.Relative}}</code></p>
+ <form method="post" action="/git/{{.ID}}/init">
+ <button type="submit">initialize colocated jj</button>
+ </form>
+ </article>
+ {{end}}
+ {{if not .Git}}<p class="meta hint">no Git-only repositories detected</p>{{end}}
+ </div>
+ </section>
+</main>
+</body>
+</html>{{end}}