this repo has no description
1{{define "notifications/fragments/item"}}
2 <a href="{{ template "notificationUrl" . }}" class="block no-underline hover:no-underline">
3 <div
4 class="
5 w-full mx-auto rounded drop-shadow-sm dark:text-white bg-white dark:bg-gray-800 px-2 md:px-6 py-4 transition-colors
6 {{if not .Read}}bg-blue-50 dark:bg-blue-800/20 border border-blue-500 dark:border-sky-800{{end}}
7 flex gap-2 items-center
8 ">
9 {{ template "notificationIcon" . }}
10 <div class="flex-1 w-full flex flex-col gap-1">
11 <div class="flex items-center gap-1">
12 <span>{{ template "notificationHeader" . }}</span>
13 <span class="text-sm text-gray-500 dark:text-gray-400 before:content-['·'] before:select-none">{{ template "repo/fragments/shortTime" .Created }}</span>
14 </div>
15 <span class="text-sm text-gray-500 dark:text-gray-400">{{ template "notificationSummary" . }}</span>
16 </div>
17
18 </div>
19 </a>
20{{end}}
21
22{{ define "notificationIcon" }}
23 <div class="flex-shrink-0 max-h-full w-16 h-16 relative">
24 <img class="object-cover rounded-full p-2" src="{{ fullAvatar .ActorDid }}" />
25 <div class="absolute border-2 border-white dark:border-gray-800 bg-gray-200 dark:bg-gray-700 bottom-1 right-1 rounded-full p-1 flex items-center justify-center z-10">
26 {{ i .Icon "size-3 text-black dark:text-white" }}
27 </div>
28 </div>
29{{ end }}
30
31{{ define "notificationHeader" }}
32 {{ $actor := resolve .ActorDid }}
33
34 <span class="text-black dark:text-white w-fit">{{ $actor }}</span>
35 {{ if eq .Type "repo_starred" }}
36 starred <span class="text-black dark:text-white">{{ resolve .Repo.Did }}/{{ .Repo.Name }}</span>
37 {{ else if eq .Type "issue_created" }}
38 opened an issue
39 {{ else if eq .Type "issue_commented" }}
40 commented on an issue
41 {{ else if eq .Type "issue_closed" }}
42 closed an issue
43 {{ else if eq .Type "issue_reopen" }}
44 reopened an issue
45 {{ else if eq .Type "pull_created" }}
46 created a pull request
47 {{ else if eq .Type "pull_commented" }}
48 commented on a pull request
49 {{ else if eq .Type "pull_merged" }}
50 merged a pull request
51 {{ else if eq .Type "pull_closed" }}
52 closed a pull request
53 {{ else if eq .Type "pull_reopen" }}
54 reopened a pull request
55 {{ else if eq .Type "followed" }}
56 followed you
57 {{ else if eq .Type "user_mentioned" }}
58 mentioned you
59 {{ else }}
60 {{ end }}
61{{ end }}
62
63{{ define "notificationSummary" }}
64 {{ if eq .Type "repo_starred" }}
65 <!-- no summary -->
66 {{ else if .Issue }}
67 #{{.Issue.IssueId}} {{.Issue.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}}
68 {{ else if .Pull }}
69 #{{.Pull.PullId}} {{.Pull.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}}
70 {{ else if eq .Type "followed" }}
71 <!-- no summary -->
72 {{ else }}
73 {{ end }}
74{{ end }}
75
76{{ define "notificationUrl" }}
77 {{ $url := "" }}
78 {{ if eq .Type "repo_starred" }}
79 {{$url = printf "/%s/%s" (resolve .Repo.Did) .Repo.Name}}
80 {{ else if .Issue }}
81 {{$url = printf "/%s/%s/issues/%d" (resolve .Repo.Did) .Repo.Name .Issue.IssueId}}
82 {{ else if .Pull }}
83 {{$url = printf "/%s/%s/pulls/%d" (resolve .Repo.Did) .Repo.Name .Pull.PullId}}
84 {{ else if eq .Type "followed" }}
85 {{$url = printf "/%s" (resolve .ActorDid)}}
86 {{ else }}
87 {{ end }}
88
89 {{ $url }}
90{{ end }}