-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Implement Notifications API for templates #3093
Conversation
@maximlt @MarcSkovMadsen @jbednar This is very much a work in progress but if you have comments/suggestions about the API that would be very helpful. |
My thought was that I would have added the toast as a new component. I made an example on discourse a while back that shows the concept. I think it's more flexible not to tie it to a template, but provide the toast as a basic building block. |
Looks good to me! Like Marc, I do think it might not be necessary to tie it to a template. E.g. couldn't we have the same app in a notebook, but then displaying the notification some other way? |
The request for a standalone toast is here #2802 The basic implementation is here https://discourse.holoviz.org/t/toast-a-pop-up-notification/2903 I would really like a Toast widget based on Notyf JS. That is simple and beautiful. And I would also be willing to do the PR. |
One question I have is whether Toasts should be layouts that can display Panel components? The toast I proposed can only display text/ html. That is my need. |
The reason why I think it makes sense as part of a template or as a global object is that it doesn't respect any of the layout placement you might otherwise do with it, e.g. placing it inside a Row/Column effectively makes no sense, because the actual toasts will appear in the fixed absolute position you specify. Adding it as a root with .servable does make sense I suppose and you can still do that with my version. If we came up with some UI that worked in notebooks I'd probably just move the notifications object onto pn.state. |
Okay, so now I'm leaning towards actually making it global, i.e. providing a |
Seems like a good solution to me? Should the modal one day be similarly refactored into a global option? |
If we can make a modal that works in the notebook I'd be very open to that. |
Codecov Report
@@ Coverage Diff @@
## master #3093 +/- ##
==========================================
- Coverage 83.46% 83.17% -0.29%
==========================================
Files 190 192 +2
Lines 25206 25414 +208
==========================================
+ Hits 21038 21138 +100
- Misses 4168 4276 +108
Continue to review full report at Codecov.
|
Adds
pn.state.notifications
which can be enabled withpn.config.notifications = True | False
.Demo
ToDo