~bigbes/sr-ht-dolt

ref: 8dfe078bcda61dc7ec82d607468747771d9dfa41 sr-ht-dolt/web/templates/beads.html -rw-r--r-- 27.7 KiB
8dfe078b — Eugene Blikh beads: report a clipped read from the remaining projections 5 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
{{define "content" -}}
<style>
/* Scoped beads styles — inlined because the scss bundle is not rebuilt in dev.
   The look deliberately mimics todo.sr.ht (sourcehut's own issue tracker): flat
   and square (no radius, no shadows, no gradients), hairline gray borders,
   monospace ids, and squared bordered labels. Colours come from CSS variables
   that mirror core.sr.ht's Bootstrap palette for the light default and the
   prefers-color-scheme: dark variant sourcehut ships, so the view inherits the
   host theme. The Mardi Gras lanes survive only as muted accent swatches and a
   2px lane cap — never saturated fills — so it reads as sourcehut, not a
   separate app. */
.beads {
  --lane-rolling: #c9930a; --lane-linedup: #2f9e44;
  --lane-stalled: #9c36b5; --lane-past: #868e96;
  --bd-bg: #ffffff; --bd-panel: #f2f3f5; --bd-fg: #212529;
  --bd-muted: #6c757d; --bd-border: #ced4da; --bd-stripe: rgba(0,0,0,.05);
  --bd-danger: #b52a2a;
}
@media (prefers-color-scheme: dark) {
  .beads {
    --bd-bg: #212529; --bd-panel: #343a40; --bd-fg: #dee2e6;
    --bd-muted: #adb5bd; --bd-border: #6c757d; --bd-stripe: rgba(255,255,255,.05);
    --bd-danger: #ff6b6b;
  }
}
.beads .rolling    { --lane: var(--lane-rolling); }
.beads .lined-up   { --lane: var(--lane-linedup); }
.beads .stalled    { --lane: var(--lane-stalled); }
.beads .past-stand { --lane: var(--lane-past); }
.beads .total      { --lane: var(--bd-muted); }

/* freshness line (the shared "beadsHead" partial): one quiet row under the
   title, muted and small — it qualifies the page, it does not announce
   anything. */
.beads .beads-freshness { font-size: .78rem; color: var(--bd-muted); margin: -.35rem 0 .7rem; }
.beads .beads-freshness a { color: var(--bd-muted); }
.beads .beads-freshness code { font-size: .72rem; color: inherit; }

/* a small square colour chip standing in for the lane's Mardi Gras hue */
.beads .swatch {
  display: inline-block; width: .7rem; height: .7rem; flex: 0 0 auto;
  background: var(--lane); border: 1px solid rgba(0,0,0,.25); vertical-align: -1px;
}

/* summary: one flat hairline-bordered strip, cells divided by hairlines */
/* filter bar: flat, hairline-bordered controls in the todo.sr.ht idiom */
.beads-filter { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: 1rem; }
.beads-filter input, .beads-filter select, .beads-filter button {
  font: inherit; font-size: .82rem; padding: .25rem .45rem; color: var(--bd-fg);
  background: var(--bd-bg); border: 1px solid var(--bd-border); border-radius: 0;
}
.beads-filter input[type="search"] { min-width: 12rem; flex: 1 1 12rem; }
.beads-filter button { background: var(--bd-panel); cursor: pointer; }
.beads-filter .beads-filter-clear { font-size: .82rem; color: var(--bd-muted); align-self: center; }
.beads-ready-toggle { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--bd-fg); }
.ready-dot { margin-right: .25rem; }

/* layout toggle: the same page in two shapes, so it is a pair of words and not
   a tab — the current one is plain text, the other one a link */
.beads-layout { display: flex; gap: .35rem; align-items: baseline; font-size: .82rem; margin: -.5rem 0 1rem; }
.beads-layout .l { color: var(--bd-muted); }
.beads-layout .sep { color: var(--bd-muted); }
.beads-layout .current { color: var(--bd-fg); font-weight: 700; }

