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

Show for how long a "sticky" notification has been displayed #3395

Open
Poslovitch opened this issue Dec 3, 2020 · 2 comments
Open

Show for how long a "sticky" notification has been displayed #3395

Poslovitch opened this issue Dec 3, 2020 · 2 comments

Comments

@Poslovitch
Copy link
Contributor

Describe the problem to be solved

Sticky notifications were introduced in #3347. There is, however, no way to know when it was displayed. This information could be considered helpful in cases where the user encounters an error (be it uploading a video, modifying settings, etc.) and additional information (such as logs) would be available on the server (thus helping to sift through the logs).

Describe the solution you would like:

I suggest adding something like 'X time ago' on these sticky notifications. Something similar to what's already done on notifications:

image

Maybe taking inspiration from Bootstrap?

image

Also, providing the exact date and time when hovering the "x time ago" text would be helpful:
image

@Poslovitch
Copy link
Contributor Author

Poslovitch commented Dec 5, 2020

I was able to implement such a feature. However, there's an issue (don't mind the CSS, haven't done it yet):

image

The text will never update, and therefore remain as "just now" no matter how long the toast's been displayed. Has someone got any hints or workarounds that I could try to get this problem out of the picture?

Based on what I've seen, toasts are handled by PrimeNG: they provide the p-toast component which we then populate with the content we want.
I'm not sure what kind of "control" over the component this gives us. Are we allowed to override/overwrite some of its functions? (would it even be useful?)

I think that running a function every X seconds would be a very stupid idea. That would work, but oh boy that'd be stupid.

@Poslovitch
Copy link
Contributor Author

My current implementation can be seen at https://github.com/Poslovitch/PeerTube/tree/feature/3395-toast-x-time-ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants