Monorepo for Tangled
tangled.org
1{{ define "title" }}{{ .Issue.Title }} · issue #{{ .Issue.IssueId }} · {{ .RepoInfo.FullName }}{{ end }}
2
3
4{{ define "extrameta" }}
5 {{ template "repo/issues/fragments/og" (dict "RepoInfo" .RepoInfo "Issue" .Issue) }}
6{{ end }}
7
8{{ define "repoContentLayout" }}
9 <div class="grid grid-cols-1 md:grid-cols-10 gap-4 w-full">
10 <div class="col-span-1 md:col-span-8">
11 <section class="bg-white dark:bg-gray-800 p-6 rounded relative w-full mx-auto dark:text-white">
12 {{ block "repoContent" . }}{{ end }}
13 </section>
14 {{ block "repoAfter" . }}{{ end }}
15 </div>
16 <div class="col-span-1 md:col-span-2 flex flex-col gap-6">
17 {{ template "repo/fragments/labelPanel"
18 (dict "RepoInfo" $.RepoInfo
19 "Defs" $.LabelDefs
20 "Subject" $.Issue.AtUri
21 "State" $.Issue.Labels) }}
22 {{ template "repo/fragments/participants" $.Issue.Participants }}
23 {{ template "repo/fragments/backlinks"
24 (dict "RepoInfo" $.RepoInfo
25 "Backlinks" $.Backlinks) }}
26 {{ template "repo/fragments/externalLinkPanel" $.Issue.AtUri }}
27 </div>
28 </div>
29{{ end }}
30
31{{ define "repoContent" }}
32<section id="issue-{{ .Issue.IssueId }}">
33 {{ template "issueHeader" .Issue }}
34 {{ template "issueInfo" . }}
35 {{ if .Issue.Body }}
36 <article id="body" class="mt-4 prose dark:prose-invert">{{ .Issue.Body | markdown }}</article>
37 {{ end }}
38 <div class="flex flex-wrap gap-2 items-stretch mt-4">
39 {{ template "issueReactions" . }}
40 </div>
41</section>
42{{ end }}
43
44{{ define "issueHeader" }}
45 <header class="pb-2">
46 <h1 class="text-2xl">
47 {{ .Title | description }}
48 <span class="text-gray-500 dark:text-gray-400">#{{ .IssueId }}</span>
49 </h1>
50 </header>
51{{ end }}
52
53{{ define "issueInfo" }}
54 {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }}
55 {{ $icon := "ban" }}
56 {{ if eq .Issue.State "open" }}
57 {{ $bgColor = "bg-green-600 dark:bg-green-700" }}
58 {{ $icon = "circle-dot" }}
59 {{ end }}
60 <div class="inline-flex items-center gap-2">
61 <div id="state"
62 class="inline-flex items-center rounded px-3 py-1 {{ $bgColor }}">
63 {{ i $icon "w-4 h-4 mr-1.5 text-white" }}
64 <span class="text-white">{{ .Issue.State }}</span>
65 </div>
66 <span class="text-gray-500 dark:text-gray-400 text-sm flex flex-wrap items-center gap-1">
67 opened by
68 {{ template "user/fragments/picHandleLink" .Issue.Did }}
69 <span class="select-none before:content-['\00B7']"></span>
70 {{ if .Issue.Edited }}
71 edited {{ template "repo/fragments/time" .Issue.Edited }}
72 {{ else }}
73 {{ template "repo/fragments/time" .Issue.Created }}
74 {{ end }}
75 </span>
76
77 {{ if and .LoggedInUser (eq .LoggedInUser.Did .Issue.Did) }}
78 {{ template "issueActions" . }}
79 {{ end }}
80 </div>
81 <div id="issue-actions-error" class="error"></div>
82{{ end }}
83
84{{ define "issueActions" }}
85 {{ template "editIssue" . }}
86 {{ template "deleteIssue" . }}
87{{ end }}
88
89{{ define "editIssue" }}
90 <a
91 class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer"
92 hx-get="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/edit"
93 hx-swap="innerHTML"
94 hx-target="#issue-{{.Issue.IssueId}}">
95 {{ i "pencil" "size-3" }}
96 </a>
97{{ end }}
98
99{{ define "deleteIssue" }}
100 <a
101 class="text-gray-500 dark:text-gray-400 flex gap-1 items-center group cursor-pointer"
102 hx-delete="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/"
103 hx-confirm="Are you sure you want to delete your issue?"
104 hx-swap="none">
105 {{ i "trash-2" "size-3" }}
106 {{ i "loader-circle" "size-3 animate-spin hidden group-[.htmx-request]:inline" }}
107 </a>
108{{ end }}
109
110{{ define "issueReactions" }}
111 <div class="flex items-center gap-2">
112 {{ template "repo/fragments/reactionsPopUp" .OrderedReactionKinds }}
113 {{ range $kind := .OrderedReactionKinds }}
114 {{ $reactionData := index $.Reactions $kind }}
115 {{
116 template "repo/fragments/reaction"
117 (dict
118 "Kind" $kind
119 "Count" $reactionData.Count
120 "IsReacted" (index $.UserReacted $kind)
121 "ThreadAt" $.Issue.AtUri
122 "Users" $reactionData.Users)
123 }}
124 {{ end }}
125 </div>
126{{ end }}
127
128
129{{ define "repoAfter" }}
130 <div class="flex flex-col gap-4 mt-4">
131 {{
132 template "repo/issues/fragments/commentList"
133 (dict
134 "RepoInfo" $.RepoInfo
135 "LoggedInUser" $.LoggedInUser
136 "Issue" $.Issue
137 "CommentList" $.Issue.CommentList)
138 }}
139
140 {{ template "repo/issues/fragments/newComment" . }}
141 </div>
142{{ end }}