/* transitive dependency tree: indent by --depth via a hairline guide */
.dep-graph { margin: 0 0 1.25rem; }
.dep-tree { list-style: none; padding-left: 0; margin: 0 0 .5rem; }
.dep-tree .dep-node {
  padding: .18rem 0 .18rem calc(var(--depth, 0) * 1.1rem + .1rem);
  border-top: 1px solid var(--bd-border);
}
.dep-tree .dep-node:first-child { border-top: none; }
.dep-tree code { font-size: .8rem; }

.beads-summary { display: flex; flex-wrap: wrap; border: 1px solid var(--bd-border); margin-bottom: 1rem; }
.beads-summary .stat {
  flex: 1 1 7rem; min-width: 6.5rem; padding: .35rem .6rem;
  border-left: 1px solid var(--bd-border);
}
.beads-summary .stat:first-child { border-left: none; }
.beads-summary .stat .n { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.beads-summary .stat .l { display: flex; align-items: center; gap: .35rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bd-muted); }

/* lanes: flat squared columns with a 2px accent cap */
.beads-lanes { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: flex-start; }
.beads-lane { flex: 1 0 15rem; min-width: 15rem; }
.beads-lane .lane-head {
  display: flex; align-items: center; gap: .4rem; padding: .3rem .5rem; font-weight: 700;
  background: var(--bd-panel); color: var(--bd-fg);
  border: 1px solid var(--bd-border); border-top: 2px solid var(--lane);
}
.beads-lane .lane-head .count { margin-left: auto; color: var(--bd-muted); font-weight: 400; font-size: .85rem; }
.beads-lane .lane-body { border: 1px solid var(--bd-border); border-top: none; }

/* stream: the same lanes stacked as one readable column. The heads are the lane
   heads (2px accent cap, swatch, count) made sticky, so the section a row
   belongs to stays named while its issues scroll past. */
.beads-stream { max-width: 52rem; }
.beads-stream .beads-section { margin-bottom: .75rem; }
.beads-stream .stream-head {
  display: flex; align-items: baseline; gap: .4rem; padding: .3rem .5rem; font-weight: 700;
  background: var(--bd-panel); color: var(--bd-fg);
  border: 1px solid var(--bd-border); border-top: 2px solid var(--lane);
  position: sticky; top: 0;
}
/* A flex summary drops the browser's disclosure marker, and a collapsed section
   with no affordance reads as an empty one — so draw the triangle back. */
.beads-stream summary.stream-head { cursor: pointer; list-style: none; }
.beads-stream summary.stream-head::-webkit-details-marker { display: none; }
.beads-stream summary.stream-head::before { content: "\25B8"; color: var(--bd-muted); }
.beads-stream details[open] > summary.stream-head::before { content: "\25BE"; }
.beads-stream .stream-head .swatch { align-self: center; }
.beads-stream .stream-head .note { color: var(--bd-muted); font-weight: 400; font-size: .72rem; }
.beads-stream .stream-head .count { margin-left: auto; color: var(--bd-muted); font-weight: 400; font-size: .85rem; }
.beads-stream .stream-body { border: 1px solid var(--bd-border); border-top: none; }

