package templates
import "gitgud/internal/domain"
templ PullDetail(user *domain.User, repo *domain.Repository, pr *domain.PullRequest, cmp *domain.Comparison, comments []*domain.PRComment, canMerge bool, errMsg string) {
@Layout(pr.Title+" · "+repo.Name, user) {
@repoHeader(repo, "pulls")
{ pr.Title } #{ itoa(pr.Number) }
if pr.State == domain.PROpen {
Open
} else if pr.State == domain.PRMerged {
Merged
} else {
Closed
}
{ pr.AuthorName } wants to merge { pr.HeadBranch } into { pr.BaseBranch }
if errMsg != "" {
{ errMsg }
}
@commentCard(pr.AuthorName, fmtTime(pr.CreatedAt), pr.Body)
for _, c := range comments {
@commentCard(c.AuthorName, fmtTime(c.CreatedAt), c.Body)
}
if pr.State == domain.PRMerged {
This pull request was merged.
} else if pr.State == domain.PRClosed {
This pull request was closed.
} else if canMerge {
✓
This branch has no conflicts with the base branch
Merging can be performed automatically.
} else if user != nil {
You don't have permission to merge this pull request.
} else {
Sign in to act on this pull request.
}
if cmp != nil {
{ itoa(len(cmp.Commits)) } commits
@commitsList(repo, cmp.Commits)
Files changed
@diffFiles(cmp.Files)
}
if user != nil {
}
}
}