Monorepo for Tangled tangled.org

appview: pages/templates/repo: make issues more consistent with pulls

- improve issue page icons and icon states
- make issue comments more like pull comments
- padding and spacing consistency across the board

Changed files
+29 -18
appview
pages
templates
fragments
repo
issues
+1 -1
appview/pages/templates/fragments/pullActions.html
··· 79 79 hx-post="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/reopen" 80 80 hx-swap="none" 81 81 class="btn p-2 flex items-center gap-2"> 82 - {{ i "circle-dot" "w-4 h-4" }} 82 + {{ i "refresh-ccw-dot" "w-4 h-4" }} 83 83 <span>reopen</span> 84 84 </button> 85 85 {{ end }}
+28 -17
appview/pages/templates/repo/issues/issue.html
··· 44 44 {{ end }} 45 45 46 46 {{ define "repoAfter" }} 47 - {{ if gt (len .Comments) 0 }} 48 - <section id="comments" class="my-4 space-y-2 relative"> 47 + <section id="comments" class="my-2 mt-2 space-y-2 relative"> 49 48 {{ range $index, $comment := .Comments }} 50 49 <div 51 50 id="comment-{{ .CommentId }}" ··· 57 56 </div> 58 57 {{ end }} 59 58 </section> 60 - {{ end }} 61 59 62 60 {{ block "newComment" . }} {{ end }} 63 61 64 62 {{ end }} 65 63 66 64 {{ define "newComment" }} 65 + {{ if gt (len .Comments) 0 }} 66 + <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div> 67 + {{ end }} 67 68 {{ if .LoggedInUser }} 68 - 69 69 <form 70 70 id="comment-form" 71 71 hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment" 72 72 hx-on::after-request="if(event.detail.successful) this.reset()" 73 73 > 74 74 <div class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-4 px-4 relative w-full md:w-3/5"> 75 - <div class="absolute left-8 -top-4 w-px h-4 bg-gray-300 dark:bg-gray-600"></div> 76 75 <div class="text-sm pb-2 text-gray-500 dark:text-gray-400"> 77 76 {{ didOrHandle .LoggedInUser.Did .LoggedInUser.Handle }} 78 77 </div> ··· 84 83 onkeyup="updateCommentForm()" 85 84 ></textarea> 86 85 <div id="issue-comment"></div> 87 - 88 86 <div id="issue-action" class="error"></div> 89 87 </div> 90 88 ··· 100 98 {{ i "message-square-plus" "w-4 h-4" }} 101 99 comment 102 100 </button> 103 - 101 + 104 102 {{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }} 105 103 {{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }} 106 104 {{ if and (or $isIssueAuthor $isRepoCollaborator) (eq .State "open") }} ··· 119 117 hx-trigger="click from:#close-button" 120 118 hx-disabled-elt="#close-with-comment" 121 119 hx-target="#issue-comment" 122 - hx-vals="js:{body: document.getElementById('comment-textarea').value.trim() !== '' ? document.getElementById('comment-textarea').value : null}"> 120 + hx-vals="js:{body: document.getElementById('comment-textarea').value.trim() !== '' ? document.getElementById('comment-textarea').value : ''}" 121 + hx-swap="none" 122 + > 123 123 </div> 124 124 <div 125 125 id="close-issue" 126 126 hx-disabled-elt="#close-issue" 127 127 hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/close" 128 - hx-trigger="click from:#close-button, revealed from:#close-with-comment" 128 + hx-trigger="click from:#close-button" 129 129 hx-target="#issue-action" 130 - hx-swap="none"> 130 + hx-swap="none" 131 + > 131 132 </div> 133 + <script> 134 + document.addEventListener('htmx:configRequest', function(evt) { 135 + if (evt.target.id === 'close-with-comment') { 136 + const commentText = document.getElementById('comment-textarea').value.trim(); 137 + if (commentText === '') { 138 + evt.detail.parameters = {}; 139 + evt.preventDefault(); 140 + } 141 + } 142 + }); 143 + </script> 132 144 {{ else if and (or $isIssueAuthor $isRepoCollaborator) (eq .State "closed") }} 133 145 <button 134 146 type="button" ··· 136 148 hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/reopen" 137 149 hx-swap="none" 138 150 > 139 - {{ i "circle-dot" "w-4 h-4" }} 151 + {{ i "refresh-ccw-dot" "w-4 h-4" }} 140 152 reopen 141 153 </button> 142 154 {{ end }} 143 - 155 + 144 156 <script> 145 157 function updateCommentForm() { 146 158 const textarea = document.getElementById('comment-textarea'); 147 159 const commentButton = document.getElementById('comment-button'); 148 160 const closeButton = document.getElementById('close-button'); 149 - 161 + 150 162 if (textarea.value.trim() !== '') { 151 163 commentButton.removeAttribute('disabled'); 152 164 } else { 153 165 commentButton.setAttribute('disabled', ''); 154 166 } 155 - 167 + 156 168 if (closeButton) { 157 169 if (textarea.value.trim() !== '') { 158 170 closeButton.innerHTML = '{{ i "ban" "w-4 h-4" }} close with comment'; ··· 161 173 } 162 174 } 163 175 } 164 - 176 + 165 177 document.addEventListener('DOMContentLoaded', function() { 166 178 updateCommentForm(); 167 179 }); ··· 169 181 </div> 170 182 </form> 171 183 {{ else }} 172 - <div class="bg-white dark:bg-gray-800 dark:text-gray-400 rounded drop-shadow-sm px-6 py-4 mt-8"> 173 - <div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div> 184 + <div class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-4 px-4 relative w-fit"> 174 185 <a href="/login" class="underline">login</a> to join the discussion 175 186 </div> 176 187 {{ end }}