{{ define "repo/pulls/fragments/pullHeader" }}

{{ .Pull.Title | description }} #{{ .Pull.PullId }}

{{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} {{ $icon := "ban" }} {{ if .Pull.State.IsOpen }} {{ $bgColor = "bg-green-600 dark:bg-green-700" }} {{ $icon = "git-pull-request" }} {{ else if .Pull.State.IsMerged }} {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} {{ $icon = "git-merge" }} {{ end }}
{{ i $icon "w-4 h-4 mr-1.5 text-white" }} {{ .Pull.State.String }}
opened by {{ template "user/fragments/picHandleLink" .Pull.OwnerDid }} {{ template "repo/fragments/time" .Pull.Created }} targeting {{ .Pull.TargetBranch }} {{ if not .Pull.IsPatchBased }} from {{ if not .Pull.IsForkBased }} {{ $repoPath := .RepoInfo.FullName }} {{ .Pull.PullSource.Branch }} {{ else if .Pull.PullSource.Repo }} {{ $repoPath := print (resolve .Pull.PullSource.Repo.Did) "/" .Pull.PullSource.Repo.Name }} {{ $repoPath }}: {{ .Pull.PullSource.Branch }} {{ else }} [deleted fork]: {{ .Pull.PullSource.Branch }} {{ end }} {{ end }}
{{ if .Pull.Body }}
{{ .Pull.Body | markdown }}
{{ end }} {{ with .OrderedReactionKinds }}
{{ template "repo/fragments/reactionsPopUp" . }} {{ range $kind := . }} {{ $reactionData := index $.Reactions $kind }} {{ template "repo/fragments/reaction" (dict "Kind" $kind "Count" $reactionData.Count "IsReacted" (index $.UserReacted $kind) "ThreadAt" $.Pull.PullAt "Users" $reactionData.Users) }} {{ end }}
{{ end }}
{{ end }}