package html import "fmt" import "github.com/dustin/go-humanize" import "go.jolheiser.com/ugit/internal/git" type RepoCommitContext struct{ BaseContext RepoHeaderComponentContext Commit git.Commit } templ RepoCommit(rcc RepoCommitContext) { @base(rcc.BaseContext) { @repoHeaderComponent(rcc.RepoHeaderComponentContext)
tree{ " " }log{ " " }patch
{ rcc.Commit.Message }
{ rcc.Commit.Author }{ " " }{ fmt.Sprintf("<%s>", rcc.Commit.Email) }
{ humanize.Time(rcc.Commit.When) }
{ fmt.Sprintf("%d changed files, %d additions(+), %d deletions(-)", rcc.Commit.Stats.Changed, rcc.Commit.Stats.Additions, rcc.Commit.Stats.Deletions) }
for _, file := range rcc.Commit.Files {
{ string(file.Action[0]) } { " " } if file.From.Path != "" { { file.From.Path } } if file.From.Path != "" && file.To.Path != "" { { " -> " } } if file.To.Path != "" { { file.To.Path } }
@templ.Raw(file.Patch)
} } }