ikurotime / gitgud

public
main / internal/interface/web/templates/new_repo_templ.go
6.4 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 NewRepo(user *domain.User, name, description string, private bool, errMsg 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<div class=\"mx-auto max-w-lg\"><h1 class=\"mb-1 text-xl font-semibold tracking-tight\">Create a new repository</h1><p class=\"mb-6 text-sm text-muted\">A repository contains all your project's files and history.</p><div class=\"card p-6\">")
 47			if templ_7745c5c3_Err != nil {
 48				return templ_7745c5c3_Err
 49			}
 50			if errMsg != "" {
 51				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<div class=\"mb-4 rounded-md border border-closed/30 bg-closed/10 px-3 py-2 text-sm text-closed\">")
 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(errMsg)
 57				if templ_7745c5c3_Err != nil {
 58					return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/new_repo.templ`, Line: 12, Col: 109}
 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, 3, "</div>")
 65				if templ_7745c5c3_Err != nil {
 66					return templ_7745c5c3_Err
 67				}
 68			}
 69			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "<form method=\"post\" action=\"/new\" class=\"flex flex-col gap-4\">")
 70			if templ_7745c5c3_Err != nil {
 71				return templ_7745c5c3_Err
 72			}
 73			templ_7745c5c3_Err = csrfField().Render(ctx, templ_7745c5c3_Buffer)
 74			if templ_7745c5c3_Err != nil {
 75				return templ_7745c5c3_Err
 76			}
 77			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<label class=\"flex flex-col gap-1.5\"><span class=\"text-xs font-medium text-muted\">Repository name</span> <input class=\"input font-mono\" type=\"text\" name=\"name\" value=\"")
 78			if templ_7745c5c3_Err != nil {
 79				return templ_7745c5c3_Err
 80			}
 81			var templ_7745c5c3_Var4 string
 82			templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(name)
 83			if templ_7745c5c3_Err != nil {
 84				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/new_repo.templ`, Line: 18, Col: 73}
 85			}
 86			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
 87			if templ_7745c5c3_Err != nil {
 88				return templ_7745c5c3_Err
 89			}
 90			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "\" placeholder=\"my-project\" autofocus></label> <label class=\"flex flex-col gap-1.5\"><span class=\"text-xs font-medium text-muted\">Description <span class=\"text-faint\">(optional)</span></span> <input class=\"input\" type=\"text\" name=\"description\" value=\"")
 91			if templ_7745c5c3_Err != nil {
 92				return templ_7745c5c3_Err
 93			}
 94			var templ_7745c5c3_Var5 string
 95			templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(description)
 96			if templ_7745c5c3_Err != nil {
 97				return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/interface/web/templates/new_repo.templ`, Line: 22, Col: 77}
 98			}
 99			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
100			if templ_7745c5c3_Err != nil {
101				return templ_7745c5c3_Err
102			}
103			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "\"></label> <label class=\"flex cursor-pointer items-center gap-2.5 rounded-md border border-line bg-panel2 px-3 py-2.5\">")
104			if templ_7745c5c3_Err != nil {
105				return templ_7745c5c3_Err
106			}
107			if private {
108				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<input type=\"checkbox\" name=\"private\" class=\"accent-accent\" checked> ")
109				if templ_7745c5c3_Err != nil {
110					return templ_7745c5c3_Err
111				}
112			} else {
113				templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<input type=\"checkbox\" name=\"private\" class=\"accent-accent\"> ")
114				if templ_7745c5c3_Err != nil {
115					return templ_7745c5c3_Err
116				}
117			}
118			templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "<span class=\"text-sm text-ink\">Private</span> <span class=\"text-xs text-faint\">— only you can see it</span></label> <button class=\"btn btn-primary mt-1 justify-center\" type=\"submit\">Create repository</button></form></div></div>")
119			if templ_7745c5c3_Err != nil {
120				return templ_7745c5c3_Err
121			}
122			return nil
123		})
124		templ_7745c5c3_Err = Layout("New repository · gitgud", user).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
125		if templ_7745c5c3_Err != nil {
126			return templ_7745c5c3_Err
127		}
128		return nil
129	})
130}
131
132var _ = templruntime.GeneratedTemplate