customize login screen and mmbers as landing page closes #68 and #137 #138

Merged
carla merged 5 commits from feature/68_log_in_screen into main 2025-08-21 13:49:43 +02:00
Owner
No description provided.
carla added 3 commits 2025-08-06 12:52:12 +02:00
carla added this to the Sprint 5 - 31.07. - 11.09. project 2025-08-06 12:52:13 +02:00
requested reviews from moritz, simon, rafael 2025-08-06 12:52:24 +02:00
Collaborator

Seems like the tests need to be updated to work with the new changes :)

Seems like the tests need to be updated to work with the new changes :)
rafael reviewed 2025-08-14 10:59:06 +02:00
rafael left a comment
Collaborator

The login page looks great now :)

The login page looks great now :)
@ -1,7 +1,7 @@
/* See the Tailwind configuration guide for advanced usage
https://tailwindcss.com/docs/configuration */
@import "tailwindcss" source(none);
Collaborator

I'm trying to understand what this line did before 🤔 Looking at the tailwind docs here it seems like it disabled the scanning for tailwind classes completely? I have no idea why the phoenix generators would enable this by default. Do you know why this was in here?

I'm trying to understand what this line did before 🤔 Looking at [the tailwind docs here](https://tailwindcss.com/docs/detecting-classes-in-source-files#disabling-automatic-detection) it seems like it disabled the scanning for tailwind classes completely? I have no idea why the phoenix generators would enable this by default. Do you know why this was in here?
Author
Owner

It came with the Phoenix upgrade to 1.8 but I have not found any information why...

It came with the Phoenix upgrade to 1.8 but I have not found any information why...
Collaborator

Ah, maybe it's because these lines below:

@source "../css";
@source "../js";
@source "../../lib/mv_web";

that explicitly register the sources tailwind should scan. So without this setting, tailwind will scan all files in the repository, I guess? Did the source(none) cause any problems for you?

Ah, maybe it's because these lines below: ``` @source "../css"; @source "../js"; @source "../../lib/mv_web"; ``` that explicitly register the sources tailwind should scan. So without this setting, tailwind will scan *all* files in the repository, I guess? Did the `source(none)` cause any problems for you?
Author
Owner

Yes, the classes were not applied to the ash-authentication part of the loginscreen.

Yes, the classes were not applied to the ash-authentication part of the loginscreen.
rafael marked this conversation as resolved
@ -37,6 +37,9 @@ defmodule MvWeb.LiveUserAuth do
end
def on_mount(:live_no_user, _params, _session, socket) do
Gettext.put_locale(MvWeb.Gettext, "de")
Collaborator

Is there a way to detect the language of the user automatically? Maybe phoenix has a feature for that. This would make sure that folks who don't speak german will get the english login page. I think it makes sense to display the login page in german as a fallback, if the browser doesn't send a preferred language. Maybe we can open an issue for that? :)

Is there a way to detect the language of the user automatically? Maybe phoenix has a feature for that. This would make sure that folks who don't speak german will get the english login page. I think it makes sense to display the login page in german as a fallback, if the browser doesn't send a preferred language. Maybe we can open an issue for that? :)
Author
Owner

I think adding a language switch to the login screen needs more customization than the overrides AshAuthentication provides. As I think it's not that high priority right now I added another issue, but to not spend time on it right now. Is that fine?

I think adding a language switch to the login screen needs more customization than the overrides AshAuthentication provides. As I think it's not that high priority right now I added another issue, but to not spend time on it right now. Is that fine?
Collaborator

Yes, totally fine!

Yes, totally fine!
rafael marked this conversation as resolved
rafael reviewed 2025-08-14 11:02:32 +02:00
@ -19,1 +18,3 @@
# end
# Avoid full-width for the Sign In Form
override AshAuthentication.Phoenix.Components.SignIn do
set :root_class, "min-w-md"
Collaborator

It seems like this makes the login form too wide on mobile screens. Maybe it should be max-w-md?

