Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tags and onCancel to toasts #777

Merged
merged 2 commits into from
Feb 1, 2024
Merged

Add tags and onCancel to toasts #777

merged 2 commits into from
Feb 1, 2024

Conversation

ekzyis
Copy link
Member

@ekzyis ekzyis commented Feb 1, 2024

I added tags to toasts in #749 for UX reasons. They work similar to how we merge push notifications in the service worker. So 2x subscribed becomes 1x (2) subscribed. This behavior is enabled by default since the body of a toast will be used as the tag by default and since I think this always makes sense to declutter the UI.

I figured that having this as a dedicated PR is easier to review. I will rebase #749 on this PR.

This also includes being able to attach an onCancel function to a toast. If a toast contains an onCancel function, it will not be closed on page navigation. This was also added in #749 to cancel async zaps (NWC) and can also be used to cancel custodial zaps in the near future, too.

Since toasts can have onCancel and the same tag (for example by simply having the same body), the onCancel of the most recent toast is shown. It that one is closed, the next uncanceled toast with same tag is shown.

I think that's better UX then the other way around (show onCancel of oldest toast with same tag) since you usually want to cancel your latest action.

2024-02-01.15-40-19.mp4

@ekzyis ekzyis added the feature new product features that weren't there before label Feb 1, 2024
@ekzyis ekzyis changed the title Merge toasts with same body together using tags Add tags and onCancel to toasts Feb 1, 2024
@ekzyis ekzyis added feature new product features that weren't there before and removed feature new product features that weren't there before labels Feb 1, 2024
@ekzyis ekzyis mentioned this pull request Feb 1, 2024
16 tasks
@huumn huumn merged commit b2ba333 into master Feb 1, 2024
1 check passed
@ekzyis ekzyis deleted the toast-tags branch February 14, 2024 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new product features that weren't there before
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants