main / internal/interface/web/templates/repo_header_templ.go
12.9 KB · Go Raw
1// Code generated by templ - DO NOT EDIT.
2
3// templ: version: v0.3.865
4package templates
5
6//lint:file-ignore SA4006 This context is only used if a nested component is present.
7
8import "github.com/a-h/templ"
9import templruntime "github.com/a-h/templ/runtime"
10
11import "gitgud/internal/domain"
12
13func repoHeader(repo *domain.Repository, active string) templ.Component {
14 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
15 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
16 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
17 return templ_7745c5c3_CtxErr
18 }
19 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
20 if !templ_7745c5c3_IsBuffer {
21 defer func() {
22 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
23 if templ_7745c5c3_Err == nil {
24 templ_7745c5c3_Err = templ_7745c5c3_BufErr
25 }
26 }()
27 }
28 ctx = templ.InitializeContext(ctx)
29 templ_7745c5c3_Var1 := templ.GetChildren(ctx)
30 if templ_7745c5c3_Var1 == nil {
31 templ_7745c5c3_Var1 = templ.NopComponent
32 }
33 ctx = templ.ClearChildren(ctx)
34 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"mb-6\"><div class=\"mb-4 flex items-center gap-3\"><span class=\"text-accent\">")
35 if templ_7745c5c3_Err != nil {
36 return templ_7745c5c3_Err
37 }
38 templ_7745c5c3_Err = gitLogo("size-5").Render(ctx, templ_7745c5c3_Buffer)
39 if templ_7745c5c3_Err != nil {
40 return templ_7745c5c3_Err
41 }
42 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</span><h1 class=\"flex items-center gap-1.5 font-mono text-[15px]\"><a class=\"text-accent hover:underline\" href=\"")
43 if templ_7745c5c3_Err != nil {
44 return templ_7745c5c3_Err
45 }
46 var templ_7745c5c3_Var2 templ.SafeURL = templ.SafeURL("/" + repo.OwnerName)
47 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2)))
48 if templ_7745c5c3_Err != nil {
49 return templ_7745c5c3_Err
50 }
51 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\">")
52 if templ_7745c5c3_Err != nil {
53 return templ_7745c5c3_Err
54 }
55 var templ_7745c5c3_Var3 string
56 templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(repo.OwnerName)
57 if templ_7745c5c3_Err != nil {
58 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/repo_header.templ`, Line: 10, Col: 104}
59 }
60 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
61 if templ_7745c5c3_Err != nil {
62 return templ_7745c5c3_Err
63 }
64 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</a> <span class=\"text-faint\">/</span> <a class=\"font-semibold text-ink hover:text-accent\" href=\"")
65 if templ_7745c5c3_Err != nil {
66 return templ_7745c5c3_Err
67 }
68 var templ_7745c5c3_Var4 templ.SafeURL = templ.SafeURL(repoPath(repo, ""))
69 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var4)))
70 if templ_7745c5c3_Err != nil {
71 return templ_7745c5c3_Err
72 }
73 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "\">")
74 if templ_7745c5c3_Err != nil {
75 return templ_7745c5c3_Err
76 }
77 var templ_7745c5c3_Var5 string
78 templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(repo.Name)
79 if templ_7745c5c3_Err != nil {
80 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/repo_header.templ`, Line: 12, Col: 110}
81 }
82 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
83 if templ_7745c5c3_Err != nil {
84 return templ_7745c5c3_Err
85 }
86 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</a></h1>")
87 if templ_7745c5c3_Err != nil {
88 return templ_7745c5c3_Err
89 }
90 if repo.IsPrivate {
91 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<span class=\"badge\"><span class=\"size-1.5 rounded-full bg-warn\"></span> private</span>")
92 if templ_7745c5c3_Err != nil {
93 return templ_7745c5c3_Err
94 }
95 } else {
96 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<span class=\"badge\">public</span>")
97 if templ_7745c5c3_Err != nil {
98 return templ_7745c5c3_Err
99 }
100 }
101 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</div><nav class=\"flex gap-1 border-b border-line\">")
102 if templ_7745c5c3_Err != nil {
103 return templ_7745c5c3_Err
104 }
105 templ_7745c5c3_Err = repoTab(repoPath(repo, ""), "Code", active == "code").Render(ctx, templ_7745c5c3_Buffer)
106 if templ_7745c5c3_Err != nil {
107 return templ_7745c5c3_Err
108 }
109 templ_7745c5c3_Err = repoTab(repoPath(repo, "/issues"), "Issues", active == "issues").Render(ctx, templ_7745c5c3_Buffer)
110 if templ_7745c5c3_Err != nil {
111 return templ_7745c5c3_Err
112 }
113 templ_7745c5c3_Err = repoTab(repoPath(repo, "/pulls"), "Pull requests", active == "pulls").Render(ctx, templ_7745c5c3_Buffer)
114 if templ_7745c5c3_Err != nil {
115 return templ_7745c5c3_Err
116 }
117 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</nav></div>")
118 if templ_7745c5c3_Err != nil {
119 return templ_7745c5c3_Err
120 }
121 return nil
122 })
123}
124
125func repoTab(href, label string, current bool) templ.Component {
126 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
127 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
128 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
129 return templ_7745c5c3_CtxErr
130 }
131 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
132 if !templ_7745c5c3_IsBuffer {
133 defer func() {
134 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
135 if templ_7745c5c3_Err == nil {
136 templ_7745c5c3_Err = templ_7745c5c3_BufErr
137 }
138 }()
139 }
140 ctx = templ.InitializeContext(ctx)
141 templ_7745c5c3_Var6 := templ.GetChildren(ctx)
142 if templ_7745c5c3_Var6 == nil {
143 templ_7745c5c3_Var6 = templ.NopComponent
144 }
145 ctx = templ.ClearChildren(ctx)
146 if current {
147 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "<a class=\"tab tab-active px-3\" href=\"")
148 if templ_7745c5c3_Err != nil {
149 return templ_7745c5c3_Err
150 }
151 var templ_7745c5c3_Var7 templ.SafeURL = templ.SafeURL(href)
152 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7)))
153 if templ_7745c5c3_Err != nil {
154 return templ_7745c5c3_Err
155 }
156 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "\">")
157 if templ_7745c5c3_Err != nil {
158 return templ_7745c5c3_Err
159 }
160 var templ_7745c5c3_Var8 string
161 templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(label)
162 if templ_7745c5c3_Err != nil {
163 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/repo_header.templ`, Line: 30, Col: 69}
164 }
165 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
166 if templ_7745c5c3_Err != nil {
167 return templ_7745c5c3_Err
168 }
169 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "</a>")
170 if templ_7745c5c3_Err != nil {
171 return templ_7745c5c3_Err
172 }
173 } else {
174 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "<a class=\"tab px-3\" href=\"")
175 if templ_7745c5c3_Err != nil {
176 return templ_7745c5c3_Err
177 }
178 var templ_7745c5c3_Var9 templ.SafeURL = templ.SafeURL(href)
179 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var9)))
180 if templ_7745c5c3_Err != nil {
181 return templ_7745c5c3_Err
182 }
183 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "\">")
184 if templ_7745c5c3_Err != nil {
185 return templ_7745c5c3_Err
186 }
187 var templ_7745c5c3_Var10 string
188 templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(label)
189 if templ_7745c5c3_Err != nil {
190 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/repo_header.templ`, Line: 32, Col: 58}
191 }
192 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
193 if templ_7745c5c3_Err != nil {
194 return templ_7745c5c3_Err
195 }
196 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</a>")
197 if templ_7745c5c3_Err != nil {
198 return templ_7745c5c3_Err
199 }
200 }
201 return nil
202 })
203}
204
205func branchSwitcher(repo *domain.Repository, ref string, branches []string) templ.Component {
206 return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
207 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
208 if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
209 return templ_7745c5c3_CtxErr
210 }
211 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
212 if !templ_7745c5c3_IsBuffer {
213 defer func() {
214 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
215 if templ_7745c5c3_Err == nil {
216 templ_7745c5c3_Err = templ_7745c5c3_BufErr
217 }
218 }()
219 }
220 ctx = templ.InitializeContext(ctx)
221 templ_7745c5c3_Var11 := templ.GetChildren(ctx)
222 if templ_7745c5c3_Var11 == nil {
223 templ_7745c5c3_Var11 = templ.NopComponent
224 }
225 ctx = templ.ClearChildren(ctx)
226 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<div class=\"relative inline-flex\"><select class=\"select w-auto cursor-pointer appearance-none py-1.5 pr-9 pl-3 font-mono text-xs\" onchange=\"location.href=this.value\">")
227 if templ_7745c5c3_Err != nil {
228 return templ_7745c5c3_Err
229 }
230 for _, b := range branches {
231 if b == ref {
232 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "<option value=\"")
233 if templ_7745c5c3_Err != nil {
234 return templ_7745c5c3_Err
235 }
236 var templ_7745c5c3_Var12 string
237 templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(repoPath(repo, "/tree/"+b))
238 if templ_7745c5c3_Err != nil {
239 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/repo_header.templ`, Line: 41, Col: 49}
240 }
241 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
242 if templ_7745c5c3_Err != nil {
243 return templ_7745c5c3_Err
244 }
245 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "\" selected>")
246 if templ_7745c5c3_Err != nil {
247 return templ_7745c5c3_Err
248 }
249 var templ_7745c5c3_Var13 string
250 templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(b)
251 if templ_7745c5c3_Err != nil {
252 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/repo_header.templ`, Line: 41, Col: 64}
253 }
254 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
255 if templ_7745c5c3_Err != nil {
256 return templ_7745c5c3_Err
257 }
258 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</option>")
259 if templ_7745c5c3_Err != nil {
260 return templ_7745c5c3_Err
261 }
262 } else {
263 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<option value=\"")
264 if templ_7745c5c3_Err != nil {
265 return templ_7745c5c3_Err
266 }
267 var templ_7745c5c3_Var14 string
268 templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(repoPath(repo, "/tree/"+b))
269 if templ_7745c5c3_Err != nil {
270 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/repo_header.templ`, Line: 43, Col: 49}
271 }
272 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
273 if templ_7745c5c3_Err != nil {
274 return templ_7745c5c3_Err
275 }
276 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "\">")
277 if templ_7745c5c3_Err != nil {
278 return templ_7745c5c3_Err
279 }
280 var templ_7745c5c3_Var15 string
281 templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(b)
282 if templ_7745c5c3_Err != nil {
283 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/repo_header.templ`, Line: 43, Col: 55}
284 }
285 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
286 if templ_7745c5c3_Err != nil {
287 return templ_7745c5c3_Err
288 }
289 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "</option>")
290 if templ_7745c5c3_Err != nil {
291 return templ_7745c5c3_Err
292 }
293 }
294 }
295 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "</select> <span class=\"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-faint\">▾</span></div>")
296 if templ_7745c5c3_Err != nil {
297 return templ_7745c5c3_Err
298 }
299 return nil
300 })
301}
302
303var _ = templruntime.GeneratedTemplate