/* issue rows: todo.sr.ht ticket-list feel — hairline separated, no radius */
.bead-row { display: block; padding: .3rem .5rem; text-decoration: none; color: var(--bd-fg); border-top: 1px solid var(--bd-border); }
.bead-row:first-child { border-top: none; }
.bead-row:hover { background: var(--bd-stripe); text-decoration: none; color: var(--bd-fg); }
.bead-row .r-id { font-family: monospace; font-size: .72rem; color: var(--bd-muted); }
.bead-row .r-title { display: block; margin: .05rem 0 .2rem; color: var(--bd-fg); }
.bead-row .r-meta { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.beads-empty { color: var(--bd-muted); font-size: .8rem; font-style: italic; padding: .35rem .5rem; }

/* labels: sourcehut .label — squared, hairline-bordered, transparent */
.blabel {
  display: inline-block; font-size: .7rem; line-height: 1.5; padding: 0 .3rem; white-space: nowrap;
  border: 1px solid var(--bd-border); background: transparent; color: var(--bd-fg);
}
.blabel.prio { border-color: var(--lane-rolling); color: var(--bd-fg); font-weight: 700; }
.blabel.assignee { border-color: var(--lane-linedup); }
.blabel.block { border-color: var(--bd-danger); color: var(--bd-danger); }
.blabel.muted { color: var(--bd-muted); }

/* detail pane */
.bead-detail .ticket-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin: 0 0 .5rem; }
.bead-detail .ticket-title code { font-size: 1.1rem; }
.bead-detail .lane-label { border: 1px solid var(--lane); color: var(--bd-fg); padding: 0 .4rem; font-size: .75rem; }
.bead-detail .lane-label .swatch { margin-right: .3rem; }
.bead-detail .field-label { color: var(--bd-muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.bead-detail table td.field-label { white-space: nowrap; width: 9rem; vertical-align: middle; }
pre.field-body {
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bd-panel);
  border: 1px solid var(--bd-border); color: var(--bd-fg); padding: .5rem; margin: .25rem 0 1rem;
}
/* copy-ready bd commands: the page shows work and cannot change it — a write
   path would mean the SQL engine, a working set, a commit and a push, the
   dependency this build is deliberately free of — so it hands over the command
   instead. One quiet block in the same flat, square, hairline idiom as the rest,
   not a call-to-action panel. `user-select: all` per line makes one click select
   one whole command, which is why no JavaScript and no clipboard API is
   involved. */
.bead-detail .bead-commands {
  background: var(--bd-panel); border: 1px solid var(--bd-border);
  padding: .3rem .5rem; margin: 0 0 1rem; max-width: 34rem;
}
.bead-detail .bead-commands .cmd {
  display: block; font-family: monospace; font-size: .78rem; line-height: 1.6;
  color: var(--bd-fg); -webkit-user-select: all; user-select: all;
}
.bead-deplist { list-style: none; padding-left: 0; margin-bottom: 0; }
.bead-deplist li { padding: .2rem 0; border-top: 1px solid var(--bd-border); }
.bead-deplist li:first-child { border-top: none; }
.bead-deplist code { font-size: .8rem; }
.bead-comment { border: 1px solid var(--bd-border); border-left: 2px solid var(--lane-linedup); padding: .4rem .6rem; margin-bottom: .5rem; }
.bead-comment .c-head { font-size: .8rem; color: var(--bd-muted); margin-bottom: .2rem; }
.bead-comment .c-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--bd-fg); }

/* epic: badge, subtask rollup, progress meter */
.epic-badge { border-color: var(--lane-stalled); color: var(--bd-fg); text-transform: uppercase; letter-spacing: .04em; }
.epic-subtasks { margin-bottom: 1.25rem; }
.epic-progress { height: 6px; background: var(--bd-panel); border: 1px solid var(--bd-border); margin: .1rem 0 .6rem; }
.epic-progress-bar { height: 100%; background: var(--lane-linedup); }
.subtask-list li { padding: .3rem 0; }
/* a thin status accent on the left cap of each subtask row */
.subtask-list li.subtask { border-left: 2px solid var(--bd-border); padding-left: .5rem; }
.subtask-list li.subtask.in_progress { border-left-color: var(--lane-rolling); }
.subtask-list li.subtask.closed { border-left-color: var(--lane-past); }
.subtask-list li.subtask.closed a code { text-decoration: line-through; }

/* activity: Comments | History tabs (pure-CSS radio switch, no JS) */
.bead-activity .acttab-radio { position: absolute; opacity: 0; pointer-events: none; }
.acttabs { display: flex; gap: 0; border-bottom: 1px solid var(--bd-border); margin-bottom: .75rem; }
.acttabs label {
  padding: .35rem .85rem; cursor: pointer; color: var(--bd-muted);
  border: 1px solid transparent; border-bottom: none; margin-bottom: -1px;
}
#acttab-comments:checked ~ .acttabs label[for="acttab-comments"],
#acttab-history:checked ~ .acttabs label[for="acttab-history"] {
  color: var(--bd-fg); background: var(--bd-panel);
  border-color: var(--bd-border); border-bottom: 1px solid var(--bd-panel);
}
.bead-activity .actpanel { display: none; }
#acttab-comments:checked ~ .panel-comments { display: block; }
#acttab-history:checked ~ .panel-history { display: block; }

