From 71b0734688558eb0ab0c809eda1d68db6d827353 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Mon, 25 May 2026 12:45:20 +0000 Subject: [PATCH] appview/pages: improve notification styles Signed-off-by: oppiliappan --- appview/pages/templates/notifications/list.html | 2 +- appview/pages/templates/notifications/fragments/item.html | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------- 2 file(s) changed, 74 insertion(s)(+), 57 deletion(s)(-) diff --git a/appview/pages/templates/notifications/list.html b/appview/pages/templates/notifications/list.html --- 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}} diff --git a/appview/pages/templates/notifications/fragments/item.html b/appview/pages/templates/notifications/fragments/item.html --- 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" }} -
-
-{{ end }} +{{ 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 "notificationHeader" }} - {{ $actor := resolve .ActorDid }} - - {{ $actor }} - {{ if eq .Type "repo_starred" }} - starred {{ resolve .Repo.Did }}/{{ .Repo.Name }} - {{ else if eq .Type "issue_created" }} - opened an issue - {{ else if eq .Type "issue_commented" }} - commented on an issue - {{ else if eq .Type "issue_closed" }} - closed an issue - {{ else if eq .Type "issue_reopen" }} - reopened an issue - {{ else if eq .Type "pull_created" }} - created a pull request - {{ else if eq .Type "pull_commented" }} - commented on a pull request - {{ else if eq .Type "pull_merged" }} - merged a pull request - {{ else if eq .Type "pull_closed" }} - closed a pull request - {{ else if eq .Type "pull_reopen" }} - reopened a pull request - {{ else if eq .Type "followed" }} - followed you - {{ else if eq .Type "user_mentioned" }} - mentioned you - {{ else }} +{{ define "notificationNumber" }} + {{ if .Issue }} + #{{ .Issue.IssueId }} + {{ else if .Pull }} + #{{ .Pull.PullId }} {{ end }} {{ end }} -{{ define "notificationSummary" }} +{{ 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" }} - - {{ else if .Issue }} - #{{.Issue.IssueId}} {{.Issue.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} - {{ else if .Pull }} - #{{.Pull.PullId}} {{.Pull.Title}} on {{resolve .Repo.Did}}/{{.Repo.Name}} + 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" }} - - {{ else }} + 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 }} + {{ end }} + +{{ end }} + +{{ define "notificationSummary" }} + {{ if .Issue }} +
{{ .Issue.Title }}
+ {{ else if .Pull }} +
{{ .Pull.Title }}
{{ end }} {{ end }} -- tangled.sh