{{ define "title" }} {{ .Pull.Title }} · pull #{{ .Pull.PullId }} · {{ .RepoInfo.FullName }} {{ end }} {{ define "repoContent" }}

{{ .Pull.Title }} #{{ .Pull.PullId }}

{{ $bgColor := "bg-gray-800" }} {{ $icon := "ban" }} {{ if .Pull.State.IsOpen }} {{ $bgColor = "bg-green-600" }} {{ $icon = "git-pull-request" }} {{ else if .Pull.State.IsMerged }} {{ $bgColor = "bg-purple-600" }} {{ $icon = "git-merge" }} {{ end }}
{{ .Pull.State.String }}
opened by {{ $owner := index $.DidHandleMap .Pull.OwnerDid }} {{ $owner }}
{{ if .Pull.Body }}
{{ .Pull.Body | markdown }}
{{ end }}
patch
       {{- .Pull.Patch -}}
                
{{ end }} {{ define "repoAfter" }} {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
{{ block "comments" . }} {{ end }} {{ if .Pull.State.IsMerged }} {{ block "alreadyMergedCard" . }} {{ end }} {{ else if .MergeCheck }} {{ if .MergeCheck.IsConflicted }} {{ block "isConflictedCard" . }} {{ end }} {{ else }} {{ block "noConflictsCard" . }} {{ end }} {{ end }} {{ end }}
{{ block "newComment" . }} {{ end }} {{ if and (or $isPullAuthor $isRepoCollaborator) (not .Pull.State.IsMerged) }} {{ $action := "close" }} {{ $icon := "circle-x" }} {{ $hoverColor := "red" }} {{ if .Pull.State.IsClosed }} {{ $action = "reopen" }} {{ $icon = "circle-dot" }} {{ $hoverColor = "green" }} {{ end }} {{ end }}
{{ end }} {{ define "comments" }} {{ range $index, $comment := .Comments }}
{{ if eq $index 0 }}
{{ else }}
{{ end }}
{{ $owner := index $.DidHandleMap .OwnerDid }} {{ $owner }} {{ .Created | timeFmt }}
{{ .Body | markdown }}
{{ end }} {{ end }} {{ define "newComment" }} {{ if .LoggedInUser }}
{{ else }}
login to join the discussion
{{ end }} {{ end }} {{ define "alreadyMergedCard" }}
{{ if gt (len .Comments) 0 }}
{{ else }}
{{ end }}
Pull request successfully merged

This pull request has been merged into the base branch.

{{ end }} {{ define "isConflictedCard" }}
{{ if gt (len .Comments) 0 }}
{{ else }}
{{ end }}
merge conflicts detected

Please resolve these conflicts locally and update the patch to continue with the merge.

{{ end }} {{ define "noConflictsCard" }} {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
{{ if gt (len .Comments) 0 }}
{{ else }}
{{ end }}
ready to merge
No conflicts detected with the base branch. This pull request can be merged safely.
{{ if $isRepoCollaborator }} {{ end }}
{{ end }}