feat: back the notification centre with error and warning toasts - #653
Open
KUASWoodyLIN wants to merge 1 commit into
Open
feat: back the notification centre with error and warning toasts#653KUASWoodyLIN wants to merge 1 commit into
KUASWoodyLIN wants to merge 1 commit into
Conversation
…toasts Failures surface as toasts and disappear with them. Record them so users can review what went wrong after the fact. - Add NotificationCenter: a capped (200), localStorage-backed, newest-first store that revives dates on load and prunes entries older than 7 days - Add ToastRecorder: syncs svelte-sonner's active toasts from the root layout, filing error/warning toasts and collapsing repeats into a count so a failing polling loop does not flood the list - Move the trigger out of the user dropdown into a sidebar bell button with an unread badge, keeping the Ctrl+N shortcut - Rework the sheet with mark-all-as-read, clear-all, per-item delete and expand/collapse for long messages - Wire the notification store into $lib/stores and cover both stores with unit tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Failures in the dashboard surface as toasts and disappear with them — once a
toast fades there is no way to find out what went wrong. This PR turns the
notification sheet into a real notification centre: error and warning toasts are
recorded as they are raised, persisted across reloads, and surfaced behind a bell
in the sidebar with an unread count.
Closes #
Notification store
A
NotificationCenterholding a newest-first list, capped at 200 entries andbacked by
localStorage, so notifications survive a reload. On load the storedJSON is revived — dates restored, malformed entries dropped, anything older than
7 days pruned.
Toast recorder
Bridges
svelte-sonnerinto the store.sync()reads sonner's live toast state,so a single
$effectin the root layout subscribes to it — existingtoast.*call sites are untouched.
errorandwarningtoasts are filed; aloadingtoast is filed if andwhen it resolves into an error.
level + title + contentsignature, so a toast updatedin place — or
toast.promisereusing one id — updates instead of duplicating.notification rather than filing hundreds of rows.
Notification centre
The sheet now lists recorded notifications with their level and read state, and
supports mark-all-as-read, clear-all, per-entry copy and delete. It opens from a
new bell in the sidebar header showing the unread count, which replaces the entry
in the user dropdown and keeps the Ctrl+N shortcut.