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

[v7] Remove noty dependency in favor of a sweetalert2 fork - streamline notifications in core #5570

Open
pxpm opened this issue Jul 22, 2024 · 3 comments

Comments

@pxpm
Copy link
Contributor

pxpm commented Jul 22, 2024

In Laravel-Backpack/community-forum#1090 we were trying to address the fact that it's not possible to change the backpack core notifications. If you as a developer would prefer to use swal instead of noty of the other way around there isn't a single file (where notifications are triggered) that you didn't had to change to cater your needs.

Doing a little research on the issue I've uncovered some more things that highlight the fact that notifications in Backpack are a little bit all over the place and are not very consistent. You have the ability to trigger a noty from php Alert:: but not a sweetalert for eg.

Regarding the dependencies this issue intends to remove noty and sweetalert (v1) in favor of adding sweertalert2 (or a fork of it because of the russian issue).
We now use a deprecated beta version of noty and a deprecated version of sweetalert (v1) soo yeah.

We should look at this as the opportunity to make backpack core notifications "easily" configurable for the 90% use cases. the 10% should still have the ability to create a blade file with their own notifications and use the same api to trigger them.

@zachweix
Copy link
Contributor

zachweix commented Sep 5, 2024

I second this suggestion. In theory most of the functionality is easy enough to handle merging this all into one blade file, or perhaps 2 files - one to update all the alerts from JavaScript and local storage into a workable array, and then another to actually display the alerts. Once this is being done, I assume we should allow users to add more info than just type and text?

Has anyone started working on this, maybe I can try to look at this one day until someone else is able to come along?

@pxpm
Copy link
Contributor Author

pxpm commented Sep 6, 2024

Hey @zachweix thanks for the input 🙏

We haven't started working on this, no. Actually we talked about this a few days ago, and I know @tabacitu had been doing some research about this subject.

I think it wouldn't be wise to start working on this just now, until we are certain of what, and how this issue will be addressed.
Be assured that when we decide how to proceed we will update this issue, and maybe then if you want to give it a shot, I'd say to go ahead 👍 thanks for helping out.

Cheers

@zachweix
Copy link
Contributor

zachweix commented Sep 6, 2024

Sounds good, thanks. It took me a while to figure out how to make a notification like Noty in sweetalert2, so I just want to put it here for posterity (partially for my sake 🙂)

const Toast = Swal.mixin({
  toast: true,
  position: "top-end",
  showConfirmButton: false,
  timer: 3000,
  timerProgressBar: true,
  didOpen: (toast) => {
    toast.onmouseenter = Swal.stopTimer;
    toast.onmouseleave = Swal.resumeTimer;
  }
});
Toast.fire({
  icon: "success",
  title: "Signed in successfully"
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: No status
Development

No branches or pull requests

2 participants