.bead-timeline { list-style: none; padding-left: 0; margin: 0; border-left: 2px solid var(--bd-border); }
.bead-timeline .tl-item { position: relative; padding: .2rem 0 .5rem .8rem; }
.bead-timeline .tl-item::before {
  content: ""; position: absolute; left: -5px; top: .5rem;
  width: 8px; height: 8px; background: var(--bd-muted); border: 1px solid var(--bd-bg);
}
.bead-timeline .tl-comment::before { background: var(--lane-linedup); }
.bead-timeline .tl-dep::before { background: var(--lane-stalled); }
.bead-timeline .tl-head { font-size: .85rem; color: var(--bd-fg); }
.bead-timeline .tl-when { color: var(--bd-muted); }
.bead-timeline .tl-body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--bd-fg); margin-top: .15rem; padding-left: .1rem; }
</style>

<div class="beads">
<h2><a href="/~{{.Repo.OwnerName}}/{{.Repo.Name}}">~{{.Repo.OwnerName}}/{{.Repo.Name}}</a> &middot; parade</h2>
{{template "beadsHead" (dict "Repo" .Repo "Ref" .Ref "Head" .Head)}}
{{template "viewtabs" (dict "Repo" .Repo "Views" .Views "Current" "beads" "Ref" .Ref)}}

{{if or (eq .Data.Mode "detail") (eq .Data.Mode "epic")}}
{{/* ------------- detail / epic pane ------------- */}}
<p><a href="/~{{.Repo.OwnerName}}/{{.Repo.Name}}/view/beads">&larr; Back to the parade</a></p>
{{with .Data.Issue}}
<div class="bead-detail">
  <h2 class="ticket-title">
    <code>{{.ID}}</code> <span>{{.Title}}</span>
    {{if eq $.Data.Mode "epic"}}<span class="blabel epic-badge">epic</span>{{end}}
    <span class="lane-label" style="--lane: {{.Accent}};"><span class="swatch"></span>{{.Lane}}</span>
  </h2>
  <div class="r-meta mb-3">
    <span class="blabel muted">status: {{.Status}}</span>
    {{if .Priority}}<span class="blabel prio">P{{.Priority}}</span>{{end}}
    {{if .IssueType}}<span class="blabel">{{.IssueType}}</span>{{end}}
    {{if .Assignee}}<span class="blabel assignee">@{{.Assignee}}</span>{{end}}
    {{range .Labels}}<span class="blabel muted">{{.}}</span>{{end}}
  </div>
  {{/* The command this page cannot run for you. Which ones are offered follows
       the issue's status through the lane the detail pane already derived from
       it (Rolling = in progress, Past Stand = closed, Lined Up = open), so there
       is no second status vocabulary here — and nothing is offered that bd would
       refuse. The command names the issue and nothing about paths: this service
       does not know where the tracker is checked out, and the database name is
       in the breadcrumb if the reader needs to pick a directory. */}}
  <div class="bead-commands" role="group" aria-label="bd commands for this issue">
    {{if eq .Lane "Rolling"}}
    <code class="cmd">bd close {{.ID}}</code>
    <code class="cmd">bd update {{.ID}} --status=open</code>
    {{else if eq .Lane "Past Stand"}}
    <code class="cmd">bd reopen {{.ID}}</code>
    {{else}}
    <code class="cmd">bd update {{.ID}} --claim</code>
    <code class="cmd">bd close {{.ID}}</code>
    {{end}}
  </div>
  <table class="table table-sm">
    <tbody>
      {{if .CreatedBy}}<tr><td class="field-label">Created by</td><td>{{.CreatedBy}}</td></tr>{{end}}
      {{if .Owner}}<tr><td class="field-label">Owner</td><td>{{.Owner}}</td></tr>{{end}}
      {{if .EstimatedMinutes}}<tr><td class="field-label">Estimate</td><td>{{.EstimatedMinutes}} min</td></tr>{{end}}
      {{if .ExternalRef}}<tr><td class="field-label">External ref</td><td>{{.ExternalRef}}</td></tr>{{end}}
      {{if .SpecID}}<tr><td class="field-label">Spec</td><td>{{.SpecID}}</td></tr>{{end}}
      {{if .CreatedAt}}<tr><td class="field-label">Created</td><td>{{.CreatedAt}}</td></tr>{{end}}
      {{if .StartedAt}}<tr><td class="field-label">Started</td><td>{{.StartedAt}}</td></tr>{{end}}
      {{if .UpdatedAt}}<tr><td class="field-label">Updated</td><td>{{.UpdatedAt}}</td></tr>{{end}}
      {{if .ClosedAt}}<tr><td class="field-label">Closed</td><td>{{.ClosedAt}}</td></tr>{{end}}
    </tbody>
  </table>
  {{/* The long-text bodies go through $.Links, which escapes the stored text and
       then wraps the issue ids it recognises in links to the database that owns
       them. An id whose prefix belongs to no database this viewer may browse is
       left as the text it is. */}}
  {{if .Description}}<div class="field-label">Description</div><pre class="field-body">{{$.Links.Text .Description}}</pre>{{end}}
  {{if .Design}}<div class="field-label">Design</div><pre class="field-body">{{$.Links.Text .Design}}</pre>{{end}}
  {{if .AcceptanceCriteria}}<div class="field-label">Acceptance criteria</div><pre class="field-body">{{$.Links.Text .AcceptanceCriteria}}</pre>{{end}}
  {{if .Notes}}<div class="field-label">Notes</div><pre class="field-body">{{$.Links.Text .Notes}}</pre>{{end}}
