Monorepo for Tangled tangled.org

use nice styles for new-comment in issues

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