diff --git a/appview/pages/templates/notifications/fragments/item.html b/appview/pages/templates/notifications/fragments/item.html index 294a0127..04628218 100644 --- a/appview/pages/templates/notifications/fragments/item.html +++ b/appview/pages/templates/notifications/fragments/item.html @@ -2,74 +2,91 @@
- {{ template "notificationIcon" . }} -
-
- {{ template "notificationHeader" . }} - {{ template "repo/fragments/shortTime" .Created }} -
- {{ template "notificationSummary" . }} + {{/* row 1, col 1: icon */}} +
{{ i (.Icon) "size-4" }}
+ {{/* row 1, col 2: header */}} +
+ {{- if not .Read }} + {{ template "repo/fragments/colorBall" (dict "color" "#1e40af" "classes" "shrink-0 dark:hidden") }} + {{ template "repo/fragments/colorBall" (dict "color" "#3b82f6" "classes" "shrink-0 hidden dark:block") }} + {{- end -}} + {{- template "notificationHeader" . -}}
- + {{/* row 1, col 3: time */}} + {{ template "repo/fragments/shortTime" .Created }} + {{/* row 2, col 1: #N */}} + {{ template "notificationNumber" . }} + {{/* row 2, col 2: title */}} + {{ template "notificationSummary" . }}
{{end}} -{{ define "notificationIcon" }} -
- -
- {{ i .Icon "size-3 text-black dark:text-white" }} -
-
+{{ define "notificationIconColor" }}{{ if eq .Type "issue_created" }}text-green-600 dark:text-green-500{{ else if eq .Type "issue_reopen" }}text-green-600 dark:text-green-500{{ else if eq .Type "pull_created" }}text-green-600 dark:text-green-500{{ else if 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 }}text-gray-500 dark:text-gray-400{{ end }}{{ end }} + +{{ define "notificationNumber" }} + {{ if .Issue }} + #{{ .Issue.IssueId }} + {{ else if .Pull }} + #{{ .Pull.PullId }} + {{ end }} {{ end }} {{ define "notificationHeader" }} - {{ $actor := resolve .ActorDid }} + {{ $repoOwner := "" }} + {{ $repoName := "" }} + {{ if .Repo }} + {{ $repoOwner = resolve .Repo.Did }} + {{ $repoName = .Repo.Name }} + {{ end }} - {{ $actor }} + {{ $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 {{ resolve .Repo.Did }}/{{ .Repo.Name }} + starred {{ $repo }} {{ else if eq .Type "issue_created" }} - opened an issue + opened an issue on {{ $repo }} {{ else if eq .Type "issue_commented" }} - commented on an issue + commented on an issue on {{ $repo }} {{ else if eq .Type "issue_closed" }} - closed an issue + closed an issue on {{ $repo }} {{ else if eq .Type "issue_reopen" }} - reopened an issue + reopened an issue on {{ $repo }} {{ else if eq .Type "pull_created" }} - created a pull request + created a PR on {{ $repo }} {{ else if eq .Type "pull_commented" }} - commented on a pull request + commented on a PR on {{ $repo }} {{ else if eq .Type "pull_merged" }} - merged a pull request + merged a PR on {{ $repo }} {{ else if eq .Type "pull_closed" }} - closed a pull request + closed a PR on {{ $repo }} {{ else if eq .Type "pull_reopen" }} - reopened a pull request + reopened a PR on {{ $repo }} {{ else if eq .Type "followed" }} - followed you + followed you {{ else if eq .Type "user_mentioned" }} - mentioned you - {{ else }} + {{ 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 }} {{ end }} + {{ end }} {{ define "notificationSummary" }} - {{ if eq .Type "repo_starred" }} - - {{ else if .Issue }} - #{{.Issue.IssueId}} {{.Issue.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} + {{ if .Issue }} +
{{ .Issue.Title }}
{{ else if .Pull }} - #{{.Pull.PullId}} {{.Pull.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} - {{ else if eq .Type "followed" }} - - {{ else }} +
{{ .Pull.Title }}
{{ end }} {{ end }} diff --git a/appview/pages/templates/notifications/list.html b/appview/pages/templates/notifications/list.html index b63da28f..f4bd2bf9 100644 --- a/appview/pages/templates/notifications/list.html +++ b/appview/pages/templates/notifications/list.html @@ -12,7 +12,7 @@
{{if .Notifications}} -
+
{{range .Notifications}} {{template "notifications/fragments/item" .}} {{end}}