</div>

{{if eq $.Data.Mode "epic"}}
<div class="epic-subtasks">
  <h4>Subtasks{{if $.Data.SubtaskTotal}} <small class="text-muted">{{$.Data.SubtaskDone}} of {{$.Data.SubtaskTotal}} done</small>{{end}}</h4>
  {{if $.Data.SubtaskTotal}}
  <div class="epic-progress" title="{{$.Data.SubtaskPct}}% complete">
    <div class="epic-progress-bar" style="width: {{$.Data.SubtaskPct}}%"></div>
  </div>
  <ul class="bead-deplist subtask-list">
    {{range $.Data.Subtasks}}
    <li class="subtask {{.Category}}">
      <a href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/view/beads?issue={{.ID | urlquery}}"><code>{{.ID}}</code></a>
      {{if .Title}}— {{.Title}}{{end}}
      {{if .PriorityLabel}}<span class="blabel prio">{{.PriorityLabel}}</span>{{end}}
      <span class="blabel muted">{{.Status}}</span>
      {{if .Assignee}}<span class="blabel assignee">@{{.Assignee}}</span>{{end}}
      {{if .Blocked}}<span class="blabel block">&#128679;</span>{{end}}
    </li>
    {{end}}
  </ul>
  {{else}}<p class="beads-empty">No subtasks linked to this epic.</p>{{end}}
</div>
{{end}}

<div class="row">
  <div class="col-md-6">
    <h4>Depends on</h4>
    {{if $.Data.DependsOn}}
    <ul class="bead-deplist">
      {{range $.Data.DependsOn}}
      <li>
        <a href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/view/beads?issue={{.IssueID | urlquery}}"><code>{{.IssueID}}</code></a>
        {{if .Title}}— {{.Title}}{{end}}
        <span class="blabel muted">{{.Type}}</span>
        {{if .Closed}}<span class="blabel muted">closed</span>{{else}}<span class="blabel block">{{.Status}}</span>{{end}}
      </li>
      {{end}}
    </ul>
    {{else}}<p class="beads-empty">No outgoing dependencies.</p>{{end}}
  </div>
  <div class="col-md-6">
    <h4>Depended on by</h4>
    {{if $.Data.DependedOnBy}}
    <ul class="bead-deplist">
      {{range $.Data.DependedOnBy}}
      <li>
        <a href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/view/beads?issue={{.IssueID | urlquery}}"><code>{{.IssueID}}</code></a>
        {{if .Title}}— {{.Title}}{{end}}
        <span class="blabel muted">{{.Type}}</span>
      </li>
      {{end}}
    </ul>
    {{else}}<p class="beads-empty">Nothing depends on this issue.</p>{{end}}
  </div>
