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

[Issue #2962] Login modal #3433

Merged
merged 8 commits into from
Jan 10, 2025
Merged

Conversation

acouch
Copy link
Collaborator

@acouch acouch commented Jan 7, 2025

Summary

Fixes #2962

Time to review: 15 mins

Changes proposed

  • Adds a modal for the login link
  • Moves the env route handler to a redirect

Mobile

image

Desktop

image

TODO

  • verify it is accessible
  • add tests
  • look over again

@acouch acouch mentioned this pull request Jan 7, 2025
3 tasks
@acouch acouch marked this pull request as ready for review January 9, 2025 17:06
if (!environment.AUTH_LOGIN_URL) {
throw new Error("AUTH_LOGIN_URL not defined");
}
return NextResponse.redirect(environment.AUTH_LOGIN_URL);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning NextResponse.redirect instead of redirect doesn't throw an error for the try/catch block.

}
return NextResponse.redirect(environment.AUTH_LOGIN_URL);
} catch (error) {
return new NextResponse(error as string, { status: 500 });
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should have a more graceful error message, but this is temporary anyway.

@@ -380,7 +380,7 @@ button.usa-pagination__button.usa-button {
}

@include at-media("desktop") {
.desktop\:margin-bottom-5px {
margin-bottom: 5px !important;
.desktop\:margin-bottom-3px {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USWDS has margins of 1px, 2px, or 4px:

image

@acouch acouch force-pushed the acouch/issue-2962-sign-in-modal branch from 3523540 to 0bf5664 Compare January 9, 2025 18:26
Copy link
Collaborator

@doug-s-nava doug-s-nava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one request for a test but nothing blocking

✅ ✅ ✅ ✅ ✅

loginUrl={authLoginUrl || ""}
/>
)}
{!user?.token && <LoginModal navLoginLinkText={t("nav_link_login")} />}
Copy link
Collaborator

@doug-s-nava doug-s-nava Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works because the LoginModal component includes the modal control button but if you're expecting to see something like <LoginButton> here, it's a little confusing to see <LoginModal> instead. Something for later, but there's probably a refactor that would make this a little easier to understand

}),
}));

describe("LoginModal", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a test that the login button directs to the correct location?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a constant now, so it would be just checking the link. Can add in a follow up

@acouch acouch merged commit 6f82fa2 into feature/nextjs-auth Jan 10, 2025
8 checks passed
@acouch acouch deleted the acouch/issue-2962-sign-in-modal branch January 10, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants