forked from tangled.org/core
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166{{ define "title" }}pulls · {{ .RepoInfo.FullName }}{{ end }}
{{ define "extrameta" }} {{ $title := "pulls"}} {{ $url := printf "https://tangled.sh/%s/pulls" .RepoInfo.FullName }} {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}{{ end }}
{{ define "repoContent" }} <div class="flex justify-between items-center"> <div class="flex gap-4"> <a href="?state=open" class="flex items-center gap-2 {{ if .FilteringBy.IsOpen }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}" > {{ i "git-pull-request" "w-4 h-4" }} <span>{{ .RepoInfo.Stats.PullCount.Open }} open</span> </a> <a href="?state=merged" class="flex items-center gap-2 {{ if .FilteringBy.IsMerged }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}" > {{ i "git-merge" "w-4 h-4" }} <span>{{ .RepoInfo.Stats.PullCount.Merged }} merged</span> </a> <a href="?state=closed" class="flex items-center gap-2 {{ if .FilteringBy.IsClosed }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}" > {{ i "ban" "w-4 h-4" }} <span>{{ .RepoInfo.Stats.PullCount.Closed }} closed</span> </a> </div> <a href="/{{ .RepoInfo.FullName }}/pulls/new" class="btn text-sm flex items-center gap-2 no-underline hover:no-underline" > {{ i "git-pull-request-create" "w-4 h-4" }} <span>new</span> </a> </div> <div class="error" id="pulls"></div>{{ end }}
{{ define "repoAfter" }} <div class="flex flex-col gap-2 mt-2"> {{ range .Pulls }} <div class="rounded bg-white dark:bg-gray-800"> <div class="px-6 py-4 z-5"> <div class="pb-2"> <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ .PullId }}" class="dark:text-white"> {{ .Title }} <span class="text-gray-500 dark:text-gray-400">#{{ .PullId }}</span> </a> </div> <p class="text-sm text-gray-500 dark:text-gray-400"> {{ $owner := index $.DidHandleMap .OwnerDid }} {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} {{ $icon := "ban" }}
{{ if .State.IsOpen }} {{ $bgColor = "bg-green-600 dark:bg-green-700" }} {{ $icon = "git-pull-request" }} {{ else if .State.IsMerged }} {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} {{ $icon = "git-merge" }} {{ end }}
<span class="inline-flex items-center rounded px-2 py-[5px] {{ $bgColor }} text-sm" > {{ i $icon "w-3 h-3 mr-1.5 text-white" }} <span class="text-white">{{ .State.String }}</span> </span>
<span> <a href="/{{ $owner }}" class="dark:text-gray-300">{{ $owner }}</a> </span>
<span class="before:content-['·']"> <time> {{ .Created | timeFmt }} </time> </span>
<span class="before:content-['·']"> targeting <span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center"> {{ .TargetBranch }} </span> </span> {{ if not .IsPatchBased }} from <span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center"> {{ if .IsForkBased }} {{ if .PullSource.Repo }} <a href="/{{ $owner }}/{{ .PullSource.Repo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .PullSource.Repo.Name }}</a>: {{- else -}} <span class="italic">[deleted fork]</span> {{- end -}} {{- end -}} {{- .PullSource.Branch -}} </span> {{ end }} <span class="before:content-['·']"> {{ $latestRound := .LastRoundNumber }} {{ $lastSubmission := index .Submissions $latestRound }} round <span class="text-xs rounded bg-gray-100 dark:bg-gray-700 text-black dark:text-white font-mono px-2 mx-1/2 inline-flex items-center"> #{{ .LastRoundNumber }} </span> {{ $commentCount := len $lastSubmission.Comments }} {{ $s := "s" }} {{ if eq $commentCount 1 }} {{ $s = "" }} {{ end }}
{{ if eq $commentCount 0 }} awaiting comments {{ else }} recieved {{ len $lastSubmission.Comments}} comment{{$s}} {{ end }} </span> </p> </div> {{ if .StackId }} {{ $otherPulls := index $.Stacks .StackId }} <details class="bg-white dark:bg-gray-800 group"> <summary class="pb-4 px-6 text-xs list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400"> {{ $s := "s" }} {{ if eq (len $otherPulls) 1 }} {{ $s = "" }} {{ end }} <div class="group-open:hidden flex items-center gap-2"> {{ i "chevrons-up-down" "w-4 h-4" }} expand {{ len $otherPulls }} pull{{$s}} in this stack </div> <div class="hidden group-open:flex items-center gap-2"> {{ i "chevrons-down-up" "w-4 h-4" }} hide {{ len $otherPulls }} pull{{$s}} in this stack </div> </summary> {{ block "pullList" (list $otherPulls $) }} {{ end }} </details> {{ end }} </div> {{ end }} </div>{{ end }}
{{ define "pullList" }} {{ $list := index . 0 }} {{ $root := index . 1 }} <div class="grid grid-cols-1 rounded-b border-b border-t border-gray-200 dark:border-gray-900 divide-y divide-gray-200 dark:divide-gray-900"> {{ range $pull := $list }} <a href="/{{ $root.RepoInfo.FullName }}/pulls/{{ $pull.PullId }}" class="no-underline hover:no-underline hover:bg-gray-100/25 hover:dark:bg-gray-700/25"> <div class="flex gap-2 items-center px-6"> <div class="flex-grow min-w-0 w-full py-2"> {{ template "repo/pulls/fragments/summarizedHeader" $pull }} </div> </div> </a> {{ end }} </div>{{ end }}