109 lines
3.5 kB
1
{{ define "title" }}
2
{{ .Issue.Title }} ·
3
{{ .RepoInfo.FullName }}
4
{{ end }}
5
6
{{ define "repoContent" }}
7
<div class="flex items-center justify-between">
8
<h1>
9
{{ .Issue.Title }}
10
<span class="text-gray-400">#{{ .Issue.IssueId }}</span>
11
</h1>
12
13
<time class="text-sm">{{ .Issue.Created | timeFmt }}</time>
14
</div>
15
16
{{ $bgColor := "bg-gray-800" }}
17
{{ $icon := "ban" }}
18
{{ if eq .State "open" }}
19
{{ $bgColor = "bg-green-600" }}
20
{{ $icon = "circle-dot" }}
21
{{ end }}
22
23
24
<section class="m-2">
25
<div class="flex items-center gap-2">
26
<div
27
id="state"
28
class="inline-flex items-center px-3 py-1 {{ $bgColor }}"
29
>
30
<i
31
data-lucide="{{ $icon }}"
32
class="w-4 h-4 mr-1.5 text-white"
33
></i>
34
<span class="text-white">{{ .State }}</span>
35
</div>
36
<span class="text-gray-400 text-sm">
37
opened by
38
{{ didOrHandle .Issue.OwnerDid .IssueOwnerHandle }}
39
</span>
40
</div>
41
42
{{ if .Issue.Body }}
43
<article id="body" class="mt-8">
44
{{ .Issue.Body | escapeHtml }}
45
</article>
46
{{ end }}
47
</section>
48
49
<section id="comments" class="mt-8 space-y-4">
50
{{ range .Comments }}
51
<div
52
id="comment-{{ .CommentId }}"
53
class="border border-gray-200 p-4"
54
>
55
<div class="flex items-center gap-2 mb-2">
56
<span class="text-gray-400 text-sm">
57
{{ index $.DidHandleMap .OwnerDid }}
58
</span>
59
<span class="text-gray-500 text-sm">
60
{{ .Created | timeFmt }}
61
</span>
62
</div>
63
<div class="">
64
{{ nl2br .Body }}
65
</div>
66
</div>
67
{{ end }}
68
</section>
69
70
{{ if .LoggedInUser }}
71
<form
72
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment"
73
class="mt-8"
74
>
75
<textarea
76
name="body"
77
class="w-full p-2 border border-gray-200"
78
placeholder="Add to the discussion..."
79
></textarea>
80
<button type="submit" class="btn mt-2">comment</button>
81
<div id="issue-comment"></div>
82
</form>
83
{{ end }}
84
85
{{ if eq .LoggedInUser.Did .Issue.OwnerDid }}
86
{{ $action := "close" }}
87
{{ $icon := "circle-x" }}
88
{{ $hoverColor := "red" }}
89
{{ if eq .State "closed" }}
90
{{ $action = "reopen" }}
91
{{ $icon = "circle-dot" }}
92
{{ $hoverColor = "green" }}
93
{{ end }}
94
<form
95
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/{{ $action }}"
96
hx-swap="none"
97
class="mt-8"
98
>
99
<button type="submit" class="btn hover:bg-{{ $hoverColor }}-300">
100
<i
101
data-lucide="{{ $icon }}"
102
class="w-4 h-4 mr-2 text-{{ $hoverColor }}-400"
103
></i>
104
<span class="text-black">{{ $action }}</span>
105
</button>
106
<div id="issue-action" class="error"></div>
107
</form>
108
{{ end }}
109
{{ end }}
110