diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-30 17:05:12 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-07-30 17:56:23 -0300 |
| commit | 8ec4e135e318c7799b2576a8729493c063da4a97 (patch) | |
| tree | ab37cdbb7f478eb996264cf941891f127f303c85 /vrsite/templates | |
| parent | cb05c363045bf0e7af5858f6d7bc26f026fa9d70 (diff) | |
| download | notevi-8ec4e135e318c7799b2576a8729493c063da4a97.tar.gz notevi-8ec4e135e318c7799b2576a8729493c063da4a97.zip | |
Diffstat (limited to 'vrsite/templates')
| -rw-r--r-- | vrsite/templates/frag-activity.tmpl | 6 | ||||
| -rw-r--r-- | vrsite/templates/frag-change.tmpl | 41 | ||||
| -rw-r--r-- | vrsite/templates/frag-note.tmpl | 18 | ||||
| -rw-r--r-- | vrsite/templates/layout.tmpl | 5 | ||||
| -rw-r--r-- | vrsite/templates/page-files.tmpl | 4 | ||||
| -rw-r--r-- | vrsite/templates/page-index.tmpl | 10 | ||||
| -rw-r--r-- | vrsite/templates/page-notes.tmpl | 11 | ||||
| -rw-r--r-- | vrsite/templates/page-session.tmpl | 70 |
8 files changed, 149 insertions, 16 deletions
diff --git a/vrsite/templates/frag-activity.tmpl b/vrsite/templates/frag-activity.tmpl index 8c15de7..071c556 100644 --- a/vrsite/templates/frag-activity.tmpl +++ b/vrsite/templates/frag-activity.tmpl @@ -4,7 +4,8 @@ <div class="actlist"> {{range .Sessions}} <div class="act{{if .Live}} on{{end}}" title="{{.Agent}} · {{.Model}} · {{.Dir}}"> - <span class="chip am{{.Bit}}">{{.Short}}</span> + {{if and $.Live .ID}}<a class="chip am{{.Bit}}" href="{{$.Href "session" .ID}}">{{.Short}}</a> + {{else}}<span class="chip am{{.Bit}}">{{.Short}}</span>{{end}} <span class="what">{{.LastOp}}</span> <span class="when">{{.Ago}}</span> </div> @@ -19,7 +20,8 @@ <tr class="{{if .Live}}on{{end}}"> <td><span class="chip am{{.Bit}}">{{.Short}}</span>{{if .Live}}<span class="pulse" title="active">●</span>{{end}}</td> <td>{{.Model}}{{if .Reason}}<span class="meta">/{{.Reason}}</span>{{end}}</td> - <td><code title="{{.ID}}">{{short .ID}}</code></td> + <td>{{if and $.Live .ID}}<a href="{{$.Href "session" .ID}}" title="{{.ID}}"><code>{{short .ID}}</code></a> + {{else}}<code title="{{.ID}}">{{short .ID}}</code>{{end}}</td> <td class="what">{{.LastOp}}</td> <td>{{.Ago}}</td> <td class="meta">{{.Reads}}/{{.Greps}}/{{.Notes}}</td> diff --git a/vrsite/templates/frag-change.tmpl b/vrsite/templates/frag-change.tmpl new file mode 100644 index 0000000..b33d746 --- /dev/null +++ b/vrsite/templates/frag-change.tmpl @@ -0,0 +1,41 @@ +{{/* The change everything on screen is read at, and how wide the view is. + Every page carries it, because every read, note and file listing below + is relative to it. */}} +{{define "changebar"}} +<section class="changebar{{if .Rev}} away{{end}}" aria-label="current change"> + <div class="cid"> + <span class="lbl">change</span> + {{if .Live}}<a href="{{.Href "change" .ChangeID}}" title="{{.ChangeID}}"><code>{{short .ChangeID}}</code></a> + {{else}}<code title="{{.ChangeID}}">{{short .ChangeID}}</code>{{end}} + {{with .ChangeInfo}}{{if .Flags}}<span class="flags">{{.Flags}}</span>{{end}}{{end}} + </div> + {{with .ChangeInfo}} + <p class="desc" title="{{.Desc}}">{{if .Desc}}{{.Desc}}{{else}}(no description){{end}}</p> + {{end}} + + <p class="counts"> + {{if eq .Scope "all"}} + <b>{{.Site.NotesTotal}}</b> notes across every change{{if .Here}} · {{.Here}} here{{end}} + {{else if .ScopeEmpty}} + nothing recorded at this change — showing all <b>{{.Site.NotesTotal}}</b> + {{else}} + <b>{{.Here}}</b> notes here{{if .Elsewhere}} · <span class="away">{{.Elsewhere}} elsewhere</span>{{end}} + {{end}} + </p> + + {{if .Live}} + <div class="scope" role="group" aria-label="what this view covers"> + <a href="{{.ScopeHref "change"}}"{{if eq .Scope "change"}} class="on" aria-current="true"{{end}} + title="only what was recorded at this change">this change</a> + <a href="{{.ScopeHref "all"}}"{{if eq .Scope "all"}} class="on" aria-current="true"{{end}} + title="every change in the log">all</a> + </div> + <form class="revjump" method="get" action="{{.JumpPath}}"> + <input type="search" name="rev" value="{{.Rev}}" placeholder="@, id, revset…" + aria-label="read at another change" autocomplete="off" spellcheck="false"> + {{if eq .Scope "all"}}<input type="hidden" name="scope" value="all">{{end}} + </form> + {{if .Rev}}<p class="back"><a href="{{.BackHref}}">← back to <code>{{short .Default}}</code>, where the log points</a></p>{{end}} + {{end}} +</section> +{{end}} diff --git a/vrsite/templates/frag-note.tmpl b/vrsite/templates/frag-note.tmpl index 56f7a8f..0c3182c 100644 --- a/vrsite/templates/frag-note.tmpl +++ b/vrsite/templates/frag-note.tmpl @@ -1,7 +1,8 @@ -{{define "note"}}{{$n := .N}}{{$p := .P}} -<article class="note am{{$n.Agent.Bit}}" id="note-{{$n.ID}}" +{{define "note"}}{{$n := .N}}{{$p := .P}}{{$away := and $n.Change $p.ChangeID (ne $n.Change $p.ChangeID)}} +<article class="note am{{$n.Agent.Bit}}{{if $away}} away{{end}}" id="note-{{$n.ID}}" data-agent="{{$n.Agent.Name}}" data-model="{{$n.Model}}" data-session="{{$n.Session}}" - data-kind="{{$n.Kind}}" data-file="{{$n.File}}" data-date="{{if not $n.At.IsZero}}{{$n.At.Format "2006-01-02"}}{{end}}"> + data-kind="{{$n.Kind}}" data-file="{{$n.File}}" data-date="{{if not $n.At.IsZero}}{{$n.At.Format "2006-01-02"}}{{end}}" + data-start="{{$n.Start}}" data-end="{{$n.End}}"> <header> {{if $n.File}}<a href="{{$p.NoteHref $n}}" title="{{$n.File}}">{{base $n.File}}{{lines $n}}</a>{{end}} {{if $n.Kind}}<em>{{$n.Kind}}</em>{{end}} @@ -12,7 +13,12 @@ {{if not $n.At.IsZero}}<time datetime="{{$n.At.Format "2006-01-02T15:04:05Z07:00"}}" title="{{$n.Ago}}">{{$n.When}}</time>{{end}} {{if $n.Model}}<span class="model">{{$n.Model}}{{if $n.Reason}}/{{$n.Reason}}{{end}}</span>{{end}} {{if $n.Session}}<code class="sess" title="{{$n.Session}}">{{short $n.Session}}</code>{{end}} - {{if $n.Change}}{{if $p.Live}}<a href="{{$p.Href "change" $n.Change}}"><code>{{short $n.Change}}</code></a>{{else}}<code>{{short $n.Change}}</code>{{end}}{{end}} + {{with $p.ConvHref $n}}<a class="conv" href="{{.}}" title="open the conversation this note was written in">conversation</a>{{end}} + {{if $n.Change}} + {{if $p.Live}}<a class="atchg{{if $away}} away{{end}}" href="{{$p.Href "change" $n.Change}}" + title="{{if $away}}written at another change{{else}}written at this change{{end}}"><code>{{short $n.Change}}</code></a> + {{else}}<code class="atchg{{if $away}} away{{end}}">{{short $n.Change}}</code>{{end}} + {{end}} </footer> </article> {{end}} @@ -30,6 +36,8 @@ hx-on::after-request="if(event.detail.successful){this.reset();{{if eq .Kind "notes"}}htmx.trigger('#notefilters','change');{{end}}}" method="post" action="{{.Href "notes"}}"> <input type="hidden" name="rev" value="{{.Rev}}"> + <input type="hidden" name="change" value="{{.ChangeID}}"> + <input type="hidden" name="scope" value="{{.Scope}}"> <input type="hidden" name="back" value="{{if .File}}{{.Href "code" .File.Path}}{{else}}{{.Href "notes"}}{{end}}"> <div class="row"> {{if .File}} @@ -44,7 +52,7 @@ </div> <textarea name="text" rows="3" placeholder="comment… (⌘/ctrl+enter to post)" required></textarea> <div class="row end"> - <span class="meta">as <b>{{.User}}</b> → the log</span> + <span class="meta">as <b>{{.User}}</b> at <code title="{{.ChangeID}}">{{short .ChangeID}}</code> → the log</span> <button type="submit">add note</button> </div> </form> diff --git a/vrsite/templates/layout.tmpl b/vrsite/templates/layout.tmpl index c3fe250..9bc9ddd 100644 --- a/vrsite/templates/layout.tmpl +++ b/vrsite/templates/layout.tmpl @@ -23,9 +23,7 @@ <button type="button" class="mode" data-mode="notes" title="notes and comments (t)">notes</button> </div> </header> - {{if and .Live .Rev}} - <p class="meta atrev">browsing <a href="{{.Href "change" .ChangeID}}"><code>{{short .ChangeID}}</code></a> · <a href="/">back to @</a></p> - {{end}} + {{template "changebar" .}} {{if .Live}} <div id="activity" class="activity" hx-get="/activity?compact=1" hx-trigger="load, every 3s" hx-swap="innerHTML"></div> {{end}} @@ -52,6 +50,7 @@ {{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> diff --git a/vrsite/templates/page-files.tmpl b/vrsite/templates/page-files.tmpl index 53757ea..3f158fe 100644 --- a/vrsite/templates/page-files.tmpl +++ b/vrsite/templates/page-files.tmpl @@ -2,8 +2,8 @@ <header class="filehead"> <h1>Files</h1> <p class="meta"> - everything at change <code>{{short .ChangeID}}</code> · - <span class="trace-only">traced files carry a coverage bar</span> + everything at change <code title="{{.ChangeID}}">{{short .ChangeID}}</code> · + <span class="trace-only">traced files carry a coverage bar{{if eq .Scope "change"}}, from reads at this change{{end}}</span> <span class="notes-only">◆ marks files with notes</span> </p> </header> diff --git a/vrsite/templates/page-index.tmpl b/vrsite/templates/page-index.tmpl index 2c115cc..bd377ac 100644 --- a/vrsite/templates/page-index.tmpl +++ b/vrsite/templates/page-index.tmpl @@ -2,8 +2,10 @@ <header class="filehead"> <h1>{{.Site.Title}}</h1> <p class="meta"> - {{len .Site.All}} files, {{len .Site.Order}} traced · {{len .Site.Notes}} notes · - change <code>{{short .Site.Change}}</code> · theme {{.Site.Theme.Name}} + {{len .Files}} files at <code title="{{.ChangeID}}">{{short .ChangeID}}</code> · + {{len .Site.Order}} traced, {{len .Site.Notes}} notes + {{if or (eq .Scope "all") .ScopeEmpty}}<span class="away">across every change</span>{{else}}here{{end}} · + theme {{.Site.Theme.Name}} </p> </header> @@ -23,7 +25,9 @@ <tbody> {{range .Site.Agents}} <tr><td><span class="chip am{{.Bit}}">{{.Short}}</span></td> - <td>{{.Model}}</td><td>{{.Reason}}</td><td><code>{{short .Session}}</code></td> + <td>{{.Model}}</td><td>{{.Reason}}</td> + <td>{{if and $.Live .Session}}<a href="{{$.Href "session" .Session}}" title="{{.Session}}"><code>{{short .Session}}</code></a> + {{else}}<code title="{{.Session}}">{{short .Session}}</code>{{end}}</td> <td>{{.Reads}}</td><td>{{.Greps}}</td><td>{{.Notes}}</td></tr> {{end}} </tbody> diff --git a/vrsite/templates/page-notes.tmpl b/vrsite/templates/page-notes.tmpl index 974dc64..242c137 100644 --- a/vrsite/templates/page-notes.tmpl +++ b/vrsite/templates/page-notes.tmpl @@ -7,7 +7,16 @@ <header class="filehead"> <h1>Notes</h1> <p class="meta"> - {{len .Site.Notes}} in the log{{if .Live}} · anything you add here is appended to the log — the repo is never touched{{end}} + {{if eq .Scope "all"}} + all {{.Site.NotesTotal}} in the log, every change + {{else if .ScopeEmpty}} + all {{.Site.NotesTotal}} in the log — nothing was recorded at <code>{{short .ChangeID}}</code> + {{else}} + {{len .Site.Notes}} written at <code title="{{.ChangeID}}">{{short .ChangeID}}</code>{{if .Elsewhere}} · + {{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}} </p> </header> diff --git a/vrsite/templates/page-session.tmpl b/vrsite/templates/page-session.tmpl new file mode 100644 index 0000000..9a35e8d --- /dev/null +++ b/vrsite/templates/page-session.tmpl @@ -0,0 +1,70 @@ +{{/* One session's conversation, with its vr log woven in by time. */}} +{{define "page-session"}} +{{$c := .Conv}} +<header class="filehead"> + <h1> + {{if $c.Agent}}<span class="chip am{{$c.Bit}}">{{$c.Agent}}</span> {{end}} + <code title="{{$c.Session}}">{{short $c.Session}}</code> + </h1> + <p class="meta"> + {{if $c.Model}}{{$c.Model}} · {{end}}{{$c.Reads}} reads · {{$c.Greps}} greps · {{$c.Notes}} notes + {{if $c.Dir}} · <span title="{{$c.Dir}}">{{base $c.Dir}}</span>{{end}} + {{if $c.Harness}} · {{$c.Harness}}{{end}} + </p> + {{if $c.Path}} + <p class="meta"><code>{{$c.Path}}</code></p> + {{else}} + <p class="meta hint">no transcript found for this session — searched + {{if $c.Roots}}{{range $i, $r := $c.Roots}}{{if $i}}, {{end}}<code>{{$r}}</code>{{end}}{{else}}nowhere: <code>-transcripts</code> is empty{{end}} · + showing the vr log alone</p> + {{end}} + {{if $c.Err}}<p class="err">{{$c.Err}}</p>{{end}} +</header> + +<section class="convpage"> + {{if $c.Windowed}} + <p class="meta"> + moments {{$c.From}}–{{$c.To}} of {{$c.Total}}{{if $c.Anchor}}, around the note{{end}} · + {{if $c.Incomplete}}the rest is beyond what one page renders{{else}}<a href="{{$c.AllHref}}">show the whole conversation</a>{{end}} + </p> + {{end}} + + <div class="conv" data-anchor="{{$c.Anchor}}"> + {{range $c.Turns}} + {{if .Note}} + <div class="turn t-note{{if .Here}} here{{end}}"> + <span class="role">note</span><time>{{.Clock}}</time> + {{if .Note.File}} + <div class="notewrap" data-href="{{$.NoteHref .Note}}" tabindex="0" role="link" + title="open this note on the code it is about">{{template "note" (dict "N" .Note "P" $)}}</div> + {{else}} + <div class="notewrap">{{template "note" (dict "N" .Note "P" $)}}</div> + {{end}} + </div> + {{else if eq .Role "vr"}} + <div class="turn t-vr"> + <span class="role">vr</span><time>{{.Clock}}</time> + {{if .File}}<a class="what" href="{{$.Href "code" .File}}">{{.Text}}</a> + {{else}}<span class="what">{{.Text}}</span>{{end}} + </div> + {{else if eq .Role "tool"}} + <div class="turn t-tool"> + <span class="role">{{.Tool}}</span><time>{{.Clock}}</time> + <code class="what">{{.Detail}}</code> + </div> + {{else if eq .Role "result"}} + <div class="turn t-result{{if eq .Kind "error"}} bad{{end}}"> + <span class="role">→{{if .Tool}} {{.Tool}}{{end}}</span><time></time> + <code class="what">{{.Detail}}</code> + </div> + {{else}} + <div class="turn t-say t-{{.Role}}"> + <span class="role">{{.Role}}</span><time>{{.Clock}}</time> + <p>{{.Text}}</p> + </div> + {{end}} + {{end}} + {{if not $c.Turns}}<p class="meta hint">nothing recorded for this session</p>{{end}} + </div> +</section> +{{end}} |
