phoenixframework / phoenix

Peace of mind from prototype to production
https://www.phoenixframework.org
MIT License
21.45k stars 2.88k forks source link

Add flash kind for successful interactions #5969

Open rmoorman opened 2 weeks ago

rmoorman commented 2 weeks ago

Introduce a :success kind for flash messages in the generator output and update relevant documentation.

Success messages that previously used :info now use :success, ensuring they continue to appear in green with a "Success!" title.

In certain cases (e.g. password reset), :info is retained to avoid disclosing too much information (such as the existence of an account). These messages now appear in blue with a "Please note" title.

Rationale for those changes:

SteffenDE commented 2 weeks ago

Hi @rmoorman, thank you for contributing! Did you see https://github.com/phoenixframework/phoenix/pull/5844 and especially https://github.com/phoenixframework/phoenix/pull/5844#issuecomment-2218478212?

rmoorman commented 2 weeks ago

Oh my! @SteffenDE , I indeed didn't see that.

I suppose @josevalim didn't have a change of heart yet in this matter? 😄

IMHO it is likely that at least one neutral message kind/style is often needed (instead of green).

On one hand this could be added (like in this PR at the moment). In case it would be feasible/wanted to move this forward, of course I would also amend the inline documentation.

But on the other hand, indeed the :info style could be adjusted to be more neutral without adding another kind. I can also amend this PR to give the info flash message a more neutral styling. (wondering though how the title could be made more neutral 🤷🏻 )

Just let me know how you would like me to proceed.

glhrmv commented 3 days ago

Personally I think this introduces a very useful and intuitive option that most people would likely self-implement. An "official" option makes total sense.