- improve issue page icons and icon states
- make issue comments more like pull comments
- padding and spacing consistency across the board
+1
-1
appview/pages/templates/fragments/pullActions.html
+1
-1
appview/pages/templates/fragments/pullActions.html
+26
-14
appview/pages/templates/repo/issues/issue.html
+26
-14
appview/pages/templates/repo/issues/issue.html
···
45
45
46
46
{{ define "repoAfter" }}
47
47
{{ if gt (len .Comments) 0 }}
48
-
<section id="comments" class="my-4 space-y-2 relative">
48
+
<section id="comments" class="my-2 mt-2 space-y-2 relative">
49
49
{{ range $index, $comment := .Comments }}
50
50
<div
51
51
id="comment-{{ .CommentId }}"
···
65
65
66
66
{{ define "newComment" }}
67
67
{{ if .LoggedInUser }}
68
-
69
68
<form
70
69
id="comment-form"
71
70
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment"
72
71
hx-on::after-request="if(event.detail.successful) this.reset()"
73
72
>
74
73
<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>
74
+
<div class="absolute left-8 -top-2 w-px h-2 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">
184
+
<div class="bg-white dark:bg-gray-800 rounded drop-shadow-sm py-4 px-4 relative w-fit">
173
185
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300 dark:bg-gray-600"></div>
174
186
<a href="/login" class="underline">login</a> to join the discussion
175
187
</div>