</div>

{{if or $.Data.DependsTree $.Data.DependentTree}}
<div class="dep-graph">
  {{if $.Data.DependsTree}}
  <h4>Prerequisite chain <small class="text-muted">— everything this waits on, transitively</small></h4>
  <ul class="dep-tree">
    {{range $.Data.DependsTree}}
    <li class="dep-node" style="--depth: {{.Depth}}">
      <a href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/view/beads?issue={{.ID | urlquery}}"><code>{{.ID}}</code></a>
      {{if .Title}}— {{.Title}}{{end}}
      <span class="blabel muted">{{.Type}}</span>
      {{if .Closed}}<span class="blabel muted">closed</span>{{else}}<span class="blabel block">{{.Status}}</span>{{end}}
    </li>
    {{end}}
  </ul>
  {{end}}
  {{if $.Data.DependentTree}}
  <h4>Unblocks <small class="text-muted">— everything waiting on this, transitively</small></h4>
  <ul class="dep-tree">
    {{range $.Data.DependentTree}}
    <li class="dep-node" style="--depth: {{.Depth}}">
      <a href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/view/beads?issue={{.ID | urlquery}}"><code>{{.ID}}</code></a>
      {{if .Title}}— {{.Title}}{{end}}
      <span class="blabel muted">{{.Type}}</span>
      {{if .Closed}}<span class="blabel muted">closed</span>{{else}}<span class="blabel block">{{.Status}}</span>{{end}}
    </li>
    {{end}}
  </ul>
  {{end}}
</div>
{{end}}

<div class="bead-activity">
  <input type="radio" name="acttab" id="acttab-comments" class="acttab-radio" checked>
  <input type="radio" name="acttab" id="acttab-history" class="acttab-radio">
  <div class="acttabs">
    <label for="acttab-comments">Comments</label>
    <label for="acttab-history">History</label>
  </div>

  <div class="actpanel panel-comments">
    {{if $.Data.Comments}}
    {{range $.Data.Comments}}
    <div class="bead-comment">
      <div class="c-head"><strong>{{.Author}}</strong> {{if .CreatedAt}}&middot; {{.CreatedAt}}{{end}}</div>
      <div class="c-body">{{$.Links.Text .Text}}</div>
    </div>
    {{end}}
    {{else}}<p class="beads-empty">No comments.</p>{{end}}
    {{/* The Comments tab has no closed event, so the close reason is shown here
         at the end; the History tab already carries it as the closed event. */}}
    {{if .CloseReason}}
    <h4>Close reason</h4>
    <pre class="field-body">{{.CloseReason}}</pre>
    {{end}}
  </div>

  <div class="actpanel panel-history">
    {{if $.Data.History}}
    <ul class="bead-timeline">
      {{range $.Data.History}}
      <li class="tl-item tl-{{.Kind}}">
        <div class="tl-head">
          <strong>{{.Actor}}</strong> {{$.Links.Text .Summary}}
          {{if .CreatedAt}}<span class="tl-when">&middot; {{.CreatedAt}}</span>{{end}}
        </div>
        {{if .Text}}<div class="tl-body">{{$.Links.Text .Text}}</div>{{end}}
      </li>
      {{end}}
    </ul>
    {{else}}<p class="beads-empty">No activity yet.</p>{{end}}
  </div>
</div>
{{else}}
<div class="alert alert-warning">Issue not found.</div>
{{end}}

{{else}}
{{/* ---------------- board ---------------- */}}
{{if .Data.Truncated}}
<div class="alert alert-warning">Showing the first {{.Data.Total}} of {{.Data.ShownOf}} issues.</div>
{{end}}

