From badec5b11df0b3b377529d55c8fec6776edda3ac Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Mon, 15 Sep 2025 16:52:12 +0300 Subject: [PATCH] appview/pages: notifications ui and templating Change-Id: xwotmtuuvokmmvxtvpvtkmszustrulus Signed-off-by: Anirudh Oppiliappan --- appview/pages/pages.go | 40 ++++ appview/pages/templates/errors/500.html | 15 +- .../templates/layouts/fragments/topbar.html | 3 +- .../notifications/fragments/bell.html | 11 + .../notifications/fragments/count.html | 7 + .../notifications/fragments/item.html | 212 ++++++++++++++++++ .../pages/templates/notifications/list.html | 46 ++++ appview/pages/templates/strings/timeline.html | 2 +- .../templates/user/fragments/picHandle.html | 2 +- .../user/fragments/picHandleLink.html | 2 +- .../user/settings/notifications.html | 173 ++++++++++++++ 11 files changed, 498 insertions(+), 15 deletions(-) create mode 100644 appview/pages/templates/notifications/fragments/bell.html create mode 100644 appview/pages/templates/notifications/fragments/count.html create mode 100644 appview/pages/templates/notifications/fragments/item.html create mode 100644 appview/pages/templates/notifications/list.html create mode 100644 appview/pages/templates/user/settings/notifications.html diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 25d9f225..d1e72e5d 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -296,6 +296,35 @@ func (p *Pages) UserProfileSettings(w io.Writer, params UserProfileSettingsParam return p.execute("user/settings/profile", w, params) } +type NotificationsParams struct { + LoggedInUser *oauth.User + Notifications []*models.NotificationWithEntity + UnreadCount int + HasMore bool + NextOffset int + Limit int +} + +func (p *Pages) Notifications(w io.Writer, params NotificationsParams) error { + return p.execute("notifications/list", w, params) +} + +type NotificationItemParams struct { + Notification *models.Notification +} + +func (p *Pages) NotificationItem(w io.Writer, params NotificationItemParams) error { + return p.executePlain("notifications/fragments/item", w, params) +} + +type NotificationCountParams struct { + Count int +} + +func (p *Pages) NotificationCount(w io.Writer, params NotificationCountParams) error { + return p.executePlain("notifications/fragments/count", w, params) +} + type UserKeysSettingsParams struct { LoggedInUser *oauth.User PubKeys []models.PublicKey @@ -318,6 +347,17 @@ func (p *Pages) UserEmailsSettings(w io.Writer, params UserEmailsSettingsParams) return p.execute("user/settings/emails", w, params) } +type UserNotificationSettingsParams struct { + LoggedInUser *oauth.User + Preferences *models.NotificationPreferences + Tabs []map[string]any + Tab string +} + +func (p *Pages) UserNotificationSettings(w io.Writer, params UserNotificationSettingsParams) error { + return p.execute("user/settings/notifications", w, params) +} + type UpgradeBannerParams struct { Registrations []models.Registration Spindles []models.Spindle diff --git a/appview/pages/templates/errors/500.html b/appview/pages/templates/errors/500.html index 34b52da0..529e2d59 100644 --- a/appview/pages/templates/errors/500.html +++ b/appview/pages/templates/errors/500.html @@ -5,7 +5,7 @@
- {{ i "alert-triangle" "w-8 h-8 text-red-500 dark:text-red-400" }} + {{ i "triangle-alert" "w-8 h-8 text-red-500 dark:text-red-400" }}
@@ -14,22 +14,15 @@ 500 — internal server error

- Something went wrong on our end. We've been notified and are working to fix the issue. -

-
-
- {{ i "info" "w-4 h-4" }} - we're on it! -
-

Our team has been automatically notified about this error.

-
+ We encountered an error while processing your request. Please try again later. +

diff --git a/appview/pages/templates/layouts/fragments/topbar.html b/appview/pages/templates/layouts/fragments/topbar.html index b98458d1..a997000d 100644 --- a/appview/pages/templates/layouts/fragments/topbar.html +++ b/appview/pages/templates/layouts/fragments/topbar.html @@ -10,6 +10,7 @@
{{ with .LoggedInUser }} {{ block "newButton" . }} {{ end }} + {{ template "notifications/fragments/bell" }} {{ block "dropDown" . }} {{ end }} {{ else }} login @@ -44,7 +45,7 @@ {{ define "dropDown" }}