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 "pull_created" }} 44 created a pull request 45 {{ else if eq .Type "pull_commented" }} 46 commented on a pull request 47 {{ else if eq .Type "pull_merged" }} 48 merged a pull request 49 {{ else if eq .Type "pull_closed" }} 50 closed a pull request 51 {{ else if eq .Type "followed" }} 52 followed you 53 {{ else }} 54 {{ end }} 55{{ end }} 56 57{{ define "notificationSummary" }} 58 {{ if eq .Type "repo_starred" }} 59 <!-- no summary --> 60 {{ else if .Issue }} 61 #{{.Issue.IssueId}} {{.Issue.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} 62 {{ else if .Pull }} 63 #{{.Pull.PullId}} {{.Pull.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} 64 {{ else if eq .Type "followed" }} 65 <!-- no summary --> 66 {{ else }} 67 {{ end }} 68{{ end }} 69 70{{ define "notificationUrl" }} 71 {{ $url := "" }} 72 {{ if eq .Type "repo_starred" }} 73 {{$url = printf "/%s/%s" (resolve .Repo.Did) .Repo.Name}} 74 {{ else if .Issue }} 75 {{$url = printf "/%s/%s/issues/%d" (resolve .Repo.Did) .Repo.Name .Issue.IssueId}} 76 {{ else if .Pull }} 77 {{$url = printf "/%s/%s/pulls/%d" (resolve .Repo.Did) .Repo.Name .Pull.PullId}} 78 {{ else if eq .Type "followed" }} 79 {{$url = printf "/%s" (resolve .ActorDid)}} 80 {{ else }} 81 {{ end }} 82 83 {{ $url }} 84{{ end }}