1// Code generated by templ - DO NOT EDIT.
2
3package systemviews
4
5//lint:file-ignore SA4006 This context is only used if a nested component is present.
6
7import "github.com/a-h/templ"
8import templruntime "github.com/a-h/templ/runtime"
9
10import (
11 "fmt"
12 "github.com/bnema/dumber/internal/domain/entity"
13 "strings"
14)
15
16func HistoryView(data historyRenderData) templ.Component {
17 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
18 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
19 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
20 return templ_7745c5c3_CtxErr
21 }
22 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
23 if !templ_7745c5c3_IsBuffer {
24 defer func() {
25 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
26 if templ_7745c5c3_Err == nil {
27 templ_7745c5c3_Err = templ_7745c5c3_BufErr
28 }
29 }()
30 }
31 ctx = templ.InitializeContext(ctx)
32 templ_7745c5c3_Var1 := templ.GetChildren(ctx)
33 if templ_7745c5c3_Var1 == nil {
34 templ_7745c5c3_Var1 = templ.NopComponent
35 }
36 ctx = templ.ClearChildren(ctx)
37 templ_7745c5c3_Err = Alert("success", data.Notice).Render(ctx, templ_7745c5c3_Buffer)
38 if templ_7745c5c3_Err != nil {
39 return templ_7745c5c3_Err
40 }
41 templ_7745c5c3_Err = Alert("error", data.Error).Render(ctx, templ_7745c5c3_Buffer)
42 if templ_7745c5c3_Err != nil {
43 return templ_7745c5c3_Err
44 }
45 templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
46 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
47 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
48 if !templ_7745c5c3_IsBuffer {
49 defer func() {
50 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
51 if templ_7745c5c3_Err == nil {
52 templ_7745c5c3_Err = templ_7745c5c3_BufErr
53 }
54 }()
55 }
56 ctx = templ.InitializeContext(ctx)
57 templ_7745c5c3_Err = HistoryControls(data).Render(ctx, templ_7745c5c3_Buffer)
58 if templ_7745c5c3_Err != nil {
59 return templ_7745c5c3_Err
60 }
61 return nil
62 })
63 templ_7745c5c3_Err = Section("sv-history-controls", "Manage history").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
64 if templ_7745c5c3_Err != nil {
65 return templ_7745c5c3_Err
66 }
67 templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
68 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
69 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
70 if !templ_7745c5c3_IsBuffer {
71 defer func() {
72 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
73 if templ_7745c5c3_Err == nil {
74 templ_7745c5c3_Err = templ_7745c5c3_BufErr
75 }
76 }()
77 }
78 ctx = templ.InitializeContext(ctx)
79 templ_7745c5c3_Err = HistoryDomains(data).Render(ctx, templ_7745c5c3_Buffer)
80 if templ_7745c5c3_Err != nil {
81 return templ_7745c5c3_Err
82 }
83 return nil
84 })
85 templ_7745c5c3_Err = Section("sv-history-domains", "Top domains").Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
86 if templ_7745c5c3_Err != nil {
87 return templ_7745c5c3_Err
88 }
89 templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
90 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
91 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
92 if !templ_7745c5c3_IsBuffer {
93 defer func() {
94 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
95 if templ_7745c5c3_Err == nil {
96 templ_7745c5c3_Err = templ_7745c5c3_BufErr
97 }
98 }()
99 }
100 ctx = templ.InitializeContext(ctx)
101 templ_7745c5c3_Err = HistoryTimeline(data).Render(ctx, templ_7745c5c3_Buffer)
102 if templ_7745c5c3_Err != nil {
103 return templ_7745c5c3_Err
104 }
105 return nil
106 })
107 templ_7745c5c3_Err = Section("sv-history-timeline", "Recent visits").Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
108 if templ_7745c5c3_Err != nil {
109 return templ_7745c5c3_Err
110 }
111 return nil
112 })
113}
114
115func HistoryControls(data historyRenderData) templ.Component {
116 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
117 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
118 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
119 return templ_7745c5c3_CtxErr
120 }
121 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
122 if !templ_7745c5c3_IsBuffer {
123 defer func() {
124 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
125 if templ_7745c5c3_Err == nil {
126 templ_7745c5c3_Err = templ_7745c5c3_BufErr
127 }
128 }()
129 }
130 ctx = templ.InitializeContext(ctx)
131 templ_7745c5c3_Var5 := templ.GetChildren(ctx)
132 if templ_7745c5c3_Var5 == nil {
133 templ_7745c5c3_Var5 = templ.NopComponent
134 }
135 ctx = templ.ClearChildren(ctx)
136 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<form class=\"sv-toolbar sv-history-search\" data-sv-action=\"history.search\"><label class=\"sv-search-label\"><span>Search</span> <input data-sv-history-search data-sv-autofocus name=\"query\" type=\"search\" value=\"")
137 if templ_7745c5c3_Err != nil {
138 return templ_7745c5c3_Err
139 }
140 var templ_7745c5c3_Var6 string
141 templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(data.Query)
142 if templ_7745c5c3_Err != nil {
143 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 27, Col: 96}
144 }
145 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
146 if templ_7745c5c3_Err != nil {
147 return templ_7745c5c3_Err
148 }
149 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" placeholder=\"Search title or URL\" autocomplete=\"off\" autofocus></label> <button class=\"sv-button\" type=\"submit\">")
150 if templ_7745c5c3_Err != nil {
151 return templ_7745c5c3_Err
152 }
153 templ_7745c5c3_Err = ButtonIconLabel(iconSearch, "Search").Render(ctx, templ_7745c5c3_Buffer)
154 if templ_7745c5c3_Err != nil {
155 return templ_7745c5c3_Err
156 }
157 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</button> <button class=\"sv-button sv-button-secondary\" type=\"button\" data-sv-action=\"history.clear\">")
158 if templ_7745c5c3_Err != nil {
159 return templ_7745c5c3_Err
160 }
161 templ_7745c5c3_Err = ButtonIconLabel(iconX, "Clear").Render(ctx, templ_7745c5c3_Buffer)
162 if templ_7745c5c3_Err != nil {
163 return templ_7745c5c3_Err
164 }
165 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</button></form>")
166 if templ_7745c5c3_Err != nil {
167 return templ_7745c5c3_Err
168 }
169 if showHistoryFilters(data) {
170 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<div class=\"sv-active-filters\">")
171 if templ_7745c5c3_Err != nil {
172 return templ_7745c5c3_Err
173 }
174 if data.Query != "" {
175 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "<span class=\"sv-filter-chip\">Query: ")
176 if templ_7745c5c3_Err != nil {
177 return templ_7745c5c3_Err
178 }
179 var templ_7745c5c3_Var7 string
180 templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(data.Query)
181 if templ_7745c5c3_Err != nil {
182 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 35, Col: 52}
183 }
184 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
185 if templ_7745c5c3_Err != nil {
186 return templ_7745c5c3_Err
187 }
188 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</span> ")
189 if templ_7745c5c3_Err != nil {
190 return templ_7745c5c3_Err
191 }
192 }
193 if data.DomainFilter != "" {
194 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<span class=\"sv-filter-chip\">Domain: ")
195 if templ_7745c5c3_Err != nil {
196 return templ_7745c5c3_Err
197 }
198 var templ_7745c5c3_Var8 string
199 templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(data.DomainFilter)
200 if templ_7745c5c3_Err != nil {
201 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 38, Col: 60}
202 }
203 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
204 if templ_7745c5c3_Err != nil {
205 return templ_7745c5c3_Err
206 }
207 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, " <button type=\"button\" data-sv-action=\"history.clearDomain\" aria-label=\"Clear domain filter\">")
208 if templ_7745c5c3_Err != nil {
209 return templ_7745c5c3_Err
210 }
211 templ_7745c5c3_Err = IconOnly(iconX, "Clear domain filter").Render(ctx, templ_7745c5c3_Buffer)
212 if templ_7745c5c3_Err != nil {
213 return templ_7745c5c3_Err
214 }
215 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</button></span>")
216 if templ_7745c5c3_Err != nil {
217 return templ_7745c5c3_Err
218 }
219 }
220 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</div>")
221 if templ_7745c5c3_Err != nil {
222 return templ_7745c5c3_Err
223 }
224 }
225 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<div class=\"sv-history-actions-panel\"><div class=\"sv-button-row\" aria-label=\"History pagination\"><span class=\"sv-meta\">")
226 if templ_7745c5c3_Err != nil {
227 return templ_7745c5c3_Err
228 }
229 var templ_7745c5c3_Var9 string
230 templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(historyShowingLabel(data))
231 if templ_7745c5c3_Err != nil {
232 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 44, Col: 52}
233 }
234 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
235 if templ_7745c5c3_Err != nil {
236 return templ_7745c5c3_Err
237 }
238 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</span></div><div class=\"sv-button-row\" aria-label=\"History cleanup\"><span class=\"sv-meta\">Clean up</span> ")
239 if templ_7745c5c3_Err != nil {
240 return templ_7745c5c3_Err
241 }
242 for _, item := range historyCleanupItems() {
243 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<button type=\"button\" class=\"sv-danger-link\" data-sv-action=\"history.deleteRange\" data-range=\"")
244 if templ_7745c5c3_Err != nil {
245 return templ_7745c5c3_Err
246 }
247 var templ_7745c5c3_Var10 string
248 templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(item.RangeID)
249 if templ_7745c5c3_Err != nil {
250 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 49, Col: 111}
251 }
252 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
253 if templ_7745c5c3_Err != nil {
254 return templ_7745c5c3_Err
255 }
256 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\" data-sv-confirm=\"")
257 if templ_7745c5c3_Err != nil {
258 return templ_7745c5c3_Err
259 }
260 var templ_7745c5c3_Var11 string
261 templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(item.Confirm)
262 if templ_7745c5c3_Err != nil {
263 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 49, Col: 144}
264 }
265 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
266 if templ_7745c5c3_Err != nil {
267 return templ_7745c5c3_Err
268 }
269 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "\">")
270 if templ_7745c5c3_Err != nil {
271 return templ_7745c5c3_Err
272 }
273 var templ_7745c5c3_Var12 string
274 templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Label)
275 if templ_7745c5c3_Err != nil {
276 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 49, Col: 159}
277 }
278 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
279 if templ_7745c5c3_Err != nil {
280 return templ_7745c5c3_Err
281 }
282 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "</button>")
283 if templ_7745c5c3_Err != nil {
284 return templ_7745c5c3_Err
285 }
286 }
287 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</div></div>")
288 if templ_7745c5c3_Err != nil {
289 return templ_7745c5c3_Err
290 }
291 return nil
292 })
293}
294
295func HistoryDomains(data historyRenderData) templ.Component {
296 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
297 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
298 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
299 return templ_7745c5c3_CtxErr
300 }
301 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
302 if !templ_7745c5c3_IsBuffer {
303 defer func() {
304 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
305 if templ_7745c5c3_Err == nil {
306 templ_7745c5c3_Err = templ_7745c5c3_BufErr
307 }
308 }()
309 }
310 ctx = templ.InitializeContext(ctx)
311 templ_7745c5c3_Var13 := templ.GetChildren(ctx)
312 if templ_7745c5c3_Var13 == nil {
313 templ_7745c5c3_Var13 = templ.NopComponent
314 }
315 ctx = templ.ClearChildren(ctx)
316 if data.Loading {
317 templ_7745c5c3_Err = LoadingPanel("Loading top domains…").Render(ctx, templ_7745c5c3_Buffer)
318 if templ_7745c5c3_Err != nil {
319 return templ_7745c5c3_Err
320 }
321 } else if len(data.Domains) == 0 {
322 templ_7745c5c3_Err = EmptyState("No domain statistics yet").Render(ctx, templ_7745c5c3_Buffer)
323 if templ_7745c5c3_Err != nil {
324 return templ_7745c5c3_Err
325 }
326 } else {
327 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "<div class=\"sv-domain-list\">")
328 if templ_7745c5c3_Err != nil {
329 return templ_7745c5c3_Err
330 }
331 for _, domain := range data.Domains {
332 if domain != nil && domain.Domain != "" {
333 domainKey := historyDomainActionKey(domain)
334 displayDomain := historyDomainDisplayLabel(domain)
335 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "<span class=\"sv-domain-chip\"><span class=\"sv-domain-chip-main\"><button type=\"button\" class=\"sv-domain-filter\" data-sv-action=\"history.filterDomain\" data-domain=\"")
336 if templ_7745c5c3_Err != nil {
337 return templ_7745c5c3_Err
338 }
339 var templ_7745c5c3_Var14 string
340 templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(domainKey)
341 if templ_7745c5c3_Err != nil {
342 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 68, Col: 115}
343 }
344 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
345 if templ_7745c5c3_Err != nil {
346 return templ_7745c5c3_Err
347 }
348 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "\">")
349 if templ_7745c5c3_Err != nil {
350 return templ_7745c5c3_Err
351 }
352 var templ_7745c5c3_Var15 string
353 templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(displayDomain)
354 if templ_7745c5c3_Err != nil {
355 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 68, Col: 133}
356 }
357 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
358 if templ_7745c5c3_Err != nil {
359 return templ_7745c5c3_Err
360 }
361 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "</button> <span class=\"sv-domain-meta\">")
362 if templ_7745c5c3_Err != nil {
363 return templ_7745c5c3_Err
364 }
365 var templ_7745c5c3_Var16 string
366 templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%dp · %dv", domain.PageCount, domain.TotalVisits))
367 if templ_7745c5c3_Err != nil {
368 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 69, Col: 101}
369 }
370 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
371 if templ_7745c5c3_Err != nil {
372 return templ_7745c5c3_Err
373 }
374 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</span></span> <button type=\"button\" class=\"sv-domain-delete\" data-sv-action=\"history.deleteDomain\" data-domain=\"")
375 if templ_7745c5c3_Err != nil {
376 return templ_7745c5c3_Err
377 }
378 var templ_7745c5c3_Var17 string
379 templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(domainKey)
380 if templ_7745c5c3_Err != nil {
381 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 71, Col: 114}
382 }
383 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
384 if templ_7745c5c3_Err != nil {
385 return templ_7745c5c3_Err
386 }
387 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\" data-sv-confirm=\"")
388 if templ_7745c5c3_Err != nil {
389 return templ_7745c5c3_Err
390 }
391 var templ_7745c5c3_Var18 string
392 templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs("Delete all history for " + displayDomain + "?")
393 if templ_7745c5c3_Err != nil {
394 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 71, Col: 182}
395 }
396 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
397 if templ_7745c5c3_Err != nil {
398 return templ_7745c5c3_Err
399 }
400 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "\" aria-label=\"")
401 if templ_7745c5c3_Err != nil {
402 return templ_7745c5c3_Err
403 }
404 var templ_7745c5c3_Var19 string
405 templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs("Delete history for " + displayDomain)
406 if templ_7745c5c3_Err != nil {
407 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 71, Col: 235}
408 }
409 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
410 if templ_7745c5c3_Err != nil {
411 return templ_7745c5c3_Err
412 }
413 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "\"><span aria-hidden=\"true\">×</span><span class=\"sv-sr-only\">Delete history for ")
414 if templ_7745c5c3_Err != nil {
415 return templ_7745c5c3_Err
416 }
417 var templ_7745c5c3_Var20 string
418 templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(displayDomain)
419 if templ_7745c5c3_Err != nil {
420 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 71, Col: 331}
421 }
422 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
423 if templ_7745c5c3_Err != nil {
424 return templ_7745c5c3_Err
425 }
426 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</span></button></span>")
427 if templ_7745c5c3_Err != nil {
428 return templ_7745c5c3_Err
429 }
430 }
431 }
432 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "</div>")
433 if templ_7745c5c3_Err != nil {
434 return templ_7745c5c3_Err
435 }
436 }
437 return nil
438 })
439}
440
441func HistoryTimeline(data historyRenderData) templ.Component {
442 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
443 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
444 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
445 return templ_7745c5c3_CtxErr
446 }
447 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
448 if !templ_7745c5c3_IsBuffer {
449 defer func() {
450 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
451 if templ_7745c5c3_Err == nil {
452 templ_7745c5c3_Err = templ_7745c5c3_BufErr
453 }
454 }()
455 }
456 ctx = templ.InitializeContext(ctx)
457 templ_7745c5c3_Var21 := templ.GetChildren(ctx)
458 if templ_7745c5c3_Var21 == nil {
459 templ_7745c5c3_Var21 = templ.NopComponent
460 }
461 ctx = templ.ClearChildren(ctx)
462 if data.Loading {
463 templ_7745c5c3_Err = LoadingPanel("Loading recent visits…").Render(ctx, templ_7745c5c3_Buffer)
464 if templ_7745c5c3_Err != nil {
465 return templ_7745c5c3_Err
466 }
467 } else {
468 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "<div class=\"sv-history-timeline-list\" data-sv-history-timeline>")
469 if templ_7745c5c3_Err != nil {
470 return templ_7745c5c3_Err
471 }
472 groups := groupHistoryEntries(data.Entries)
473 if len(groups) == 0 {
474 templ_7745c5c3_Err = EmptyState(historyTimelineEmptyMessage(data)).Render(ctx, templ_7745c5c3_Buffer)
475 if templ_7745c5c3_Err != nil {
476 return templ_7745c5c3_Err
477 }
478 } else {
479 templ_7745c5c3_Err = HistoryTimelineGroups(data.Entries, "").Render(ctx, templ_7745c5c3_Buffer)
480 if templ_7745c5c3_Err != nil {
481 return templ_7745c5c3_Err
482 }
483 }
484 templ_7745c5c3_Err = HistoryLoadMore(data).Render(ctx, templ_7745c5c3_Buffer)
485 if templ_7745c5c3_Err != nil {
486 return templ_7745c5c3_Err
487 }
488 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</div>")
489 if templ_7745c5c3_Err != nil {
490 return templ_7745c5c3_Err
491 }
492 }
493 return nil
494 })
495}
496
497func HistoryTimelineAppend(data historyRenderData) templ.Component {
498 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
499 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
500 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
501 return templ_7745c5c3_CtxErr
502 }
503 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
504 if !templ_7745c5c3_IsBuffer {
505 defer func() {
506 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
507 if templ_7745c5c3_Err == nil {
508 templ_7745c5c3_Err = templ_7745c5c3_BufErr
509 }
510 }()
511 }
512 ctx = templ.InitializeContext(ctx)
513 templ_7745c5c3_Var22 := templ.GetChildren(ctx)
514 if templ_7745c5c3_Var22 == nil {
515 templ_7745c5c3_Var22 = templ.NopComponent
516 }
517 ctx = templ.ClearChildren(ctx)
518 templ_7745c5c3_Err = HistoryTimelineAppendGroups(data.Entries, data.AppendSkipFirstDate).Render(ctx, templ_7745c5c3_Buffer)
519 if templ_7745c5c3_Err != nil {
520 return templ_7745c5c3_Err
521 }
522 templ_7745c5c3_Err = HistoryLoadMore(data).Render(ctx, templ_7745c5c3_Buffer)
523 if templ_7745c5c3_Err != nil {
524 return templ_7745c5c3_Err
525 }
526 return nil
527 })
528}
529
530func HistoryTimelineGroups(entries []*entity.HistoryEntry, skipFirstDate string) templ.Component {
531 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
532 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
533 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
534 return templ_7745c5c3_CtxErr
535 }
536 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
537 if !templ_7745c5c3_IsBuffer {
538 defer func() {
539 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
540 if templ_7745c5c3_Err == nil {
541 templ_7745c5c3_Err = templ_7745c5c3_BufErr
542 }
543 }()
544 }
545 ctx = templ.InitializeContext(ctx)
546 templ_7745c5c3_Var23 := templ.GetChildren(ctx)
547 if templ_7745c5c3_Var23 == nil {
548 templ_7745c5c3_Var23 = templ.NopComponent
549 }
550 ctx = templ.ClearChildren(ctx)
551 groups := groupHistoryEntries(entries)
552 for _, group := range groups {
553 templ_7745c5c3_Err = HistoryTimelineGroup(group, true).Render(ctx, templ_7745c5c3_Buffer)
554 if templ_7745c5c3_Err != nil {
555 return templ_7745c5c3_Err
556 }
557 }
558 return nil
559 })
560}
561
562func HistoryTimelineAppendGroups(entries []*entity.HistoryEntry, mergeFirstDate string) templ.Component {
563 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
564 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
565 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
566 return templ_7745c5c3_CtxErr
567 }
568 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
569 if !templ_7745c5c3_IsBuffer {
570 defer func() {
571 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
572 if templ_7745c5c3_Err == nil {
573 templ_7745c5c3_Err = templ_7745c5c3_BufErr
574 }
575 }()
576 }
577 ctx = templ.InitializeContext(ctx)
578 templ_7745c5c3_Var24 := templ.GetChildren(ctx)
579 if templ_7745c5c3_Var24 == nil {
580 templ_7745c5c3_Var24 = templ.NopComponent
581 }
582 ctx = templ.ClearChildren(ctx)
583 groups := groupHistoryEntries(entries)
584 for index, group := range groups {
585 if index == 0 && group.Date == mergeFirstDate {
586 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<div data-sv-history-merge-date=\"")
587 if templ_7745c5c3_Err != nil {
588 return templ_7745c5c3_Err
589 }
590 var templ_7745c5c3_Var25 string
591 templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(group.Date)
592 if templ_7745c5c3_Err != nil {
593 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 111, Col: 47}
594 }
595 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
596 if templ_7745c5c3_Err != nil {
597 return templ_7745c5c3_Err
598 }
599 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "\">")
600 if templ_7745c5c3_Err != nil {
601 return templ_7745c5c3_Err
602 }
603 for _, entry := range group.Entries {
604 if entry != nil {
605 templ_7745c5c3_Err = HistoryItem(entry).Render(ctx, templ_7745c5c3_Buffer)
606 if templ_7745c5c3_Err != nil {
607 return templ_7745c5c3_Err
608 }
609 }
610 }
611 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "</div>")
612 if templ_7745c5c3_Err != nil {
613 return templ_7745c5c3_Err
614 }
615 } else {
616 templ_7745c5c3_Err = HistoryTimelineGroup(group, true).Render(ctx, templ_7745c5c3_Buffer)
617 if templ_7745c5c3_Err != nil {
618 return templ_7745c5c3_Err
619 }
620 }
621 }
622 return nil
623 })
624}
625
626func HistoryTimelineGroup(group historyTimelineGroup, showHeading bool) templ.Component {
627 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
628 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
629 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
630 return templ_7745c5c3_CtxErr
631 }
632 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
633 if !templ_7745c5c3_IsBuffer {
634 defer func() {
635 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
636 if templ_7745c5c3_Err == nil {
637 templ_7745c5c3_Err = templ_7745c5c3_BufErr
638 }
639 }()
640 }
641 ctx = templ.InitializeContext(ctx)
642 templ_7745c5c3_Var26 := templ.GetChildren(ctx)
643 if templ_7745c5c3_Var26 == nil {
644 templ_7745c5c3_Var26 = templ.NopComponent
645 }
646 ctx = templ.ClearChildren(ctx)
647 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<section class=\"sv-timeline-group\" data-sv-history-date=\"")
648 if templ_7745c5c3_Err != nil {
649 return templ_7745c5c3_Err
650 }
651 var templ_7745c5c3_Var27 string
652 templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(group.Date)
653 if templ_7745c5c3_Err != nil {
654 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 125, Col: 69}
655 }
656 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
657 if templ_7745c5c3_Err != nil {
658 return templ_7745c5c3_Err
659 }
660 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "\">")
661 if templ_7745c5c3_Err != nil {
662 return templ_7745c5c3_Err
663 }
664 if showHeading {
665 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "<h3>")
666 if templ_7745c5c3_Err != nil {
667 return templ_7745c5c3_Err
668 }
669 var templ_7745c5c3_Var28 string
670 templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(group.Label)
671 if templ_7745c5c3_Err != nil {
672 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 127, Col: 20}
673 }
674 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
675 if templ_7745c5c3_Err != nil {
676 return templ_7745c5c3_Err
677 }
678 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "</h3>")
679 if templ_7745c5c3_Err != nil {
680 return templ_7745c5c3_Err
681 }
682 }
683 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "<ul class=\"sv-list\">")
684 if templ_7745c5c3_Err != nil {
685 return templ_7745c5c3_Err
686 }
687 for _, entry := range group.Entries {
688 if entry != nil {
689 templ_7745c5c3_Err = HistoryItem(entry).Render(ctx, templ_7745c5c3_Buffer)
690 if templ_7745c5c3_Err != nil {
691 return templ_7745c5c3_Err
692 }
693 }
694 }
695 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "</ul></section>")
696 if templ_7745c5c3_Err != nil {
697 return templ_7745c5c3_Err
698 }
699 return nil
700 })
701}
702
703func HistoryLoadMore(data historyRenderData) templ.Component {
704 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
705 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
706 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
707 return templ_7745c5c3_CtxErr
708 }
709 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
710 if !templ_7745c5c3_IsBuffer {
711 defer func() {
712 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
713 if templ_7745c5c3_Err == nil {
714 templ_7745c5c3_Err = templ_7745c5c3_BufErr
715 }
716 }()
717 }
718 ctx = templ.InitializeContext(ctx)
719 templ_7745c5c3_Var29 := templ.GetChildren(ctx)
720 if templ_7745c5c3_Var29 == nil {
721 templ_7745c5c3_Var29 = templ.NopComponent
722 }
723 ctx = templ.ClearChildren(ctx)
724 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "<div class=\"sv-history-load-more\" data-sv-history-load-more-container>")
725 if templ_7745c5c3_Err != nil {
726 return templ_7745c5c3_Err
727 }
728 if showHistoryLoadMore(data) {
729 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "<button type=\"button\" class=\"sv-button sv-button-secondary\" data-sv-action=\"history.loadMore\" data-before=\"")
730 if templ_7745c5c3_Err != nil {
731 return templ_7745c5c3_Err
732 }
733 var templ_7745c5c3_Var30 string
734 templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(historyLoadMoreCursor(data))
735 if templ_7745c5c3_Err != nil {
736 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 142, Col: 138}
737 }
738 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
739 if templ_7745c5c3_Err != nil {
740 return templ_7745c5c3_Err
741 }
742 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "\" data-sv-history-load-more>Load older visits</button>")
743 if templ_7745c5c3_Err != nil {
744 return templ_7745c5c3_Err
745 }
746 } else if strings.TrimSpace(data.Query) == "" && countHistoryEntries(data.Entries) > 0 {
747 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "<p class=\"sv-meta\">End of history</p>")
748 if templ_7745c5c3_Err != nil {
749 return templ_7745c5c3_Err
750 }
751 }
752 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "</div>")
753 if templ_7745c5c3_Err != nil {
754 return templ_7745c5c3_Err
755 }
756 return nil
757 })
758}
759
760func HistoryItem(entry *entity.HistoryEntry) templ.Component {
761 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
762 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
763 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
764 return templ_7745c5c3_CtxErr
765 }
766 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
767 if !templ_7745c5c3_IsBuffer {
768 defer func() {
769 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
770 if templ_7745c5c3_Err == nil {
771 templ_7745c5c3_Err = templ_7745c5c3_BufErr
772 }
773 }()
774 }
775 ctx = templ.InitializeContext(ctx)
776 templ_7745c5c3_Var31 := templ.GetChildren(ctx)
777 if templ_7745c5c3_Var31 == nil {
778 templ_7745c5c3_Var31 = templ.NopComponent
779 }
780 ctx = templ.ClearChildren(ctx)
781 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "<li class=\"sv-list-row\"><article class=\"sv-history-item\" data-sv-history-row data-history-id=\"")
782 if templ_7745c5c3_Err != nil {
783 return templ_7745c5c3_Err
784 }
785 var templ_7745c5c3_Var32 string
786 templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", entry.ID))
787 if templ_7745c5c3_Err != nil {
788 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 151, Col: 100}
789 }
790 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
791 if templ_7745c5c3_Err != nil {
792 return templ_7745c5c3_Err
793 }
794 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "\"><div class=\"sv-history-content\">")
795 if templ_7745c5c3_Err != nil {
796 return templ_7745c5c3_Err
797 }
798 faviconURL := historyItemFaviconURL(entry)
799 var templ_7745c5c3_Var33 = []any{historyFaviconClass(faviconURL)}
800 templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var33...)
801 if templ_7745c5c3_Err != nil {
802 return templ_7745c5c3_Err
803 }
804 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<span class=\"")
805 if templ_7745c5c3_Err != nil {
806 return templ_7745c5c3_Err
807 }
808 var templ_7745c5c3_Var34 string
809 templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var33).String())
810 if templ_7745c5c3_Err != nil {
811 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 1, Col: 0}
812 }
813 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
814 if templ_7745c5c3_Err != nil {
815 return templ_7745c5c3_Err
816 }
817 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "\" aria-hidden=\"true\"><span class=\"sv-history-favicon-fallback\">")
818 if templ_7745c5c3_Err != nil {
819 return templ_7745c5c3_Err
820 }
821 var templ_7745c5c3_Var35 string
822 templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(historyFaviconFallback(entry))
823 if templ_7745c5c3_Err != nil {
824 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 155, Col: 78}
825 }
826 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35))
827 if templ_7745c5c3_Err != nil {
828 return templ_7745c5c3_Err
829 }
830 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "</span> ")
831 if templ_7745c5c3_Err != nil {
832 return templ_7745c5c3_Err
833 }
834 if faviconURL != "" {
835 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "<img src=\"")
836 if templ_7745c5c3_Err != nil {
837 return templ_7745c5c3_Err
838 }
839 var templ_7745c5c3_Var36 string
840 templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(templ.SafeURL(faviconURL))
841 if templ_7745c5c3_Err != nil {
842 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 157, Col: 42}
843 }
844 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
845 if templ_7745c5c3_Err != nil {
846 return templ_7745c5c3_Err
847 }
848 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "\" alt=\"\" width=\"24\" height=\"24\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"same-origin\" onerror=\"this.parentElement.classList.remove('sv-history-favicon-has-image'); this.remove()\">")
849 if templ_7745c5c3_Err != nil {
850 return templ_7745c5c3_Err
851 }
852 }
853 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "</span><div class=\"sv-history-main\"><a class=\"sv-link sv-history-open\" href=\"")
854 if templ_7745c5c3_Err != nil {
855 return templ_7745c5c3_Err
856 }
857 var templ_7745c5c3_Var37 templ.SafeURL
858 templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(sanitizeHref(entry.URL)))
859 if templ_7745c5c3_Err != nil {
860 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 161, Col: 85}
861 }
862 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
863 if templ_7745c5c3_Err != nil {
864 return templ_7745c5c3_Err
865 }
866 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "\">")
867 if templ_7745c5c3_Err != nil {
868 return templ_7745c5c3_Err
869 }
870 var templ_7745c5c3_Var38 string
871 templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(historyItemLabel(entry))
872 if templ_7745c5c3_Err != nil {
873 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 161, Col: 113}
874 }
875 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
876 if templ_7745c5c3_Err != nil {
877 return templ_7745c5c3_Err
878 }
879 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "</a><p class=\"sv-history-url\" title=\"")
880 if templ_7745c5c3_Err != nil {
881 return templ_7745c5c3_Err
882 }
883 var templ_7745c5c3_Var39 string
884 templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(entry.URL)
885 if templ_7745c5c3_Err != nil {
886 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 162, Col: 48}
887 }
888 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
889 if templ_7745c5c3_Err != nil {
890 return templ_7745c5c3_Err
891 }
892 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "\">")
893 if templ_7745c5c3_Err != nil {
894 return templ_7745c5c3_Err
895 }
896 var templ_7745c5c3_Var40 string
897 templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(historyItemURL(entry))
898 if templ_7745c5c3_Err != nil {
899 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 162, Col: 74}
900 }
901 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
902 if templ_7745c5c3_Err != nil {
903 return templ_7745c5c3_Err
904 }
905 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "</p><p class=\"sv-history-meta\">")
906 if templ_7745c5c3_Err != nil {
907 return templ_7745c5c3_Err
908 }
909 var templ_7745c5c3_Var41 string
910 templ_7745c5c3_Var41, templ_7745c5c3_Err = templ.JoinStringErrs(historyItemMeta(entry))
911 if templ_7745c5c3_Err != nil {
912 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 163, Col: 56}
913 }
914 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var41))
915 if templ_7745c5c3_Err != nil {
916 return templ_7745c5c3_Err
917 }
918 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</p></div></div><div class=\"sv-history-row-actions\"><a class=\"sv-button sv-button-secondary\" href=\"")
919 if templ_7745c5c3_Err != nil {
920 return templ_7745c5c3_Err
921 }
922 var templ_7745c5c3_Var42 templ.SafeURL
923 templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinURLErrs(templ.SafeURL(sanitizeHref(entry.URL)))
924 if templ_7745c5c3_Err != nil {
925 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 167, Col: 90}
926 }
927 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
928 if templ_7745c5c3_Err != nil {
929 return templ_7745c5c3_Err
930 }
931 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "\">")
932 if templ_7745c5c3_Err != nil {
933 return templ_7745c5c3_Err
934 }
935 templ_7745c5c3_Err = ButtonIconLabel(iconExternal, "Open").Render(ctx, templ_7745c5c3_Buffer)
936 if templ_7745c5c3_Err != nil {
937 return templ_7745c5c3_Err
938 }
939 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "</a> <button type=\"button\" class=\"sv-button sv-button-secondary sv-button-danger sv-button-icon-only\" data-sv-action=\"history.deleteEntry\" data-id=\"")
940 if templ_7745c5c3_Err != nil {
941 return templ_7745c5c3_Err
942 }
943 var templ_7745c5c3_Var43 string
944 templ_7745c5c3_Var43, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", entry.ID))
945 if templ_7745c5c3_Err != nil {
946 return templ.Error{Err: templ_7745c5c3_Err, FileName: `history.templ`, Line: 168, Col: 175}
947 }
948 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var43))
949 if templ_7745c5c3_Err != nil {
950 return templ_7745c5c3_Err
951 }
952 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "\" data-sv-confirm=\"Delete this history entry?\" aria-label=\"Delete this history entry\"")
953 if templ_7745c5c3_Err != nil {
954 return templ_7745c5c3_Err
955 }
956 if entry.ID <= 0 {
957 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, " disabled")
958 if templ_7745c5c3_Err != nil {
959 return templ_7745c5c3_Err
960 }
961 }
962 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, ">")
963 if templ_7745c5c3_Err != nil {
964 return templ_7745c5c3_Err
965 }
966 templ_7745c5c3_Err = IconOnly(iconTrash, "Delete this history entry").Render(ctx, templ_7745c5c3_Buffer)
967 if templ_7745c5c3_Err != nil {
968 return templ_7745c5c3_Err
969 }
970 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</button></div></article></li>")
971 if templ_7745c5c3_Err != nil {
972 return templ_7745c5c3_Err
973 }
974 return nil
975 })
976}
977
978var _ = templruntime.GeneratedTemplate