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