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