1// Code generated by templ - DO NOT EDIT.
2
3// templ: version: v0.3.1020
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6package web
7
8//lint:file-ignore SA4006 This context is only used if a nested component is present.
9
10import "github.com/a-h/templ"
11import templruntime "github.com/a-h/templ/runtime"
12
13// Shell is the page: head, the two bars, the work area (content and rail),
14// the overlays and the key map. The content is the children.
15func Shell(l Layout, rail templ.Component) templ.Component {
16 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
17 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
18 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
19 return templ_7745c5c3_CtxErr
20 }
21 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
22 if !templ_7745c5c3_IsBuffer {
23 defer func() {
24 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
25 if templ_7745c5c3_Err == nil {
26 templ_7745c5c3_Err = templ_7745c5c3_BufErr
27 }
28 }()
29 }
30 ctx = templ.InitializeContext(ctx)
31 templ_7745c5c3_Var1 := templ.GetChildren(ctx)
32 if templ_7745c5c3_Var1 == nil {
33 templ_7745c5c3_Var1 = templ.NopComponent
34 }
35 ctx = templ.ClearChildren(ctx)
36 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><meta name=\"color-scheme\" content=\"light dark\"><title>")
37 if templ_7745c5c3_Err != nil {
38 return templ_7745c5c3_Err
39 }
40 var templ_7745c5c3_Var2 string
41 templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(l.Title)
42 if templ_7745c5c3_Err != nil {
43 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 14, Col: 19}
44 }
45 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
46 if templ_7745c5c3_Err != nil {
47 return templ_7745c5c3_Err
48 }
49 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</title><link rel=\"icon\" type=\"image/svg+xml\" href=\"")
50 if templ_7745c5c3_Err != nil {
51 return templ_7745c5c3_Err
52 }
53 var templ_7745c5c3_Var3 templ.SafeURL
54 templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(l.Assets.Icon))
55 if templ_7745c5c3_Err != nil {
56 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 15, Col: 76}
57 }
58 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
59 if templ_7745c5c3_Err != nil {
60 return templ_7745c5c3_Err
61 }
62 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\"><link rel=\"stylesheet\" href=\"")
63 if templ_7745c5c3_Err != nil {
64 return templ_7745c5c3_Err
65 }
66 var templ_7745c5c3_Var4 templ.SafeURL
67 templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(l.Assets.CSS))
68 if templ_7745c5c3_Err != nil {
69 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 16, Col: 60}
70 }
71 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
72 if templ_7745c5c3_Err != nil {
73 return templ_7745c5c3_Err
74 }
75 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "\"><script src=\"")
76 if templ_7745c5c3_Err != nil {
77 return templ_7745c5c3_Err
78 }
79 var templ_7745c5c3_Var5 string
80 templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.ResolveAttributeValue(l.Assets.HTMX)
81 if templ_7745c5c3_Err != nil {
82 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 17, Col: 30}
83 }
84 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
85 if templ_7745c5c3_Err != nil {
86 return templ_7745c5c3_Err
87 }
88 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\" defer></script><script src=\"")
89 if templ_7745c5c3_Err != nil {
90 return templ_7745c5c3_Err
91 }
92 var templ_7745c5c3_Var6 string
93 templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.ResolveAttributeValue(l.Assets.Live)
94 if templ_7745c5c3_Err != nil {
95 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 18, Col: 30}
96 }
97 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
98 if templ_7745c5c3_Err != nil {
99 return templ_7745c5c3_Err
100 }
101 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\" defer></script><script src=\"")
102 if templ_7745c5c3_Err != nil {
103 return templ_7745c5c3_Err
104 }
105 var templ_7745c5c3_Var7 string
106 templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.ResolveAttributeValue(l.Assets.SSE)
107 if templ_7745c5c3_Err != nil {
108 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 19, Col: 29}
109 }
110 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
111 if templ_7745c5c3_Err != nil {
112 return templ_7745c5c3_Err
113 }
114 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\" defer></script><script src=\"")
115 if templ_7745c5c3_Err != nil {
116 return templ_7745c5c3_Err
117 }
118 var templ_7745c5c3_Var8 string
119 templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.ResolveAttributeValue(l.Assets.App)
120 if templ_7745c5c3_Err != nil {
121 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 20, Col: 29}
122 }
123 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
124 if templ_7745c5c3_Err != nil {
125 return templ_7745c5c3_Err
126 }
127 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "\" defer></script></head><body data-ref=\"")
128 if templ_7745c5c3_Err != nil {
129 return templ_7745c5c3_Err
130 }
131 var templ_7745c5c3_Var9 string
132 templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.ResolveAttributeValue(l.RefPath)
133 if templ_7745c5c3_Err != nil {
134 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 22, Col: 28}
135 }
136 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
137 if templ_7745c5c3_Err != nil {
138 return templ_7745c5c3_Err
139 }
140 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "\" data-sha=\"")
141 if templ_7745c5c3_Err != nil {
142 return templ_7745c5c3_Err
143 }
144 var templ_7745c5c3_Var10 string
145 templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.ResolveAttributeValue(l.SHA)
146 if templ_7745c5c3_Err != nil {
147 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 22, Col: 47}
148 }
149 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
150 if templ_7745c5c3_Err != nil {
151 return templ_7745c5c3_Err
152 }
153 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\" data-sel=\"\"><a class=\"skip\" href=\"#main\">skip to content</a>")
154 if templ_7745c5c3_Err != nil {
155 return templ_7745c5c3_Err
156 }
157 templ_7745c5c3_Err = Topbar(l).Render(ctx, templ_7745c5c3_Buffer)
158 if templ_7745c5c3_Err != nil {
159 return templ_7745c5c3_Err
160 }
161 var templ_7745c5c3_Var11 = []any{"work", templ.KV("has-rail", l.HasRail), templ.KV("read", l.Read)}
162 templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var11...)
163 if templ_7745c5c3_Err != nil {
164 return templ_7745c5c3_Err
165 }
166 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<div class=\"")
167 if templ_7745c5c3_Err != nil {
168 return templ_7745c5c3_Err
169 }
170 var templ_7745c5c3_Var12 string
171 templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.ResolveAttributeValue(templ.CSSClasses(templ_7745c5c3_Var11).String())
172 if templ_7745c5c3_Err != nil {
173 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 1, Col: 0}
174 }
175 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var12)
176 if templ_7745c5c3_Err != nil {
177 return templ_7745c5c3_Err
178 }
179 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "\"><main id=\"main\" tabindex=\"-1\" data-y=\"0\" hx-on:scroll=\"this.dataset.y = Math.round(this.scrollTop / 60)\">")
180 if templ_7745c5c3_Err != nil {
181 return templ_7745c5c3_Err
182 }
183 templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
184 if templ_7745c5c3_Err != nil {
185 return templ_7745c5c3_Err
186 }
187 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</main>")
188 if templ_7745c5c3_Err != nil {
189 return templ_7745c5c3_Err
190 }
191 if l.HasRail && rail != nil {
192 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<aside class=\"rail\" aria-label=\"Context\"><details class=\"rail-d\" open data-init=\"\" hx-live=\"if (!data.init) { data.init = '1'; this.open = matchMedia('(min-width: 1100px)').matches }\"><summary>")
193 if templ_7745c5c3_Err != nil {
194 return templ_7745c5c3_Err
195 }
196 var templ_7745c5c3_Var13 string
197 templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(l.RailSum)
198 if templ_7745c5c3_Err != nil {
199 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 32, Col: 27}
200 }
201 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
202 if templ_7745c5c3_Err != nil {
203 return templ_7745c5c3_Err
204 }
205 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</summary>")
206 if templ_7745c5c3_Err != nil {
207 return templ_7745c5c3_Err
208 }
209 templ_7745c5c3_Err = rail.Render(ctx, templ_7745c5c3_Buffer)
210 if templ_7745c5c3_Err != nil {
211 return templ_7745c5c3_Err
212 }
213 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</details></aside>")
214 if templ_7745c5c3_Err != nil {
215 return templ_7745c5c3_Err
216 }
217 }
218 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</div>")
219 if templ_7745c5c3_Err != nil {
220 return templ_7745c5c3_Err
221 }
222 templ_7745c5c3_Err = OverlayHelp().Render(ctx, templ_7745c5c3_Buffer)
223 if templ_7745c5c3_Err != nil {
224 return templ_7745c5c3_Err
225 }
226 templ_7745c5c3_Err = OverlayRefs(l).Render(ctx, templ_7745c5c3_Buffer)
227 if templ_7745c5c3_Err != nil {
228 return templ_7745c5c3_Err
229 }
230 templ_7745c5c3_Err = OverlayCmd(l.Cmd).Render(ctx, templ_7745c5c3_Buffer)
231 if templ_7745c5c3_Err != nil {
232 return templ_7745c5c3_Err
233 }
234 templ_7745c5c3_Err = Statusbar(l).Render(ctx, templ_7745c5c3_Buffer)
235 if templ_7745c5c3_Err != nil {
236 return templ_7745c5c3_Err
237 }
238 templ_7745c5c3_Err = Keys().Render(ctx, templ_7745c5c3_Buffer)
239 if templ_7745c5c3_Err != nil {
240 return templ_7745c5c3_Err
241 }
242 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</body></html>")
243 if templ_7745c5c3_Err != nil {
244 return templ_7745c5c3_Err
245 }
246 return nil
247 })
248}
249
250// Topbar is the top bar, neferbar style: the one accent block (instance)
251// fading into the black bar, the path, the repo sections, the ref switcher.
252func Topbar(l Layout) templ.Component {
253 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
254 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
255 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
256 return templ_7745c5c3_CtxErr
257 }
258 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
259 if !templ_7745c5c3_IsBuffer {
260 defer func() {
261 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
262 if templ_7745c5c3_Err == nil {
263 templ_7745c5c3_Err = templ_7745c5c3_BufErr
264 }
265 }()
266 }
267 ctx = templ.InitializeContext(ctx)
268 templ_7745c5c3_Var14 := templ.GetChildren(ctx)
269 if templ_7745c5c3_Var14 == nil {
270 templ_7745c5c3_Var14 = templ.NopComponent
271 }
272 ctx = templ.ClearChildren(ctx)
273 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<header class=\"bar top\"><a class=\"blk\" href=\"/\" data-g=\"h\" title=\"home (g h)\">")
274 if templ_7745c5c3_Err != nil {
275 return templ_7745c5c3_Err
276 }
277 var templ_7745c5c3_Var15 string
278 templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(l.Instance)
279 if templ_7745c5c3_Err != nil {
280 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 51, Col: 68}
281 }
282 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
283 if templ_7745c5c3_Err != nil {
284 return templ_7745c5c3_Err
285 }
286 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</a><span class=\"fade\" aria-hidden=\"true\"></span><nav class=\"crumbs\" aria-label=\"Path\"><ol>")
287 if templ_7745c5c3_Err != nil {
288 return templ_7745c5c3_Err
289 }
290 for _, c := range l.Crumbs {
291 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<li>")
292 if templ_7745c5c3_Err != nil {
293 return templ_7745c5c3_Err
294 }
295 if c.Href != "" {
296 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "<a href=\"")
297 if templ_7745c5c3_Err != nil {
298 return templ_7745c5c3_Err
299 }
300 var templ_7745c5c3_Var16 templ.SafeURL
301 templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(c.Href))
302 if templ_7745c5c3_Err != nil {
303 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 58, Col: 36}
304 }
305 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
306 if templ_7745c5c3_Err != nil {
307 return templ_7745c5c3_Err
308 }
309 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "\"")
310 if templ_7745c5c3_Err != nil {
311 return templ_7745c5c3_Err
312 }
313 if c.Current {
314 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, " aria-current=\"page\"")
315 if templ_7745c5c3_Err != nil {
316 return templ_7745c5c3_Err
317 }
318 }
319 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, ">")
320 if templ_7745c5c3_Err != nil {
321 return templ_7745c5c3_Err
322 }
323 var templ_7745c5c3_Var17 string
324 templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(c.Label)
325 if templ_7745c5c3_Err != nil {
326 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 62, Col: 17}
327 }
328 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
329 if templ_7745c5c3_Err != nil {
330 return templ_7745c5c3_Err
331 }
332 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "</a>")
333 if templ_7745c5c3_Err != nil {
334 return templ_7745c5c3_Err
335 }
336 } else {
337 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "<span aria-current=\"page\">")
338 if templ_7745c5c3_Err != nil {
339 return templ_7745c5c3_Err
340 }
341 var templ_7745c5c3_Var18 string
342 templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(c.Label)
343 if templ_7745c5c3_Err != nil {
344 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 64, Col: 42}
345 }
346 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
347 if templ_7745c5c3_Err != nil {
348 return templ_7745c5c3_Err
349 }
350 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</span>")
351 if templ_7745c5c3_Err != nil {
352 return templ_7745c5c3_Err
353 }
354 }
355 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "</li>")
356 if templ_7745c5c3_Err != nil {
357 return templ_7745c5c3_Err
358 }
359 }
360 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</ol></nav>")
361 if templ_7745c5c3_Err != nil {
362 return templ_7745c5c3_Err
363 }
364 if len(l.Sections) > 0 {
365 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<nav class=\"secs\" aria-label=\"Sections\"><ul>")
366 if templ_7745c5c3_Err != nil {
367 return templ_7745c5c3_Err
368 }
369 for _, s := range l.Sections {
370 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "<li><a href=\"")
371 if templ_7745c5c3_Err != nil {
372 return templ_7745c5c3_Err
373 }
374 var templ_7745c5c3_Var19 templ.SafeURL
375 templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(s.Href))
376 if templ_7745c5c3_Err != nil {
377 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 76, Col: 36}
378 }
379 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
380 if templ_7745c5c3_Err != nil {
381 return templ_7745c5c3_Err
382 }
383 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "\" data-key=\"")
384 if templ_7745c5c3_Err != nil {
385 return templ_7745c5c3_Err
386 }
387 var templ_7745c5c3_Var20 string
388 templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.ResolveAttributeValue(s.Key)
389 if templ_7745c5c3_Err != nil {
390 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 77, Col: 24}
391 }
392 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20)
393 if templ_7745c5c3_Err != nil {
394 return templ_7745c5c3_Err
395 }
396 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "\" aria-keyshortcuts=\"")
397 if templ_7745c5c3_Err != nil {
398 return templ_7745c5c3_Err
399 }
400 var templ_7745c5c3_Var21 string
401 templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.ResolveAttributeValue("g " + s.Key)
402 if templ_7745c5c3_Err != nil {
403 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 78, Col: 40}
404 }
405 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21)
406 if templ_7745c5c3_Err != nil {
407 return templ_7745c5c3_Err
408 }
409 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\"")
410 if templ_7745c5c3_Err != nil {
411 return templ_7745c5c3_Err
412 }
413 if s.Current {
414 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, " aria-current=\"page\"")
415 if templ_7745c5c3_Err != nil {
416 return templ_7745c5c3_Err
417 }
418 }
419 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, ">")
420 if templ_7745c5c3_Err != nil {
421 return templ_7745c5c3_Err
422 }
423 var templ_7745c5c3_Var22 string
424 templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(s.Key)
425 if templ_7745c5c3_Err != nil {
426 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 82, Col: 15}
427 }
428 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
429 if templ_7745c5c3_Err != nil {
430 return templ_7745c5c3_Err
431 }
432 var templ_7745c5c3_Var23 string
433 templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(s.Post)
434 if templ_7745c5c3_Err != nil {
435 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 82, Col: 25}
436 }
437 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
438 if templ_7745c5c3_Err != nil {
439 return templ_7745c5c3_Err
440 }
441 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "</a></li>")
442 if templ_7745c5c3_Err != nil {
443 return templ_7745c5c3_Err
444 }
445 }
446 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "</ul></nav>")
447 if templ_7745c5c3_Err != nil {
448 return templ_7745c5c3_Err
449 }
450 }
451 if l.Ref != "" {
452 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<button type=\"button\" class=\"ref\" aria-haspopup=\"dialog\" aria-controls=\"panel-refs\" aria-keyshortcuts=\"b\" title=\"switch ref (b)\" hx-on:click=\"document.body.dispatchEvent(new CustomEvent('k-refs'))\">")
453 if templ_7745c5c3_Err != nil {
454 return templ_7745c5c3_Err
455 }
456 var templ_7745c5c3_Var24 string
457 templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(l.Ref)
458 if templ_7745c5c3_Err != nil {
459 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 97, Col: 11}
460 }
461 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
462 if templ_7745c5c3_Err != nil {
463 return templ_7745c5c3_Err
464 }
465 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<span class=\"sha\">")
466 if templ_7745c5c3_Err != nil {
467 return templ_7745c5c3_Err
468 }
469 var templ_7745c5c3_Var25 string
470 templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs("@" + l.Short)
471 if templ_7745c5c3_Err != nil {
472 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 97, Col: 46}
473 }
474 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
475 if templ_7745c5c3_Err != nil {
476 return templ_7745c5c3_Err
477 }
478 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "</span></button>")
479 if templ_7745c5c3_Err != nil {
480 return templ_7745c5c3_Err
481 }
482 }
483 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "</header>")
484 if templ_7745c5c3_Err != nil {
485 return templ_7745c5c3_Err
486 }
487 return nil
488 })
489}
490
491// Statusbar is the bottom bar: mode, context, the ":" command prompt, the
492// source link (AGPL §13), hints, live state and the cursor position. Plain
493// text only: the top bar carries the accent.
494func Statusbar(l Layout) templ.Component {
495 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
496 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
497 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
498 return templ_7745c5c3_CtxErr
499 }
500 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
501 if !templ_7745c5c3_IsBuffer {
502 defer func() {
503 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
504 if templ_7745c5c3_Err == nil {
505 templ_7745c5c3_Err = templ_7745c5c3_BufErr
506 }
507 }()
508 }
509 ctx = templ.InitializeContext(ctx)
510 templ_7745c5c3_Var26 := templ.GetChildren(ctx)
511 if templ_7745c5c3_Var26 == nil {
512 templ_7745c5c3_Var26 = templ.NopComponent
513 }
514 ctx = templ.ClearChildren(ctx)
515 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "<footer class=\"bar status\" aria-label=\"Status\"><span class=\"mode\">")
516 if templ_7745c5c3_Err != nil {
517 return templ_7745c5c3_Err
518 }
519 var templ_7745c5c3_Var27 string
520 templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(l.Status.Mode)
521 if templ_7745c5c3_Err != nil {
522 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 107, Col: 36}
523 }
524 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
525 if templ_7745c5c3_Err != nil {
526 return templ_7745c5c3_Err
527 }
528 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "</span> <span class=\"st-ctx\">")
529 if templ_7745c5c3_Err != nil {
530 return templ_7745c5c3_Err
531 }
532 var templ_7745c5c3_Var28 string
533 templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(l.Status.Context)
534 if templ_7745c5c3_Err != nil {
535 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 108, Col: 41}
536 }
537 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
538 if templ_7745c5c3_Err != nil {
539 return templ_7745c5c3_Err
540 }
541 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "</span> <button type=\"button\" class=\"st-cmd\" aria-haspopup=\"dialog\" aria-controls=\"panel-cmd\" aria-keyshortcuts=\":\" hx-on:click=\"document.body.dispatchEvent(new CustomEvent('k-cmd'))\"><span class=\"hi\">:</span> go to…</button> ")
542 if templ_7745c5c3_Err != nil {
543 return templ_7745c5c3_Err
544 }
545 if l.Status.Blob {
546 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<span class=\"st-sel\" :text=\"document.body.dataset.sel ? document.body.dataset.sel + ' · y permalink' : 'click a line number · shift-click extends'\">click a line number · shift-click extends</span> ")
547 if templ_7745c5c3_Err != nil {
548 return templ_7745c5c3_Err
549 }
550 }
551 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "<span class=\"st-flash\" aria-live=\"polite\" :text=\"document.body.dataset.flash || ''\"></span> <span class=\"st-hints\">")
552 if templ_7745c5c3_Err != nil {
553 return templ_7745c5c3_Err
554 }
555 var templ_7745c5c3_Var29 string
556 templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(l.Status.Hints)
557 if templ_7745c5c3_Err != nil {
558 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 121, Col: 41}
559 }
560 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
561 if templ_7745c5c3_Err != nil {
562 return templ_7745c5c3_Err
563 }
564 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</span> ")
565 if templ_7745c5c3_Err != nil {
566 return templ_7745c5c3_Err
567 }
568 if SignedIn(ctx) {
569 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<form class=\"st-owner\" method=\"post\" action=\"/-/logout\"><span>owner</span> <button type=\"submit\" title=\"sign out of this browser\">[sign out]</button></form>")
570 if templ_7745c5c3_Err != nil {
571 return templ_7745c5c3_Err
572 }
573 }
574 templ_7745c5c3_Err = Footer(l).Render(ctx, templ_7745c5c3_Buffer)
575 if templ_7745c5c3_Err != nil {
576 return templ_7745c5c3_Err
577 }
578 templ_7745c5c3_Err = Live(l).Render(ctx, templ_7745c5c3_Buffer)
579 if templ_7745c5c3_Err != nil {
580 return templ_7745c5c3_Err
581 }
582 if l.Status.Cursor {
583 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "<span class=\"st-pos num\" title=\"cursor position\" :text=\"(() => { let all = q('[data-rows] > :not([hidden])').arr(); let i = all.findIndex(r => r.hasAttribute('data-cursor')); return (i + 1) + '/' + all.length })()\">")
584 if templ_7745c5c3_Err != nil {
585 return templ_7745c5c3_Err
586 }
587 var templ_7745c5c3_Var30 string
588 templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(cursorText(l.Status.Count))
589 if templ_7745c5c3_Err != nil {
590 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 135, Col: 32}
591 }
592 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
593 if templ_7745c5c3_Err != nil {
594 return templ_7745c5c3_Err
595 }
596 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</span>")
597 if templ_7745c5c3_Err != nil {
598 return templ_7745c5c3_Err
599 }
600 }
601 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "</footer>")
602 if templ_7745c5c3_Err != nil {
603 return templ_7745c5c3_Err
604 }
605 return nil
606 })
607}
608
609// Footer is the version and the link to the source of the running version,
610// which the AGPL §13 asks every user of the service to be offered.
611func Footer(l Layout) templ.Component {
612 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
613 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
614 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
615 return templ_7745c5c3_CtxErr
616 }
617 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
618 if !templ_7745c5c3_IsBuffer {
619 defer func() {
620 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
621 if templ_7745c5c3_Err == nil {
622 templ_7745c5c3_Err = templ_7745c5c3_BufErr
623 }
624 }()
625 }
626 ctx = templ.InitializeContext(ctx)
627 templ_7745c5c3_Var31 := templ.GetChildren(ctx)
628 if templ_7745c5c3_Var31 == nil {
629 templ_7745c5c3_Var31 = templ.NopComponent
630 }
631 ctx = templ.ClearChildren(ctx)
632 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<span class=\"st-src\"><span class=\"st-ver\">ermite ")
633 if templ_7745c5c3_Err != nil {
634 return templ_7745c5c3_Err
635 }
636 var templ_7745c5c3_Var32 string
637 templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(l.Version)
638 if templ_7745c5c3_Err != nil {
639 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 143, Col: 61}
640 }
641 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
642 if templ_7745c5c3_Err != nil {
643 return templ_7745c5c3_Err
644 }
645 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, " · </span><a href=\"")
646 if templ_7745c5c3_Err != nil {
647 return templ_7745c5c3_Err
648 }
649 var templ_7745c5c3_Var33 templ.SafeURL
650 templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(l.SourceURL))
651 if templ_7745c5c3_Err != nil {
652 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/adapters/web/shell.templ`, Line: 143, Col: 110}
653 }
654 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
655 if templ_7745c5c3_Err != nil {
656 return templ_7745c5c3_Err
657 }
658 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "\" rel=\"noopener\" title=\"source of this version (AGPL-3.0-or-later)\">source</a></span>")
659 if templ_7745c5c3_Err != nil {
660 return templ_7745c5c3_Err
661 }
662 return nil
663 })
664}
665
666var _ = templruntime.GeneratedTemplate