2024-01-16 04:54:43 +00:00
|
|
|
package html
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
import "github.com/dustin/go-humanize"
|
|
|
|
import "go.jolheiser.com/ugit/internal/git"
|
|
|
|
|
|
|
|
type RepoLogContext struct {
|
|
|
|
BaseContext
|
|
|
|
RepoHeaderComponentContext
|
|
|
|
Commits []git.Commit
|
|
|
|
}
|
|
|
|
|
|
|
|
templ RepoLog(rlc RepoLogContext) {
|
|
|
|
@base(rlc.BaseContext) {
|
|
|
|
@repoHeaderComponent(rlc.RepoHeaderComponentContext)
|
2024-03-22 18:12:47 +00:00
|
|
|
<div class="grid sm:grid-cols-8 gap-1 text-text mt-5">
|
2024-01-16 04:54:43 +00:00
|
|
|
for _, commit := range rlc.Commits {
|
2024-03-22 18:12:47 +00:00
|
|
|
<div class="sm:col-span-5">
|
2024-01-17 03:37:25 +00:00
|
|
|
<div><a class="underline decoration-text/50 decoration-dashed hover:decoration-solid" href={ templ.SafeURL(fmt.Sprintf("/%s/commit/%s", rlc.RepoHeaderComponentContext.Name, commit.SHA)) }>{ commit.Short() }</a></div>
|
2024-01-16 04:54:43 +00:00
|
|
|
<div class="whitespace-pre">
|
|
|
|
if commit.Details() != "" {
|
2024-03-01 21:34:50 +00:00
|
|
|
<details>
|
|
|
|
<summary class="cursor-pointer">{ commit.Summary() }</summary>
|
|
|
|
<div class="p-3 bg-base rounded">{ commit.Details() }</div>
|
|
|
|
</details>
|
2024-01-16 04:54:43 +00:00
|
|
|
} else {
|
|
|
|
{ commit.Message }
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-22 18:12:47 +00:00
|
|
|
<div class="sm:col-span-3 mb-4">
|
2024-01-16 04:54:43 +00:00
|
|
|
<div>{ commit.Author }{ " " }<a class="underline decoration-text/50 decoration-dashed hover:decoration-solid" href={ templ.SafeURL(fmt.Sprintf("mailto:%s", commit.Email)) }>{ fmt.Sprintf("<%s>", commit.Email) }</a></div>
|
|
|
|
<div title={ commit.When.Format("01/02/2006 03:04:05 PM") }>{ humanize.Time(commit.When) }</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|