Skip to content

feat: Full notification features in API and new UI - #1306

Merged
florentc merged 1 commit into
NixOS:mainfrom
tweag:ui-v2-notifications
Sep 10, 2026
Merged

feat: Full notification features in API and new UI#1306
florentc merged 1 commit into
NixOS:mainfrom
tweag:ui-v2-notifications

Conversation

@florentc

@florentc florentc commented Sep 8, 2026

Copy link
Copy Markdown
Member

This completes the notifications API with necessary endpoints and implements a notification center on the new UI.

Notification center

2026-09-08 15-53-12

It is very similar in appearance to the legacy one but comes with quality of life features:

  • Suggestions are displayed in the notifications. Not just a stub. By default it's in collapsed mode so it looks like it, but you can unfold as you need.
  • The suggestions are mutable: you can dismiss/accept/publish or edit packages from within the notification itself
  • These mutations live update the "Matching packages you follow" section
  • When no package matches anymore, you get the "obsolete" notice

Notification bell

The notification bell in the header bar used to be updated as part of full page reloads in the old UI. We no longer have page reloads in the new UI.

For the time being I went with the most pragmatic approach. I introduced an API endpoint that returns the unread counter. The frontend fetches the info on load, then polls every 2 minutes. It uses react query which is smart enough not to poll when the browser tab isn't in focus. 2 minutes is virtually nothing for the backend, the endpoint is tiny, and no notification is more urgent than a 2 minutes maximum delay.

A push notification / websocket approach seemed totally overkill to me. Unless in the future we introduce those globally on sec tracker for most interactions (concurrent suggestion editing, etc). In any case I think this will deserve its own PR.

The bell now animates a little to attract attention upon changes to the counter.

Misc

Disabled buttons

At some point I needed to disable the "Mark all as read" and "Clear read" buttons (before realizing I should not). There never was visual feedback (apart from mouse cursor change) for disabled buttons.

Now there is:

2026-09-08 15-53-32 2026-09-08 15-53-40

It became unrelated to this PR though. I can remove it and put it in its own PR if needed.

User settings in navigation bar

I have tried many variants to integrate the bell icon in the navbar. I tried to give it a label (otherwise the "User settings" label looked like text between 2 icons) but it was taking too much space. I tried to make everything a tab (like "Suggestions" and "Nixpkgs issues") but it looked out of place, didn't play well with the user avatar and notification counter, and it made the tabs shift upon loading the authentication state of the user. It also blurred the line between user matters and sectracker matters.

In the end I went with this:

2026-09-08 15-54-46

The "User settings" label is removed. Instead, I added a settings icon next to the user avatar to convey that it's a settings button. It has the added benefit of reducing flashing when loading the user authentication status.

Furthermore, this pattern with bell icon + user avatar is very common and conventional (e.g. GitHub).

@fricklerhandwerk fricklerhandwerk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! I didn't review the frontend code at any depth, but it seems to follow the same patterns we already have, and I trust you will keep it from falling apart! :)

Worth noting from the review session:

  • The long term plan is to replace notifications altogether with filters (e.g. show me suggestions containing packages I maintain)
  • The frontend carries a lot of extra code to maintain cache consistency due to the optimistic updates. It is the way it is, having two interacting state machines.
    • We deem the additional complexity worth the improvement of user experience

Comment thread src/api/tests/test_notifications.py Outdated
Comment thread src/api/tests/test_notifications.py Outdated
Comment thread src/api/tests/test_notifications.py Outdated
Comment thread src/api/tests/test_notifications.py
Comment thread src/api/tests/test_notifications.py
Comment thread src/webview/tests/ui_v2/test_notification_center.py Outdated
Comment thread src/api/issues/views.py Outdated
@florentc
florentc enabled auto-merge September 10, 2026 12:26
@florentc
florentc added this pull request to the merge queue Sep 10, 2026
Merged via the queue into NixOS:main with commit 52fa509 Sep 10, 2026
3 checks passed
@florentc florentc mentioned this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants