A vibe coded tangled fork which supports pijul.
at master 264 lines 11 kB view raw
1{{ define "title" }}{{ .Discussion.Title }} &middot; discussion #{{ .Discussion.DiscussionId }} &middot; {{ .RepoInfo.FullName }}{{ end }} 2 3{{ define "repoContentLayout" }} 4 <div class="grid grid-cols-1 md:grid-cols-10 gap-4 w-full"> 5 <div class="col-span-1 md:col-span-8"> 6 <section class="bg-white dark:bg-gray-800 p-6 rounded relative w-full mx-auto dark:text-white"> 7 {{ block "repoContent" . }}{{ end }} 8 </section> 9 {{ block "repoAfter" . }}{{ end }} 10 </div> 11 <div class="col-span-1 md:col-span-2 flex flex-col gap-6"> 12 {{ template "discussionSidebar" . }} 13 </div> 14 </div> 15{{ end }} 16 17{{ define "discussionSidebar" }} 18 <div class="bg-white dark:bg-gray-800 rounded p-4"> 19 <h3 class="text-sm font-semibold mb-2">Target Channel</h3> 20 <div class="flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400"> 21 {{ i "git-branch" "w-4 h-4" }} 22 <span>{{ .Discussion.TargetChannel }}</span> 23 </div> 24 </div> 25 26 <div class="bg-white dark:bg-gray-800 rounded p-4"> 27 <h3 class="text-sm font-semibold mb-2">Patches ({{ len .ActivePatches }})</h3> 28 {{ if .ActivePatches }} 29 <ul class="text-sm space-y-1"> 30 {{ range .ActivePatches }} 31 <li class="flex items-center gap-2 text-gray-600 dark:text-gray-400"> 32 {{ i "file-diff" "w-3 h-3" }} 33 <code class="text-xs">{{ .PatchHash | truncate 12 }}</code> 34 </li> 35 {{ end }} 36 </ul> 37 {{ else }} 38 <p class="text-sm text-gray-500 dark:text-gray-400">No patches yet</p> 39 {{ end }} 40 </div> 41 42 {{ template "repo/fragments/participants" .Discussion.Participants }} 43{{ end }} 44 45{{ define "repoContent" }} 46<section id="discussion-{{ .Discussion.DiscussionId }}"> 47 {{ template "discussionHeader" . }} 48 {{ template "discussionInfo" . }} 49 {{ if .Discussion.Body }} 50 <article id="body" class="mt-4 prose dark:prose-invert">{{ .Discussion.Body | markdown }}</article> 51 {{ end }} 52</section> 53{{ end }} 54 55{{ define "discussionHeader" }} 56 <header class="pb-2"> 57 <h1 class="text-2xl"> 58 {{ .Discussion.Title | description }} 59 <span class="text-gray-500 dark:text-gray-400">#{{ .Discussion.DiscussionId }}</span> 60 </h1> 61 </header> 62{{ end }} 63 64{{ define "discussionInfo" }} 65 {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} 66 {{ $icon := "ban" }} 67 {{ $stateText := "closed" }} 68 {{ if .Discussion.State.IsOpen }} 69 {{ $bgColor = "bg-green-600 dark:bg-green-700" }} 70 {{ $icon = "message-circle" }} 71 {{ $stateText = "open" }} 72 {{ else if .Discussion.State.IsMerged }} 73 {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} 74 {{ $icon = "git-merge" }} 75 {{ $stateText = "merged" }} 76 {{ end }} 77 78 <div class="inline-flex items-center gap-2 flex-wrap"> 79 <span class="inline-flex items-center rounded px-2 py-[5px] {{ $bgColor }}"> 80 {{ i $icon "w-3 h-3 mr-1.5 text-white dark:text-white" }} 81 <span class="text-white dark:text-white text-sm">{{ $stateText }}</span> 82 </span> 83 84 <span class="text-gray-500 dark:text-gray-400 text-sm flex flex-wrap items-center gap-1"> 85 opened by 86 {{ template "user/fragments/picHandleLink" .Discussion.Did }} 87 <span class="select-none before:content-['\00B7']"></span> 88 {{ if .Discussion.Edited }} 89 edited {{ template "repo/fragments/time" .Discussion.Edited }} 90 {{ else }} 91 {{ template "repo/fragments/time" .Discussion.Created }} 92 {{ end }} 93 </span> 94 </div> 95 <div id="discussion-actions-error" class="error"></div> 96{{ end }} 97 98{{ define "repoAfter" }} 99 <div class="flex flex-col gap-4 mt-4"> 100 <!-- Patches section --> 101 <section class="bg-white dark:bg-gray-800 p-6 rounded"> 102 <h3 class="text-lg font-semibold mb-4">Patches</h3> 103 {{ if .Discussion.Patches }} 104 <div class="space-y-3"> 105 {{ range .Discussion.Patches }} 106 <div class="border rounded p-4 dark:border-gray-700 {{ if not .IsActive }}opacity-50{{ end }}"> 107 <div class="flex items-center justify-between"> 108 <div class="flex items-center gap-2"> 109 {{ i "file-diff" "w-4 h-4 text-gray-500" }} 110 <code class="text-sm font-mono">{{ .PatchHash | truncate 20 }}</code> 111 {{ if not .IsActive }} 112 <span class="text-xs text-red-500">(removed)</span> 113 {{ end }} 114 </div> 115 <div class="flex items-center gap-2 text-sm text-gray-500"> 116 <span>by {{ template "user/fragments/picHandleLink" .PushedByDid }}</span> 117 <span>{{ template "repo/fragments/time" .Added }}</span> 118 </div> 119 </div> 120 {{ if $.CanManage }} 121 <div class="mt-2 flex gap-2"> 122 {{ if .IsActive }} 123 <form hx-delete="/{{ $.RepoInfo.FullName }}/discussions/{{ $.Discussion.DiscussionId }}/patches/{{ .Id }}" hx-swap="none"> 124 <button type="submit" class="text-xs text-red-600 hover:underline">Remove</button> 125 </form> 126 {{ else }} 127 <form hx-post="/{{ $.RepoInfo.FullName }}/discussions/{{ $.Discussion.DiscussionId }}/patches/{{ .Id }}/readd" hx-swap="none"> 128 <button type="submit" class="text-xs text-green-600 hover:underline">Re-add</button> 129 </form> 130 {{ end }} 131 </div> 132 {{ end }} 133 </div> 134 {{ end }} 135 </div> 136 {{ else }} 137 <p class="text-gray-500 dark:text-gray-400 text-sm">No patches have been added to this discussion yet.</p> 138 {{ end }} 139 140 <!-- Add patch form --> 141 {{ if and $.LoggedInUser $.Discussion.State.IsOpen }} 142 <div class="mt-4 pt-4 border-t dark:border-gray-700"> 143 <h4 class="text-sm font-semibold mb-2">Add a patch</h4> 144 <form 145 hx-post="/{{ $.RepoInfo.FullName }}/discussions/{{ $.Discussion.DiscussionId }}/patches" 146 hx-swap="none" 147 class="space-y-3" 148 > 149 <div> 150 <label for="patch_hash" class="block text-xs text-gray-500 mb-1">Patch Hash</label> 151 <input 152 type="text" 153 id="patch_hash" 154 name="patch_hash" 155 required 156 class="w-full px-3 py-2 text-sm border rounded dark:border-gray-600 dark:bg-gray-700" 157 placeholder="Pijul change hash" 158 > 159 </div> 160 <div> 161 <label for="patch" class="block text-xs text-gray-500 mb-1">Patch Content</label> 162 <textarea 163 id="patch" 164 name="patch" 165 required 166 rows="4" 167 class="w-full px-3 py-2 text-sm border rounded font-mono dark:border-gray-600 dark:bg-gray-700" 168 placeholder="Paste your patch content here..." 169 ></textarea> 170 </div> 171 <div class="error" id="patch"></div> 172 <button type="submit" class="btn-primary text-sm px-4 py-2">Add patch</button> 173 </form> 174 </div> 175 {{ end }} 176 </section> 177 178 <!-- Comments section --> 179 <section class="bg-white dark:bg-gray-800 p-6 rounded"> 180 <h3 class="text-lg font-semibold mb-4">Comments</h3> 181 {{ if .CommentList }} 182 <div class="space-y-4"> 183 {{ range .CommentList }} 184 <div class="border rounded p-4 dark:border-gray-700"> 185 <div class="flex items-center gap-2 text-sm text-gray-500 mb-2"> 186 {{ template "user/fragments/picHandleLink" .Self.Did }} 187 <span>{{ template "repo/fragments/time" .Self.Created }}</span> 188 </div> 189 <div class="prose dark:prose-invert">{{ .Self.Body | markdown }}</div> 190 {{ if .Replies }} 191 <div class="mt-4 ml-4 space-y-3 border-l-2 border-gray-200 dark:border-gray-600 pl-4"> 192 {{ range .Replies }} 193 <div class="text-sm"> 194 <div class="flex items-center gap-2 text-gray-500 mb-1"> 195 {{ template "user/fragments/picHandleLink" .Did }} 196 <span>{{ template "repo/fragments/time" .Created }}</span> 197 </div> 198 <div class="prose dark:prose-invert prose-sm">{{ .Body | markdown }}</div> 199 </div> 200 {{ end }} 201 </div> 202 {{ end }} 203 </div> 204 {{ end }} 205 </div> 206 {{ else }} 207 <p class="text-gray-500 dark:text-gray-400 text-sm">No comments yet.</p> 208 {{ end }} 209 210 <!-- New comment form --> 211 {{ if $.LoggedInUser }} 212 <div class="mt-4 pt-4 border-t dark:border-gray-700"> 213 <form 214 hx-post="/{{ $.RepoInfo.FullName }}/discussions/{{ $.Discussion.DiscussionId }}/comment" 215 hx-swap="none" 216 class="space-y-3" 217 > 218 <textarea 219 name="body" 220 required 221 rows="3" 222 class="w-full px-3 py-2 text-sm border rounded dark:border-gray-600 dark:bg-gray-700" 223 placeholder="Add a comment..." 224 ></textarea> 225 <div class="error" id="comment"></div> 226 <button type="submit" class="btn-primary text-sm px-4 py-2">Comment</button> 227 </form> 228 </div> 229 {{ end }} 230 </section> 231 232 <!-- Discussion actions --> 233 {{ if $.LoggedInUser }} 234 <section class="bg-white dark:bg-gray-800 p-6 rounded"> 235 <div class="flex flex-wrap gap-2"> 236 {{ if $.Discussion.State.IsOpen }} 237 {{ if $.CanManage }} 238 <form hx-post="/{{ $.RepoInfo.FullName }}/discussions/{{ $.Discussion.DiscussionId }}/merge" hx-swap="none"> 239 <button type="submit" class="btn-create text-sm px-4 py-2 flex items-center gap-2"> 240 {{ i "git-merge" "w-4 h-4" }} 241 Merge 242 </button> 243 </form> 244 {{ end }} 245 <form hx-post="/{{ $.RepoInfo.FullName }}/discussions/{{ $.Discussion.DiscussionId }}/close" hx-swap="none"> 246 <button type="submit" class="btn-secondary text-sm px-4 py-2 flex items-center gap-2"> 247 {{ i "ban" "w-4 h-4" }} 248 Close 249 </button> 250 </form> 251 {{ else if $.Discussion.State.IsClosed }} 252 <form hx-post="/{{ $.RepoInfo.FullName }}/discussions/{{ $.Discussion.DiscussionId }}/reopen" hx-swap="none"> 253 <button type="submit" class="btn-primary text-sm px-4 py-2 flex items-center gap-2"> 254 {{ i "refresh-cw" "w-4 h-4" }} 255 Reopen 256 </button> 257 </form> 258 {{ end }} 259 </div> 260 <div class="error" id="discussion"></div> 261 </section> 262 {{ end }} 263 </div> 264{{ end }}