diff --git a/appview/pages/templates/notifications/fragments/item.html b/appview/pages/templates/notifications/fragments/item.html index 04628218..085491e9 100644 --- a/appview/pages/templates/notifications/fragments/item.html +++ b/appview/pages/templates/notifications/fragments/item.html @@ -1,17 +1,21 @@ {{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" "#1e40af" "classes" "shrink-0 dark:hidden") }} - {{ template "repo/fragments/colorBall" (dict "color" "#3b82f6" "classes" "shrink-0 hidden dark:block") }} + {{ 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" . -}}
@@ -25,7 +29,15 @@
{{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 "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-600 dark:text-blue-500 + {{ else }}text-gray-500 dark:text-gray-400 + {{ end }} +{{ end }} {{ define "notificationNumber" }} {{ if .Issue }} diff --git a/appview/pages/templates/notifications/fragments/preview.html b/appview/pages/templates/notifications/fragments/preview.html index ae03375c..e304944b 100644 --- a/appview/pages/templates/notifications/fragments/preview.html +++ b/appview/pages/templates/notifications/fragments/preview.html @@ -1,4 +1,49 @@ {{ define "notifications/fragments/preview" }} +
+ {{ $read := .ReadFilter }} + {{ $cat := .CategoryFilter }} + +
+ + +
+ +
+ {{ range $k, $label := list "all" "work" "social" }} + + {{ $label }} + + {{ end }} +
+ +
+ {{ if .Notifications }}
{{ range .Notifications }} @@ -6,14 +51,16 @@ {{ end }}
{{ else }} -
- No notifications +
+
+ {{ if eq $read "unread" }}{{ i "inbox" "w-12 h-12" }}{{ else }}{{ i "bell-off" "w-12 h-12" }}{{ end }} +
+

{{ if eq $read "unread" }}All caught up!{{ else }}No notifications{{ end }}

{{ end }} - + + + View all {{ i "arrow-right" "size-4" }} + {{ end }} diff --git a/appview/pages/templates/notifications/list.html b/appview/pages/templates/notifications/list.html index f4bd2bf9..2b345550 100644 --- a/appview/pages/templates/notifications/list.html +++ b/appview/pages/templates/notifications/list.html @@ -1,65 +1,110 @@ {{ define "title" }}Notifications · Tangled{{ end }} {{ define "content" }} -
-
-

Notifications

- - {{ i "settings" "w-4 h-4" }} - Preferences - +
+

Notifications

+
+ + {{ $readVals := list + (dict "Key" "inbox" "Value" "Inbox" "Icon" "inbox") + (dict "Key" "unread" "Value" "Unread" "Icon" "glasses") + }} + + {{/* Mobile controls: single row */}} +
+
+ {{ template "fragments/tabSelector" (dict "Name" "read" "Values" $readVals "Active" .ReadFilter) }} +
+ + {{ i "cog" "size-4" }} +
- {{if .Notifications}} -
- {{range .Notifications}} - {{template "notifications/fragments/item" .}} - {{end}} + {{/* Desktop controls: single row */}} + - {{else}} -
-
-
- {{ i "bell-off" "w-16 h-16" }} -
-

No notifications

-

When you receive notifications, they'll appear here.

-
+ {{/* Mobile: single filtered list */}} +
+ {{ template "notifications/fragments/notifList" (dict "Groups" .MobileGroups "ReadFilter" .ReadFilter "CategoryFilter" "") }} +
+ + {{/* Desktop: two columns */}} + - {{ template "pagination" . }} + {{ if gt .Total .Page.Limit }} + {{ template "fragments/pagination" (dict + "Page" .Page + "TotalCount" .Total + "BasePath" "/notifications" + "QueryParams" (queryParams "read" .ReadFilter "category" .CategoryFilter) + ) }} + {{ end }} {{ end }} -{{ define "pagination" }} -
- {{ if gt .Page.Offset 0 }} - {{ $prev := .Page.Previous }} - - {{ i "chevron-left" "w-4 h-4" }} - Previous - - {{ else }} -
+{{ define "notifications/fragments/notifList" }} + {{ $readFilter := .ReadFilter }} + {{ $hasAny := or .Groups.Today .Groups.ThisWeek .Groups.Older }} +
+ {{ if or .CategoryFilter .UnreadCount }} +
+

{{ .CategoryFilter }}

+ {{ with .UnreadCount }} + + {{ . }} + {{ end }} - - {{ $next := .Page.Next }} - {{ if lt $next.Offset .Total }} - {{ $next := .Page.Next }} - - Next - {{ i "chevron-right" "w-4 h-4" }} - +
+ {{ end }} + {{ if $hasAny }} + {{ $groupStyle := "px-2 md:px-6 py-2 bg-gray-50 dark:bg-gray-900 text-gray-500 dark:text-gray-400 text-sm" }} + {{ if .Groups.Today }} +
Today
+ {{ range .Groups.Today }}{{ template "notifications/fragments/item" . }}{{ end }} + {{ end }} + {{ if .Groups.ThisWeek }} +
This week
+ {{ range .Groups.ThisWeek }}{{ template "notifications/fragments/item" . }}{{ end }} {{ end }} + {{ if .Groups.Older }} +
Older
+ {{ range .Groups.Older }}{{ template "notifications/fragments/item" . }}{{ end }} + {{ end }} + {{ else }} +
+
+ {{ if eq $readFilter "unread" }}{{ i "inbox" "w-12 h-12" }}{{ else }}{{ i "bell-off" "w-12 h-12" }}{{ end }} +
+

{{ if eq $readFilter "unread" }}All caught up!{{ else }}No notifications{{ end }}

+
+ {{ end }}
{{ end }} +