Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).

use nice styles for new-comment in issues

+30 -24
+30 -24
appview/pages/templates/repo/issues/issue.html
··· 45 45 {{ end }} 46 46 47 47 {{ define "repoAfter" }} 48 + {{ if gt (len .Comments) 0 }} 48 49 <section id="comments" class="mt-8 space-y-4 relative"> 49 50 {{ range $index, $comment := .Comments }} 50 51 <div ··· 53 52 class="rounded bg-white px-6 py-4 relative" 54 53 > 55 54 {{ if eq $index 0 }} 56 - <div 57 - class="absolute left-8 -top-8 w-px h-8 bg-gray-300" 58 - ></div> 55 + <div class="absolute left-8 -top-8 w-px h-8 bg-gray-300" ></div> 59 56 {{ else }} 60 - <div 61 - class="absolute left-8 -top-4 w-px h-4 bg-gray-300" 62 - ></div> 57 + <div class="absolute left-8 -top-4 w-px h-4 bg-gray-300" ></div> 63 58 {{ end }} 64 59 <div class="flex items-center gap-2 mb-2 text-gray-500"> 65 60 {{ $owner := index $.DidHandleMap .OwnerDid }} ··· 82 85 </div> 83 86 {{ end }} 84 87 </section> 85 - 86 - {{ if .LoggedInUser }} 87 - <form 88 - hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment" 89 - class="mt-8" 90 - > 91 - <textarea 92 - name="body" 93 - class="w-full p-2 rounded border border-gray-200" 94 - placeholder="Add to the discussion..." 95 - ></textarea> 96 - <button type="submit" class="btn mt-2">comment</button> 97 - <div id="issue-comment"></div> 98 - </form> 99 - {{ else }} 100 - <div class="w-full rounded p-6 drop-shadow-sm bg-white"> 101 - <a href="/login" class="underline">login</a> to join the discussion 102 - </div> 103 88 {{ end }} 89 + 90 + {{ block "newComment" . }} {{ end }} 104 91 105 92 {{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }} 106 93 {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }} ··· 112 131 <div id="issue-action" class="error"></div> 113 132 </form> 114 133 {{ end }} 134 + {{ end }} 135 + 136 + {{ define "newComment" }} 137 + {{ if .LoggedInUser }} 138 + <div class="bg-white rounded drop-shadow-sm py-4 px-6 relative w-full flex flex-col gap-2 mt-8"> 139 + <div class="absolute left-8 -top-8 w-px h-8 bg-gray-300" ></div> 140 + <div class="text-sm text-gray-500"> 141 + {{ didOrHandle .LoggedInUser.Did .LoggedInUser.Handle }} 142 + </div> 143 + <form hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment"> 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="issue-comment"></div> 151 + </form> 152 + </div> 153 + {{ else }} 154 + <div class="bg-white rounded drop-shadow-sm px-6 py-4 mt-8"> 155 + <div class="absolute left-8 -top-8 w-px h-8 bg-gray-300" ></div> 156 + <a href="/login" class="underline">login</a> to join the discussion 157 + </div> 158 + {{ end }} 115 159 {{ end }}