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 <span>{{ template "notificationHeader" . }}</span> 12 <span class="text-sm text-gray-500 dark:text-gray-400">{{ template "notificationSummary" . }}</span> 13 </div> 14 15 </div> 16 </a> 17{{end}} 18 19{{ define "notificationIcon" }} 20 <div class="flex-shrink-0 max-h-full w-16 h-16 relative"> 21 <img class="object-cover rounded-full p-2" src="{{ fullAvatar .ActorDid }}" /> 22 <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-2 flex items-center justify-center z-10"> 23 {{ i .Icon "size-3 text-black dark:text-white" }} 24 </div> 25 </div> 26{{ end }} 27 28{{ define "notificationHeader" }} 29 {{ $actor := resolve .ActorDid }} 30 31 <span class="text-black dark:text-white w-fit">{{ $actor }}</span> 32 {{ if eq .Type "repo_starred" }} 33 starred <span class="text-black dark:text-white">{{ resolve .Repo.Did }}/{{ .Repo.Name }}</span> 34 {{ else if eq .Type "issue_created" }} 35 opened an issue 36 {{ else if eq .Type "issue_commented" }} 37 commented on an issue 38 {{ else if eq .Type "issue_closed" }} 39 closed an issue 40 {{ else if eq .Type "pull_created" }} 41 created a pull request 42 {{ else if eq .Type "pull_commented" }} 43 commented on a pull request 44 {{ else if eq .Type "pull_merged" }} 45 merged a pull request 46 {{ else if eq .Type "pull_closed" }} 47 closed a pull request 48 {{ else if eq .Type "followed" }} 49 followed you 50 {{ else }} 51 {{ end }} 52{{ end }} 53 54{{ define "notificationSummary" }} 55 {{ if eq .Type "repo_starred" }} 56 <!-- no summary --> 57 {{ else if .Issue }} 58 #{{.Issue.IssueId}} {{.Issue.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} 59 {{ else if .Pull }} 60 #{{.Pull.PullId}} {{.Pull.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} 61 {{ else if eq .Type "followed" }} 62 <!-- no summary --> 63 {{ else }} 64 {{ end }} 65{{ end }} 66 67{{ define "notificationUrl" }} 68 {{ $url := "" }} 69 {{ if eq .Type "repo_starred" }} 70 {{$url = printf "/%s/%s" (resolve .Repo.Did) .Repo.Name}} 71 {{ else if .Issue }} 72 {{$url = printf "/%s/%s/issues/%d" (resolve .Repo.Did) .Repo.Name .Issue.IssueId}} 73 {{ else if .Pull }} 74 {{$url = printf "/%s/%s/pulls/%d" (resolve .Repo.Did) .Repo.Name .Pull.PullId}} 75 {{ else if eq .Type "followed" }} 76 {{$url = printf "/%s" (resolve .ActorDid)}} 77 {{ else }} 78 {{ end }} 79 80 {{ $url }} 81{{ end }}