{{define "notifications/fragments/item"}}
{{/* row 1, col 1: icon */}}
{{ i (.Icon) "size-4" }}
{{/* row 1, col 2: header */}}
{{- if not .Read }} {{ template "repo/fragments/colorBall" (dict "color" "#4338ca" "classes" "shrink-0 dark:hidden") }} {{ template "repo/fragments/colorBall" (dict "color" "#6366f1" "classes" "shrink-0 hidden dark:block") }} {{- end -}} {{- template "notificationHeader" . -}}
{{/* row 1, col 3: timestamp normally, button on hover */}}
{{ template "repo/fragments/shortTime" .Created }} {{ if .Read }} {{ else }} {{ end }}
{{/* row 2, col 1: #N */}} {{ template "notificationNumber" . }} {{/* row 2, col 2: title */}} {{ template "notificationSummary" . }}
{{end}} {{ define "notificationIconColor" }} {{ if or (eq .Type "issue_created") (eq .Type "issue_reopen") }}text-green-600 dark:text-green-500 {{ else if or (eq .Type "pull_created") (eq .Type "pull_reopen") }}text-green-600 dark:text-green-500 {{ else if eq .Type "pull_merged" }}text-purple-600 dark:text-purple-500 {{ else if eq .Type "pull_closed" }}text-red-600 dark:text-red-500 {{ else if eq .Type "user_mentioned" }}text-blue-500 dark:text-blue-400 {{ else if eq .Type "repo_starred" }}text-yellow-500 dark:text-yellow-600 {{ else if or (eq .Type "issue_assigned") (eq .Type "pull_assigned") }} text-blue-500 dark:text-blue-400 {{ else }}text-gray-500 dark:text-gray-400 {{ end }} {{ end }} {{ define "notificationNumber" }} {{ if .Issue }} #{{ .Issue.IssueId }} {{ else if .Pull }} #{{ .Pull.PullId }} {{ end }} {{ end }} {{ define "notificationHeader" }} {{ $repoOwner := "" }} {{ $repoName := "" }} {{ if .Repo }} {{ $repoOwner = resolve .Repo.Did }} {{ $repoName = .Repo.Name }} {{ end }} {{ $textStyle := "text-gray-700 dark:text-gray-300" }} {{ $subjectStyle := "text-gray-800 dark:text-gray-200" }} {{ $repo := printf "%s/%s" $repoOwner $repoName }} {{ template "user/fragments/picHandle" .ActorDid }} {{ if eq .Type "repo_starred" }} starred {{ $repo }} {{ else if eq .Type "issue_created" }} opened an issue on {{ $repo }} {{ else if eq .Type "issue_commented" }} commented on an issue on {{ $repo }} {{ else if eq .Type "issue_closed" }} closed an issue on {{ $repo }} {{ else if eq .Type "issue_reopen" }} reopened an issue on {{ $repo }} {{ else if eq .Type "pull_created" }} created a PR on {{ $repo }} {{ else if eq .Type "pull_commented" }} commented on a PR on {{ $repo }} {{ else if eq .Type "pull_merged" }} merged a PR on {{ $repo }} {{ else if eq .Type "pull_closed" }} closed a PR on {{ $repo }} {{ else if eq .Type "pull_reopen" }} reopened a PR on {{ $repo }} {{ else if eq .Type "followed" }} followed you {{ else if eq .Type "user_mentioned" }} {{ if .Issue }} mentioned you on an issue in {{ $repo }} {{ else if .Pull }} mentioned you on a pull request in {{ $repo }} {{ else }} mentioned you in {{ $repo }} {{ end }} {{ else if eq .Type "issue_assigned" }} assigned you to an issue on {{ $repo }} {{ else if eq .Type "issue_unassigned" }} unassigned you from an issue on {{ $repo }} {{ else if eq .Type "pull_assigned" }} assigned you to a PR on {{ $repo }} {{ else if eq .Type "pull_unassigned" }} unassigned you from a PR on {{ $repo }} {{ end }} {{ end }} {{ define "notificationSummary" }} {{ if .Issue }}
{{ .Issue.Title }}
{{ else if .Pull }}
{{ .Pull.Title }}
{{ end }} {{ end }} {{ define "notificationUrl" }} {{ $url := "" }} {{ if eq .Type "repo_starred" }} {{$url = printf "/%s/%s" (resolve .Repo.Did) .Repo.Slug}} {{ else if .Issue }} {{$url = printf "/%s/%s/issues/%d" (resolve .Repo.Did) .Repo.Slug .Issue.IssueId}} {{ else if .Pull }} {{$url = printf "/%s/%s/pulls/%d" (resolve .Repo.Did) .Repo.Slug .Pull.PullId}} {{ else if eq .Type "followed" }} {{$url = printf "/%s" (resolve .ActorDid)}} {{ else }} {{ end }} {{ $url }} {{ end }}