this repo has no description
1{{ define "title" }}
2 {{ .Pull.Title }} · pull #{{ .Pull.PullId }} ·
3 {{ .RepoInfo.FullName }}
4{{ end }}
5
6{{ define "repoContent" }}
7 <h1>
8 {{ .Pull.Title }}
9 <span class="text-gray-400">#{{ .Pull.PullId }}</span>
10 </h1>
11 {{ $bgColor := "bg-gray-800" }}
12 {{ $icon := "ban" }}
13 {{ if eq .State "open" }}
14 {{ $bgColor = "bg-green-600" }}
15 {{ $icon = "circle-dot" }}
16 {{ else if eq .State "merged" }}
17 {{ $bgColor = "bg-purple-600" }}
18 {{ $icon = "git-merge" }}
19 {{ end }}
20
21
22 <section>
23 <div class="flex items-center gap-2">
24 <div
25 id="state"
26 class="inline-flex items-center rounded px-3 py-1 {{ $bgColor }}"
27 >
28 <i
29 data-lucide="{{ $icon }}"
30 class="w-4 h-4 mr-1.5 text-white"
31 ></i>
32 <span class="text-white">{{ .State }}</span>
33 </div>
34 <span class="text-gray-400 text-sm">
35 opened by
36 {{ $owner := didOrHandle .Pull.OwnerDid .PullOwnerHandle }}
37 <a href="/{{ $owner }}" class="no-underline hover:underline"
38 >{{ $owner }}</a
39 >
40 <span class="px-1 select-none before:content-['\00B7']"></span>
41 <time>{{ .Pull.Created | timeFmt }}</time>
42 </span>
43 </div>
44
45 {{ if .Pull.Body }}
46 <article id="body" class="mt-8 prose">
47 {{ .Pull.Body | markdown }}
48 </article>
49 {{ end }}
50 </section>
51
52 <div>
53 <details>
54 <summary
55 class="list-none cursor-pointer sticky top-0 bg-white rounded-sm px-3 py-2 border border-gray-200 flex items-center text-gray-700 hover:bg-gray-50 transition-colors"
56 >
57 <i data-lucide="code" class="w-4 h-4 mr-2"></i>
58 <span>patch</span>
59 </summary>
60 <pre class="font-mono overflow-x-scroll bg-gray-50 p-4 rounded-b border border-gray-200 text-sm">
61 {{- .Pull.Patch -}}
62 </pre>
63 </details>
64 </div>
65
66 <div class="mt-4">
67 {{ if .MergeCheck }}
68 <div class="rounded-sm border p-4 {{ if .MergeCheck.IsConflicted }}bg-red-50 border-red-200{{ else }}bg-green-50 border-green-200{{ end }}">
69 <div class="flex items-center gap-2 rounded-sm {{ if .MergeCheck.IsConflicted }}text-red-500{{ else }}text-green-500 {{ end }}">
70 {{ if .MergeCheck.IsConflicted }}
71 <i data-lucide="alert-triangle" class="w-4 h-4"></i>
72 <span class="font-medium">merge conflicts detected</span>
73 {{ else }}
74 <i data-lucide="check-circle" class="w-4 h-4"></i>
75 <span class="font-medium">ready to merge</span>
76 {{ end }}
77 </div>
78
79 {{ if .MergeCheck.IsConflicted }}
80 <div class="mt-2">
81 <ul class="text-sm space-y-1">
82 {{ range .MergeCheck.Conflicts }}
83 <li class="flex items-center">
84 <i data-lucide="file-warning" class="w-3 h-3 mr-1.5 text-red-500"></i>
85 <span class="font-mono">{{ slice .Filename 0 (sub (len .Filename) 2) }}</span>
86 </li>
87 {{ end }}
88 </ul>
89 </div>
90 {{ end }}
91 </div>
92 {{ end }}
93 </div>
94{{ end }}
95
96{{ define "repoAfter" }}
97 <section id="comments" class="mt-8 space-y-4 relative">
98 {{ range $index, $comment := .Comments }}
99 <div
100 id="comment-{{ .CommentId }}"
101 class="rounded bg-white p-4 relative"
102 >
103 {{ if eq $index 0 }}
104 <div
105 class="absolute left-8 -top-8 w-px h-8 bg-gray-300"
106 ></div>
107 {{ else }}
108 <div
109 class="absolute left-8 -top-4 w-px h-4 bg-gray-300"
110 ></div>
111 {{ end }}
112 <div class="flex items-center gap-2 mb-2 text-gray-400">
113 {{ $owner := index $.DidHandleMap .OwnerDid }}
114 <span class="text-sm">
115 <a
116 href="/{{ $owner }}"
117 class="no-underline hover:underline"
118 >{{ $owner }}</a
119 >
120 </span>
121 <span
122 class="px-1 select-none before:content-['\00B7']"
123 ></span>
124 <a
125 href="#{{ .CommentId }}"
126 class="text-gray-500 text-sm hover:text-gray-500 hover:underline no-underline"
127 id="{{ .CommentId }}"
128 >
129 {{ .Created | timeFmt }}
130 </a>
131 </div>
132 <div class="prose">
133 {{ .Body | markdown }}
134 </div>
135 </div>
136 {{ end }}
137 </section>
138
139 {{ if .LoggedInUser }}
140 <form
141 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/comment"
142 class="mt-8"
143 >
144 <textarea
145 name="body"
146 class="w-full p-2 rounded border border-gray-200"
147 placeholder="Add to the discussion..."
148 ></textarea>
149 <button type="submit" class="btn mt-2">comment</button>
150 <div id="pull-comment"></div>
151 </form>
152 {{ end }}
153
154 {{ if eq .LoggedInUser.Did .Pull.OwnerDid }}
155 {{ $action := "close" }}
156 {{ $icon := "circle-x" }}
157 {{ $hoverColor := "red" }}
158 {{ if eq .State "closed" }}
159 {{ $action = "reopen" }}
160 {{ $icon = "circle-dot" }}
161 {{ $hoverColor = "green" }}
162 {{ end }}
163 <form
164 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/{{ $action }}"
165 hx-swap="none"
166 class="mt-8"
167 >
168 <button type="submit" class="btn hover:bg-{{ $hoverColor }}-300">
169 <i
170 data-lucide="{{ $icon }}"
171 class="w-4 h-4 mr-2 text-{{ $hoverColor }}-400"
172 ></i>
173 <span class="text-black">{{ $action }}</span>
174 </button>
175 <div id="pull-action" class="error"></div>
176 </form>
177 {{ end }}
178{{ end }}