forked from
tangled.org/core
Monorepo for Tangled — https://tangled.org
1{{ define "title" }}pulls · {{ .RepoInfo.FullName }}{{ end }}
2
3{{ define "extrameta" }}
4 {{ $title := "pulls"}}
5 {{ $url := printf "https://tangled.sh/%s/pulls" .RepoInfo.FullName }}
6
7 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }}
8{{ end }}
9
10{{ define "repoContent" }}
11 <div class="flex justify-between items-center">
12 <div class="flex gap-4">
13 <a
14 href="?state=open"
15 class="flex items-center gap-2 {{ if .FilteringBy.IsOpen }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}"
16 >
17 {{ i "git-pull-request" "w-4 h-4" }}
18 <span>{{ .RepoInfo.Stats.PullCount.Open }} open</span>
19 </a>
20 <a
21 href="?state=merged"
22 class="flex items-center gap-2 {{ if .FilteringBy.IsMerged }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}"
23 >
24 {{ i "git-merge" "w-4 h-4" }}
25 <span>{{ .RepoInfo.Stats.PullCount.Merged }} merged</span>
26 </a>
27 <a
28 href="?state=closed"
29 class="flex items-center gap-2 {{ if .FilteringBy.IsClosed }}font-bold {{ else }}text-gray-500 dark:text-gray-400{{ end }}"
30 >
31 {{ i "ban" "w-4 h-4" }}
32 <span>{{ .RepoInfo.Stats.PullCount.Closed }} closed</span>
33 </a>
34 </div>
35 <a
36 href="/{{ .RepoInfo.FullName }}/pulls/new"
37 class="btn text-sm flex items-center gap-2 no-underline hover:no-underline"
38 >
39 {{ i "git-pull-request-create" "w-4 h-4" }}
40 <span>new</span>
41 </a>
42 </div>
43 <div class="error" id="pulls"></div>
44{{ end }}
45
46{{ define "repoAfter" }}
47 <div class="flex flex-col gap-2 mt-2">
48 {{ range .Pulls }}
49 <div class="rounded drop-shadow-sm bg-white dark:bg-gray-800 px-6 py-4">
50 <div class="pb-2">
51 <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ .PullId }}" class="dark:text-white">
52 {{ .Title }}
53 <span class="text-gray-500 dark:text-gray-400">#{{ .PullId }}</span>
54 </a>
55 </div>
56 <p class="text-sm text-gray-500 dark:text-gray-400">
57 {{ $owner := index $.DidHandleMap .OwnerDid }}
58 {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }}
59 {{ $icon := "ban" }}
60
61 {{ if .State.IsOpen }}
62 {{ $bgColor = "bg-green-600 dark:bg-green-700" }}
63 {{ $icon = "git-pull-request" }}
64 {{ else if .State.IsMerged }}
65 {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }}
66 {{ $icon = "git-merge" }}
67 {{ end }}
68
69
70 <span
71 class="inline-flex items-center rounded px-2 py-[5px] {{ $bgColor }} text-sm"
72 >
73 {{ i $icon "w-3 h-3 mr-1.5 text-white" }}
74 <span class="text-white">{{ .State.String }}</span>
75 </span>
76
77 <span>
78 <a href="/{{ $owner }}" class="dark:text-gray-300">{{ $owner }}</a>
79 </span>
80
81 <span class="before:content-['·']">
82 <time>
83 {{ .Created | timeFmt }}
84 </time>
85 </span>
86
87 <span class="before:content-['·']">
88 targeting
89 <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">
90 {{ .TargetBranch }}
91 </span>
92 </span>
93 {{ if not .IsPatchBased }}
94 from
95 <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">
96 {{ if .IsForkBased }}
97 {{ if .PullSource.Repo }}
98 <a href="/{{ $owner }}/{{ .PullSource.Repo.Name }}" class="no-underline hover:underline">{{ $owner }}/{{ .PullSource.Repo.Name }}</a>:
99 {{- else -}}
100 <span class="italic">[deleted fork]</span>
101 {{- end -}}
102 {{- end -}}
103 {{- .PullSource.Branch -}}
104 </span>
105 {{ end }}
106 <span class="before:content-['·']">
107 {{ $latestRound := .LastRoundNumber }}
108 {{ $lastSubmission := index .Submissions $latestRound }}
109 round
110 <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">
111 #{{ .LastRoundNumber }}
112 </span>
113 {{ $commentCount := len $lastSubmission.Comments }}
114 {{ $s := "s" }}
115 {{ if eq $commentCount 1 }}
116 {{ $s = "" }}
117 {{ end }}
118
119 {{ if eq $commentCount 0 }}
120 awaiting comments
121 {{ else }}
122 recieved {{ len $lastSubmission.Comments}} comment{{$s}}
123 {{ end }}
124 </span>
125 </p>
126 </div>
127 {{ end }}
128 </div>
129{{ end }}