<form class="beads-filter" method="get" action="/~{{.Repo.OwnerName}}/{{.Repo.Name}}/view/beads">
  {{if .Ref}}<input type="hidden" name="ref" value="{{.Ref}}">{{end}}
  {{/* The layout is not a filter, but this form is a GET: without carrying it,
       submitting a filter from the stream would answer with the board. */}}
  {{if eq .Data.Layout "stream"}}<input type="hidden" name="layout" value="stream">{{end}}
  <input type="search" name="q" value="{{.Data.Filter.Query}}" placeholder="Search id / title">
  <select name="type" aria-label="Type">
    <option value="">All types</option>
    {{range .Data.FilterOpts.Types}}<option value="{{.}}"{{if eq . $.Data.Filter.Type}} selected{{end}}>{{.}}</option>{{end}}
  </select>
  <select name="priority" aria-label="Priority">
    <option value="">All priorities</option>
    {{range .Data.FilterOpts.Priorities}}<option value="{{.}}"{{if eq . $.Data.Filter.Priority}} selected{{end}}>P{{.}}</option>{{end}}
  </select>
  <select name="assignee" aria-label="Assignee">
    <option value="">Anyone</option>
    {{range .Data.FilterOpts.Assignees}}<option value="{{.}}"{{if eq . $.Data.Filter.Assignee}} selected{{end}}>@{{.}}</option>{{end}}
  </select>
  <select name="label" aria-label="Label">
    <option value="">Any label</option>
    {{range .Data.FilterOpts.Labels}}<option value="{{.}}"{{if eq . $.Data.Filter.Label}} selected{{end}}>{{.}}</option>{{end}}
  </select>
  <label class="beads-ready-toggle"><input type="checkbox" name="ready" value="1"{{if .Data.Filter.Ready}} checked{{end}}> &#9889; Ready only</label>
  <button type="submit">Filter</button>
  {{/* Clear drops the filters and keeps the layout: the layout is how the page
       is read, not what it is filtered to. */}}
  {{if .Data.Filter.Active}}<a class="beads-filter-clear" href="/~{{.Repo.OwnerName}}/{{.Repo.Name}}/view/beads{{if .Ref}}?ref={{.Ref}}{{if eq .Data.Layout "stream"}}&amp;layout=stream{{end}}{{else}}{{if eq .Data.Layout "stream"}}?layout=stream{{end}}{{end}}">Clear</a>{{end}}
</form>

<div class="beads-layout">
  <span class="l">view:</span>
  {{if eq .Data.Layout "stream"}}
  <a href="/~{{.Repo.OwnerName}}/{{.Repo.Name}}/view/beads{{withQuery .Data.Query "layout" ""}}">Board</a>
  {{else}}<span class="current" aria-current="page">Board</span>{{end}}
  <span class="sep">&middot;</span>
  {{if eq .Data.Layout "stream"}}<span class="current" aria-current="page">Stream</span>
  {{else}}<a href="/~{{.Repo.OwnerName}}/{{.Repo.Name}}/view/beads{{withQuery .Data.Query "layout" "stream"}}">Stream</a>{{end}}
</div>

<div class="beads-summary">
  <div class="stat rolling"><div class="n">{{.Data.Counts.Rolling}}</div><div class="l"><span class="swatch"></span>Rolling</div></div>
  <div class="stat lined-up"><div class="n">{{.Data.Counts.LinedUp}}</div><div class="l"><span class="swatch"></span>Lined Up</div></div>
  <div class="stat stalled"><div class="n">{{.Data.Counts.Stalled}}</div><div class="l"><span class="swatch"></span>Stalled</div></div>
  <div class="stat past-stand"><div class="n">{{.Data.Counts.PastStand}}</div><div class="l"><span class="swatch"></span>Past Stand</div></div>
  <div class="stat total"><div class="n">{{.Data.Counts.Total}}</div><div class="l">Total</div></div>
</div>

