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 }} 58 {{ end }} 59{{ end }} 60 61{{ define "notificationSummary" }} 62 {{ if eq .Type "repo_starred" }} 63 <!-- no summary --> 64 {{ else if .Issue }} 65 #{{.Issue.IssueId}} {{.Issue.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} 66 {{ else if .Pull }} 67 #{{.Pull.PullId}} {{.Pull.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} 68 {{ else if eq .Type "followed" }} 69 <!-- no summary --> 70 {{ else }} 71 {{ end }} 72{{ end }} 73 74{{ define "notificationUrl" }} 75 {{ $url := "" }} 76 {{ if eq .Type "repo_starred" }} 77 {{$url = printf "/%s/%s" (resolve .Repo.Did) .Repo.Name}} 78 {{ else if .Issue }} 79 {{$url = printf "/%s/%s/issues/%d" (resolve .Repo.Did) .Repo.Name .Issue.IssueId}} 80 {{ else if .Pull }} 81 {{$url = printf "/%s/%s/pulls/%d" (resolve .Repo.Did) .Repo.Name .Pull.PullId}} 82 {{ else if eq .Type "followed" }} 83 {{$url = printf "/%s" (resolve .ActorDid)}} 84 {{ else }} 85 {{ end }} 86 87 {{ $url }} 88{{ end }}