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

Feature: URL for Empty Panel #9

Open
johntrickett86 opened this issue Nov 6, 2024 · 5 comments
Open

Feature: URL for Empty Panel #9

johntrickett86 opened this issue Nov 6, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@johntrickett86
Copy link

What happened?

Hey Diogo. Love the package. In a recent project, I modified it so that I could give me customer the ability to update the image and add an optional URL to the empty panel - helpful for them to add marketing images with links.

How to reproduce the bug

If you think it would be helpful, I'd be happy to submit a PR to make it an optional feature of the package?

Package Version

2

PHP Version

8.2

Laravel Version

11

Which operating systems does with happen with?

No response

Notes

No response

@johntrickett86 johntrickett86 added the bug Something isn't working label Nov 6, 2024
@johntrickett86
Copy link
Author

Apologies for selecting bug for this, the url for feature is broken!

@diogogpinto
Copy link
Owner

Hey @johntrickett86

Thank you so much for your feedback and enhancement proposal! It's (really) greatly appreciated.

All PRs are very welcome 🤘🏻

Regarding your enhancement, I'm having trouble understanding the following:

In a recent project, I modified it so that I could give me customer the ability to update the image and add an optional URL to the empty panel - helpful for them to add marketing images with links.

I don't understand what exactly you mean. Currently you can already update the image for the empty panel - when you say customer, you mean logged in user? If so, when he's logged out, how can he see the image if no auth is established? Or is it one panel per user?

If you could clarify I would greatly appreciate!

Thank you for your kind words John, I'm here if you need anything!

@johntrickett86
Copy link
Author

johntrickett86 commented Nov 8, 2024

Hi @diogogpinto,

This is around making the image clickable with a URL. So in my project I have this on a settings page:

Screenshot 2024-11-08 at 7 48 45 AM

If a URL is provided, it wraps the empty panel image in a href tag to open the url in a new window. If this is something you think would be useful for others, I would suggest submitted a PR that allows the following methods:

AuthUIEnhancerPlugin::make()
->emptyPanelClickableUrl('https://www.filamentphp.com/') // if empty then no URL applied
->openUrlInNewTab(false) // default which could be change to true

I have it working in my project and it's a nice touch - it's a client portal so it's customer facing. This allows me the ability to let the marketing team control the image and url so they can target customers.

@diogogpinto
Copy link
Owner

That makes sense! If it is a feature for you, I'm sure a lot of people will find it useful.

Suggestion:

Would it make sense to pass the target in the same method? Like:

->setEmptyPanelLink(url: $url, openInNewTab: true)

Let me know what you think! I don't know if validation for URL may be a overkill at this point.

@johntrickett86
Copy link
Author

@diogogpinto Yes it makes it much easier having this all in a single method.

I think it is possibly overkill - my logic would be that if the URL was fixed, I would expect the developer to have tests to ensure the URL is valid. If you put the URL in the hands of your users (like in my case), the URL validation happens in the form.

Let me know if you think there is an angle I've missed with that though, happy to include it if you feel it is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants