diogogpinto / filament-auth-ui-enhancer

This Filament plugin empowers you to transform your auth pages with ease, allowing you to make them truly stand out. It offers a flexible alternative to the default auth pages in the Filament Panels package.
MIT License
89 stars 9 forks source link

Feature: URL for Empty Panel #9

Open johntrickett86 opened 4 months ago

johntrickett86 commented 4 months ago

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 commented 4 months ago

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

diogogpinto commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

@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.