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