{{if eq .Data.Layout "stream"}}
{{/* ---------------- stream: the same buckets as one column ---------------- */}}
<div class="beads-stream">
  {{range .Data.Sections}}
  {{if .Collapsed}}
  <details class="beads-section {{.Slug}}">
    <summary class="stream-head">
      <span class="swatch"></span>{{.Name}}{{if .Note}}<span class="note">{{.Note}}</span>{{end}}<span class="count">{{len .Issues}}</span>
    </summary>
    {{template "beadStreamRows" (dict "Repo" $.Repo "Section" .)}}
  </details>
  {{else}}
  <section class="beads-section {{.Slug}}">
    <div class="stream-head">
      <span class="swatch"></span>{{.Name}}{{if .Note}}<span class="note">{{.Note}}</span>{{end}}<span class="count">{{len .Issues}}</span>
    </div>
    {{template "beadStreamRows" (dict "Repo" $.Repo "Section" .)}}
  </section>
  {{end}}
  {{end}}
</div>

{{else}}
{{/* ---------------- board: four lanes side by side ---------------- */}}
<div class="beads-lanes">
  {{range .Data.Lanes}}
  <div class="beads-lane {{.Slug}}">
    <div class="lane-head">
      <span class="swatch"></span>{{.Name}}<span class="count">{{len .Issues}}</span>
    </div>
    <div class="lane-body">
      {{range .Issues}}
      <a class="bead-row" href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/view/beads?issue={{.ID | urlquery}}">
        <span class="r-id">{{if .Ready}}<span class="ready-dot" title="Ready to work">&#9889;</span>{{end}}{{.ID}}</span>
        <span class="r-title">{{.Title}}</span>
        <span class="r-meta">
          {{if .PriorityLabel}}<span class="blabel prio">{{.PriorityLabel}}</span>{{end}}
          {{if .Type}}<span class="blabel">{{.Type}}</span>{{end}}
          {{if .Assignee}}<span class="blabel assignee">@{{.Assignee}}</span>{{end}}
          {{range .Labels}}<span class="blabel muted">{{.}}</span>{{end}}
          {{if .BlockedBy}}<span class="blabel block">&#128679; {{.BlockedBy}}</span>{{end}}
          {{if .Blocks}}<span class="blabel muted">blocks {{.Blocks}}</span>{{end}}
        </span>
      </a>
      {{else}}
      <p class="beads-empty">Empty lane.</p>
      {{end}}
    </div>
  </div>
  {{end}}
</div>
{{end}}{{/* layout */}}
{{end}}{{/* detail vs board */}}
</div>
{{- end}}

{{/* One stream section's cards. The row markup is the board's row markup: the
     same card, only differently arranged — so the two copies move together.
     It is copied rather than shared because folding the board's lane body into
     this partial would reflow the board's output, and the board is meant to
     render exactly what it rendered before this layout existed. */}}
{{define "beadStreamRows"}}
<div class="stream-body">
  {{range .Section.Issues}}
  <a class="bead-row" href="/~{{$.Repo.OwnerName}}/{{$.Repo.Name}}/view/beads?issue={{.ID | urlquery}}">
    <span class="r-id">{{if .Ready}}<span class="ready-dot" title="Ready to work">&#9889;</span>{{end}}{{.ID}}</span>
    <span class="r-title">{{.Title}}</span>
    <span class="r-meta">
      {{if .PriorityLabel}}<span class="blabel prio">{{.PriorityLabel}}</span>{{end}}
      {{if .Type}}<span class="blabel">{{.Type}}</span>{{end}}
      {{if .Assignee}}<span class="blabel assignee">@{{.Assignee}}</span>{{end}}
      {{range .Labels}}<span class="blabel muted">{{.}}</span>{{end}}
      {{if .BlockedBy}}<span class="blabel block">&#128679; {{.BlockedBy}}</span>{{end}}
      {{if .Blocks}}<span class="blabel muted">blocks {{.Blocks}}</span>{{end}}
    </span>
  </a>
  {{else}}
  <p class="beads-empty">Nothing in this section.</p>
  {{end}}
</div>
{{end}}