132 lines
4.4 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>
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
{{ $owner := didOrHandle .Issue.OwnerDid .IssueOwnerHandle }}
39
<a href="/{{ $owner }}" class="no-underline hover:underline"
40
>{{ $owner }}</a
41
>
42
</span>
43
</div>
44
45
{{ if .Issue.Body }}
46
<article id="body" class="mt-8">
47
{{ .Issue.Body | escapeHtml }}
48
</article>
49
{{ end }}
50
</section>
51
{{ end }}
52
53
{{ define "repoAfter" }}
54
<section id="comments" class="mt-8 space-y-4 relative">
55
{{ range $index, $comment := .Comments }}
56
<div
57
id="comment-{{ .CommentId }}"
58
class="rounded-sm bg-white p-4 relative"
59
>
60
{{ if eq $index 0 }}
61
<div
62
class="absolute left-8 -top-8 w-px h-8 bg-gray-300"
63
></div>
64
{{ else }}
65
<div
66
class="absolute left-8 -top-4 w-px h-4 bg-gray-300"
67
></div>
68
{{ end }}
69
<div class="flex items-center gap-2 mb-2">
70
{{ $owner := index $.DidHandleMap .OwnerDid }}
71
<span class="text-gray-400 text-sm">
72
<a
73
href="{{ $owner }}"
74
class="no-underline hover:underline"
75
>{{ $owner }}</a
76
>
77
</span>
78
<a
79
href="#{{ .CommentId }}"
80
class="text-gray-500 text-sm hover:text-gray-500 hover:underline no-underline"
81
id="{{ .CommentId }}"
82
>
83
{{ .Created | timeFmt }}
84
</a>
85
</div>
86
<div class="">
87
{{ nl2br .Body }}
88
</div>
89
</div>
90
{{ end }}
91
</section>
92
93
{{ if .LoggedInUser }}
94
<form
95
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/comment"
96
class="mt-8"
97
>
98
<textarea
99
name="body"
100
class="w-full p-2 border border-gray-200"
101
placeholder="Add to the discussion..."
102
></textarea>
103
<button type="submit" class="btn mt-2">comment</button>
104
<div id="issue-comment"></div>
105
</form>
106
{{ end }}
107
108
{{ if eq .LoggedInUser.Did .Issue.OwnerDid }}
109
{{ $action := "close" }}
110
{{ $icon := "circle-x" }}
111
{{ $hoverColor := "red" }}
112
{{ if eq .State "closed" }}
113
{{ $action = "reopen" }}
114
{{ $icon = "circle-dot" }}
115
{{ $hoverColor = "green" }}
116
{{ end }}
117
<form
118
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/{{ $action }}"
119
hx-swap="none"
120
class="mt-8"
121
>
122
<button type="submit" class="btn hover:bg-{{ $hoverColor }}-300">
123
<i
124
data-lucide="{{ $icon }}"
125
class="w-4 h-4 mr-2 text-{{ $hoverColor }}-400"
126
></i>
127
<span class="text-black">{{ $action }}</span>
128
</button>
129
<div id="issue-action" class="error"></div>
130
</form>
131
{{ end }}
132
{{ end }}
133