{{ define "title" }}Notifications · Tangled{{ end }} {{ define "content" }}

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-5" }}
{{/* Desktop controls: single row */}} {{/* Mobile: single filtered list */}}
{{ template "notifications/fragments/notifList" (dict "Groups" .MobileGroups "ReadFilter" .ReadFilter "CategoryFilter" "") }}
{{/* Desktop: two columns */}} {{ if gt .Total .Page.Limit }} {{ template "fragments/pagination" (dict "Page" .Page "TotalCount" .Total "BasePath" "/notifications" "QueryParams" (queryParams "read" .ReadFilter "category" .CategoryFilter) ) }} {{ end }} {{ end }} {{ define "notifications/fragments/notifList" }} {{ $readFilter := .ReadFilter }} {{ $hasAny := or .Groups.Today .Groups.ThisWeek .Groups.Older }}
{{ if or .CategoryFilter .UnreadCount }}

{{ .CategoryFilter }}

{{ with .UnreadCount }} {{ . }} {{ end }}
{{ 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 }}