| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-notifications"> |
| 3 | <header class="shithub-notifications-head"> |
| 4 | <h1>Notifications</h1> |
| 5 | <nav class="shithub-tabs"> |
| 6 | <a href="/notifications" class="shithub-button {{ if ne .Filter "unread" }}shithub-button-primary{{ end }}">All</a> |
| 7 | <a href="/notifications?filter=unread" class="shithub-button {{ if eq .Filter "unread" }}shithub-button-primary{{ end }}">Unread ({{ .UnreadCount }})</a> |
| 8 | </nav> |
| 9 | {{ if .Notifications }} |
| 10 | <form method="post" action="/notifications/mark-all-read" style="display:inline"> |
| 11 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 12 | <button type="submit" class="shithub-button">Mark all read</button> |
| 13 | </form> |
| 14 | {{ end }} |
| 15 | </header> |
| 16 | |
| 17 | {{ if .Notifications }} |
| 18 | <ul class="shithub-notifications-list"> |
| 19 | {{ range .Notifications }} |
| 20 | <li class="shithub-notification-row {{ if .Unread }}is-unread{{ end }}"> |
| 21 | <div class="shithub-notification-meta"> |
| 22 | <span class="shithub-pill shithub-pill-reason">{{ .Reason }}</span> |
| 23 | {{ if .RepoOwnerUsername }} |
| 24 | <a href="/{{ .RepoOwnerUsername }}/{{ .RepoName }}">{{ .RepoOwnerUsername }}/{{ .RepoName }}</a> |
| 25 | {{ end }} |
| 26 | </div> |
| 27 | <div class="shithub-notification-body"> |
| 28 | {{ if .ThreadNumber }} |
| 29 | <a href="/{{ .RepoOwnerUsername }}/{{ .RepoName }}/{{ if eq (printf "%s" .ThreadKind.NotificationThreadKind) "pr" }}pulls{{ else }}issues{{ end }}/{{ .ThreadNumber }}"> |
| 30 | <strong>#{{ .ThreadNumber }} {{ .ThreadTitle }}</strong> |
| 31 | </a> |
| 32 | {{ else }} |
| 33 | <strong>{{ .Kind }}</strong> |
| 34 | {{ end }} |
| 35 | <small>by @{{ .ActorUsername }} · {{ relativeTime .LastEventAt.Time }}</small> |
| 36 | </div> |
| 37 | <div class="shithub-notification-actions"> |
| 38 | {{ if .Unread }} |
| 39 | <form method="post" action="/notifications/{{ .ID }}/read" style="display:inline"> |
| 40 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 41 | <button type="submit" class="shithub-button">Mark read</button> |
| 42 | </form> |
| 43 | {{ else }} |
| 44 | <form method="post" action="/notifications/{{ .ID }}/unread" style="display:inline"> |
| 45 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 46 | <button type="submit" class="shithub-button">Mark unread</button> |
| 47 | </form> |
| 48 | {{ end }} |
| 49 | </div> |
| 50 | </li> |
| 51 | {{ end }} |
| 52 | </ul> |
| 53 | <nav class="shithub-pagination"> |
| 54 | {{ if .HasPrev }}<a href="?filter={{ .Filter }}&page={{ sub .Page 1 }}">← Newer</a>{{ end }} |
| 55 | {{ if .HasNext }}<a href="?filter={{ .Filter }}&page={{ add .Page 1 }}">Older →</a>{{ end }} |
| 56 | </nav> |
| 57 | {{ else }} |
| 58 | <p class="shithub-empty">{{ if eq .Filter "unread" }}Nothing unread.{{ else }}No notifications.{{ end }}</p> |
| 59 | {{ end }} |
| 60 | </section> |
| 61 | {{- end }} |