main / internal/interface/web/templates/browse_blob_templ.go
6.8 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 BrowseBlob(user *domain.User, repo *domain.Repository, ref string, blob *domain.FileBlob, highlighted 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_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
35 templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
36 templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
37 if !templ_7745c5c3_IsBuffer {
38 defer func() {
39 templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
40 if templ_7745c5c3_Err == nil {
41 templ_7745c5c3_Err = templ_7745c5c3_BufErr
42 }
43 }()
44 }
45 ctx = templ.InitializeContext(ctx)
46 templ_7745c5c3_Err = repoHeader(repo, "code").Render(ctx, templ_7745c5c3_Buffer)
47 if templ_7745c5c3_Err != nil {
48 return templ_7745c5c3_Err
49 }
50 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " <div class=\"mb-3 flex items-center gap-2 font-mono text-sm\"><span class=\"inline-flex items-center gap-2 rounded-md border border-line2 bg-panel2 px-2.5 py-1 text-xs text-ink\"><span class=\"inline-block size-2 rounded-full border-[1.5px] border-accent\"></span>")
51 if templ_7745c5c3_Err != nil {
52 return templ_7745c5c3_Err
53 }
54 var templ_7745c5c3_Var3 string
55 templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(ref)
56 if templ_7745c5c3_Err != nil {
57 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/browse_blob.templ`, Line: 10, Col: 92}
58 }
59 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
60 if templ_7745c5c3_Err != nil {
61 return templ_7745c5c3_Err
62 }
63 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "</span> <span class=\"text-faint\">/</span> <span class=\"text-accent\">")
64 if templ_7745c5c3_Err != nil {
65 return templ_7745c5c3_Err
66 }
67 var templ_7745c5c3_Var4 string
68 templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(blob.Path)
69 if templ_7745c5c3_Err != nil {
70 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/browse_blob.templ`, Line: 13, Col: 40}
71 }
72 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
73 if templ_7745c5c3_Err != nil {
74 return templ_7745c5c3_Err
75 }
76 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "</span></div><div class=\"card overflow-hidden\"><div class=\"flex items-center justify-between border-b border-line bg-[#0e1410] px-4 py-2.5 font-mono text-xs text-muted\"><span>")
77 if templ_7745c5c3_Err != nil {
78 return templ_7745c5c3_Err
79 }
80 var templ_7745c5c3_Var5 string
81 templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(humanSize(blob.Size))
82 if templ_7745c5c3_Err != nil {
83 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/browse_blob.templ`, Line: 17, Col: 32}
84 }
85 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
86 if templ_7745c5c3_Err != nil {
87 return templ_7745c5c3_Err
88 }
89 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, " · <span class=\"text-accent\">")
90 if templ_7745c5c3_Err != nil {
91 return templ_7745c5c3_Err
92 }
93 var templ_7745c5c3_Var6 string
94 templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(langLabel(blob.Path))
95 if templ_7745c5c3_Err != nil {
96 return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/browse_blob.templ`, Line: 17, Col: 86}
97 }
98 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
99 if templ_7745c5c3_Err != nil {
100 return templ_7745c5c3_Err
101 }
102 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "</span></span> <a class=\"rounded border border-line2 px-2.5 py-1 text-ink transition hover:border-faint hover:bg-panel2\" href=\"")
103 if templ_7745c5c3_Err != nil {
104 return templ_7745c5c3_Err
105 }
106 var templ_7745c5c3_Var7 templ.SafeURL = templ.SafeURL(repoPath(repo, "/raw/"+ref+"/"+blob.Path))
107 _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7)))
108 if templ_7745c5c3_Err != nil {
109 return templ_7745c5c3_Err
110 }
111 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\">Raw</a></div>")
112 if templ_7745c5c3_Err != nil {
113 return templ_7745c5c3_Err
114 }
115 if blob.IsBinary {
116 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<div class=\"px-4 py-10 text-center text-sm text-faint\">Binary file not shown.</div>")
117 if templ_7745c5c3_Err != nil {
118 return templ_7745c5c3_Err
119 }
120 } else {
121 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<div class=\"overflow-x-auto bg-[#0c0c0c] text-xs leading-relaxed [&_pre]:!bg-transparent\">")
122 if templ_7745c5c3_Err != nil {
123 return templ_7745c5c3_Err
124 }
125 templ_7745c5c3_Err = templ.Raw(highlighted).Render(ctx, templ_7745c5c3_Buffer)
126 if templ_7745c5c3_Err != nil {
127 return templ_7745c5c3_Err
128 }
129 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</div>")
130 if templ_7745c5c3_Err != nil {
131 return templ_7745c5c3_Err
132 }
133 }
134 templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "</div>")
135 if templ_7745c5c3_Err != nil {
136 return templ_7745c5c3_Err
137 }
138 return nil
139 })
140 templ_7745c5c3_Err = Layout(blob.Path+" · gitgud", user).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
141 if templ_7745c5c3_Err != nil {
142 return templ_7745c5c3_Err
143 }
144 return nil
145 })
146}
147
148var _ = templruntime.GeneratedTemplate