this repo has no description
at issues-edit 4.6 kB view raw
1{{ define "title" }}{{ .Issue.Title }} &middot; issue #{{ .Issue.IssueId }} &middot; {{ .RepoInfo.FullName }}{{ end }} 2 3{{ define "repoContent" }} 4 <header class="pb-4"> 5 <h1 class="text-2xl"> 6 {{ .Issue.Title }} 7 <span class="text-gray-500 dark:text-gray-400">#{{ .Issue.IssueId }}</span> 8 </h1> 9 </header> 10 11 {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} 12 {{ $icon := "ban" }} 13 {{ if eq .State "open" }} 14 {{ $bgColor = "bg-green-600 dark:bg-green-700" }} 15 {{ $icon = "circle-dot" }} 16 {{ end }} 17 18 <section class="mt-2"> 19 <div class="inline-flex items-center gap-2"> 20 <div id="state" 21 class="inline-flex items-center rounded px-3 py-1 {{ $bgColor }}"> 22 {{ i $icon "w-4 h-4 mr-1.5 text-white" }} 23 <span class="text-white">{{ .State }}</span> 24 </div> 25 <span class="text-gray-500 dark:text-gray-400 text-sm"> 26 opened by 27 {{ $owner := didOrHandle .Issue.OwnerDid .IssueOwnerHandle }} 28 <a href="/{{ $owner }}" class="no-underline hover:underline" 29 >{{ $owner }}</a 30 > 31 <span class="px-1 select-none before:content-['\00B7']"></span> 32 <time title="{{ .Issue.Created | longTimeFmt }}"> 33 {{ .Issue.Created | timeFmt }} 34 </time> 35 </span> 36 </div> 37 38 {{ if .Issue.Body }} 39 <article id="body" class="mt-8 prose dark:prose-invert"> 40 {{ .Issue.Body | markdown }} 41 </article> 42 {{ end }} 43 </section> 44{{ end }} 45 46{{ define "repoAfter" }} 47 {{ if gt (len .Comments) 0 }} 48 <section id="comments" class="mt-8 space-y-4 relative"> 49 {{ range $index, $comment := .Comments }} 50 <div 51 id="comment-{{ .CommentId }}" 52 class="rounded bg-white px-6 py-4 relative dark:bg-gray-800"> 53 {{ if eq $index 0 }} 54 <div class="absolute left-8 -top-8 w-px h-8 bg-gray-300 dark:bg-gray-700" ></div> 55 {{ else }} 56 <div class="absolute left-8 -top-4 w-px h-4 bg-gray-300 dark:bg-gray-700" ></div> 57 {{ end }} 58 59 {{ template "fragments/issueComment" (dict "RepoInfo" $.RepoInfo "LoggedInUser" $.LoggedInUser "DidHandleMap" $.DidHandleMap "Issue" $.Issue "Comment" .)}} 60 </div> 61 {{ end }} 62 </section> 63 {{ end }} 64 65 {{ block "newComment" . }} {{ end }} 66 67 {{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }} 68 {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }} 69 {{ if or $isIssueAuthor $isRepoCollaborator }} 70 {{ $action := "close" }} 71 {{ $icon := "circle-x" }} 72 {{ $hoverColor := "red" }} 73 {{ if eq .State "closed" }} 74 {{ $action = "reopen" }} 75 {{ $icon = "circle-dot" }} 76 {{ $hoverColor = "green" }} 77 {{ end }} 78 <form 79 hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/{{ $action }}" 80 hx-swap="none" 81 class="mt-8" 82 > 83 <button type="submit" class="btn hover:bg-{{ $hoverColor }}-300"> 84 {{ i $icon "w-4 h-4 mr-2" }} 85 <span class="text-black dark:text-gray-400">{{ $action }}</span> 86 </button> 87 <div id="issue-action" class="error"></div> 88 </form> 89 {{ end }} 90{{ end }} 91 92{{ define "newComment" }} 93 {{ if .LoggedInUser }} 94 <div class="bg-white rounded drop-shadow-sm py-4 px-6 relative w-full flex flex-col gap-2 mt-8 dark:bg-gray-800 dark:text-gray-400"> 95 <div class="absolute left-8 -top-8 w-px h-8 bg-gray-300 dark:bg-gray-700" ></div> 96 <div class="text-sm text-gray-500 dark:text-gray-400"> 97 {{ didOrHandle .LoggedInUser.Did .LoggedInUser.Handle }} 98 </div> 99 <form hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment"> 100 <textarea 101 name="body" 102 class="w-full p-2 rounded border border-gray-200 dark:border-gray-700" 103 placeholder="Add to the discussion..." 104 ></textarea> 105 <button type="submit" class="btn mt-2">comment</button> 106 <div id="issue-comment"></div> 107 </form> 108 </div> 109 {{ else }} 110 <div class="bg-white dark:bg-gray-800 dark:text-gray-400 rounded drop-shadow-sm px-6 py-4 mt-8"> 111 <div class="absolute left-8 -top-8 w-px h-8 bg-gray-300 dark:bg-gray-700" ></div> 112 <a href="/login" class="underline">login</a> to join the discussion 113 </div> 114 {{ end }} 115{{ end }}