It seems like this makes the login form too wide on mobile screens. Maybe it should be `max-w-md`?
rafael marked this conversation as resolved
rafael reviewed 2025-08-14 12:55:33 +02:00
@ -12,6 +12,7 @@ module.exports = {
"../lib/mv_web.ex",
"../lib/mv_web/**/*.*ex"
],
safelist: ['h-screen', 'px-6', 'h-screen', 'place-items-center', 'px-20', 'px-24'], // Classes that are used by AshAuthentication Sign-In Page are otherwise purged
Collaborator

Hmm, in the line above we configure tailwind to check the ash authentication files as well:

  content: [
    "../deps/ash_authentication_phoenix/**/*.*ex",
    ...

it seems like that's not working if we need to add the classes manually to the safelist?

Hmm, in the line above we configure tailwind to check the ash authentication files as well: ``` content: [ "../deps/ash_authentication_phoenix/**/*.*ex", ... ``` it seems like that's not working if we need to add the classes manually to the safelist?
Author
Owner

No you are right, that was a leftover, if we set tailwindcss as in the other comment we do not need the safelist

No you are right, that was a leftover, if we set tailwindcss as in the other comment we do not need the safelist
rafael marked this conversation as resolved
carla added 1 commit 2025-08-14 16:22:45 +02:00
carla force-pushed feature/68_log_in_screen from 14061401ea to afdb5f0647 2025-08-14 16:23:26 +02:00 Compare
rafael reviewed 2025-08-15 10:04:29 +02:00
@ -40,0 +39,4 @@
def on_mount(:live_no_user, _params, session, socket) do
# Set the locale for not logged in user to set the language
locale = session["locale"] || "en"
Gettext.put_locale(MvWeb.Gettext, locale)
Collaborator

Do we also need to set the locale here when the router already does it?

Do we also need to set the locale here when the router already does it?
Author
Owner

Yes, otherwise the login scren is not translated. At least I found no other way.

Yes, otherwise the login scren is not translated. At least I found no other way.
Collaborator

Okay, could you add a comment saying that this is the reason? This will make it easier to understand if somebody stumbles upon this in the future :)

Okay, could you add a comment saying that this is the reason? This will make it easier to understand if somebody stumbles upon this in the future :)
rafael marked this conversation as resolved
rafael reviewed 2025-08-15 10:06:02 +02:00
@ -20,0 +29,4 @@
# Translate the or in the horizontal rule to German
override AshAuthentication.Phoenix.Components.HorizontalRule do
set :text,
Gettext.with_locale(MvWeb.Gettext, "de", fn ->
Collaborator

It seems like this would always make the text on the horizontal rule german, even when the user chooses an english locale 🤔

It seems like this would always make the text on the horizontal rule german, even when the user chooses an english locale 🤔
Author
Owner

Yes, I would actually take care of that later because I already spent too much time on it. It should not be complicated but we would need to acces the locale here jut for translating or. I would create another issue for that, is that fine?

Yes, I would actually take care of that later because I already spent too much time on it. It should not be complicated but we would need to acces the locale here jut for translating or. I would create another issue for that, is that fine?
Collaborator

Yes, let's do that!

Yes, let's do that!
Author
Owner
https://git.local-it.org/local-it/mitgliederverwaltung/issues/146
rafael marked this conversation as resolved
rafael reviewed 2025-08-15 10:10:00 +02:00
@ -145,1 +151,4 @@
end
# Get locale from user
defp extract_locale_from_headers(headers) do
Collaborator

This looks excellent, great that you managed to do it in such a simple way :)

This looks excellent, great that you managed to do it in such a simple way :)
rafael marked this conversation as resolved
carla force-pushed feature/68_log_in_screen from afdb5f0647 to f0b0de0008 2025-08-21 13:30:08 +02:00 Compare
carla added 1 commit 2025-08-21 13:40:28 +02:00
rafael approved these changes 2025-08-21 13:47:42 +02:00
carla merged commit 3456f7f6b7 into main 2025-08-21 13:49:43 +02:00
carla deleted branch feature/68_log_in_screen 2025-08-21 13:49:44 +02:00
Sign in to join this conversation.
No description provided.