+30
-24
appview/pages/templates/repo/issues/issue.html
+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
···
52
53
class="rounded bg-white px-6 py-4 relative"
53
54
>
54
55
{{ if eq $index 0 }}
55
-
<div
56
-
class="absolute left-8 -top-8 w-px h-8 bg-gray-300"
57
-
></div>
56
+
<div class="absolute left-8 -top-8 w-px h-8 bg-gray-300" ></div>
58
57
{{ else }}
59
-
<div
60
-
class="absolute left-8 -top-4 w-px h-4 bg-gray-300"
61
-
></div>
58
+
<div class="absolute left-8 -top-4 w-px h-4 bg-gray-300" ></div>
62
59
{{ end }}
63
60
<div class="flex items-center gap-2 mb-2 text-gray-500">
64
61
{{ $owner := index $.DidHandleMap .OwnerDid }}
···
85
82
</div>
86
83
{{ end }}
87
84
</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
85
{{ end }}
107
86
87
+
{{ block "newComment" . }} {{ end }}
88
+
108
89
{{ $isIssueAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Issue.OwnerDid) }}
109
90
{{ $isRepoCollaborator := .RepoInfo.Roles.IsCollaborator }}
110
91
{{ if or $isIssueAuthor $isRepoCollaborator }}
···
132
113
</form>
133
114
{{ end }}
134
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 }}