refactor(auth): make more generic AuthAside, and AuthPageFrame DEV-1850 - #7612
magicznyleszek wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The refactor preserves existing behavior and consistently updates the affected components and references.
Pull request overview
Refactors authentication layouts and supporting content into reusable components while preserving existing registration behavior.
Changes:
- Extracts the shared authentication page frame.
- Generalizes the registration aside as
AuthAside. - Updates registration and Storybook references.
File summaries
| File | Description |
|---|---|
| jsapp/js/auth/RegisterRoute/RegisterRoute.tsx | Uses the generic authentication aside. |
| jsapp/js/auth/RegisterRoute/RegisterAside.tsx | Removes the registration-specific component. |
| jsapp/js/auth/AuthContainer/AuthPageFrame.tsx | Adds the reusable authentication page frame. |
| jsapp/js/auth/AuthContainer/AuthPageFrame.module.scss | Styles the extracted page frame. |
| jsapp/js/auth/AuthContainer/AuthContainer.tsx | Wraps routed screens with the shared frame. |
| jsapp/js/auth/AuthContainer/AuthAside.tsx | Adds the generic supporting-content component. |
| jsapp/js/auth/AuthContainer/AuthAside.stories.tsx | Updates stories for the generic aside. |
| jsapp/js/auth/AuthContainer/AuthAside.module.scss | Styles the generic aside content. |
Review details
- Files reviewed: 6/8 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
1304a4b to
7ceae4a
Compare
|
I don't think it's directly caused by this PR, but I notice when loading the registration page I'm hitting the /environment endpoint four times. I think we need to configure the staletime on the hook for that API call. Can you look into that? |
jamesrkiger
left a comment
There was a problem hiding this comment.
Left a comment about us hitting the environment endpoint too much. Let's resolve that in this PR stack, but I'll leave it up to you which PR to do it in. Otherwise LGTM
Added some code to fix that :) |
69305d0 to
32c9bc4
Compare
| <header className={styles.header}> | ||
| {authConfiguration?.show_kobotoolbox_logo && ( | ||
| <a className={styles.logoLink} href='/'> | ||
| <img className={styles.logo} src={logoUrl} alt='KoboToolbox' /> |
There was a problem hiding this comment.
The extracted page frame uses the hardcoded KoboToolbox alt text for its logo. Screen readers announce this label, so it is user-facing text that the repository requires to be wrapped in t(). Please satisfy that requirement before merging.
| <img className={styles.logo} src={logoUrl} alt='KoboToolbox' /> | |
| <img className={styles.logo} src={logoUrl} alt={t('KoboToolbox')} /> |
Rule Used: Only flag a hardcoded string as needing translation when it is user-facing: rendered in the React UI, or returned in an API/HTTP response body that end users or the frontend display (DRF ValidationError messages, default_detail, serializer er... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
🗒️ Checklist
#Support Docs Updates, if any<type>(<scope>)<!>: <title> DEV-1234Front endand/orBack endorworkflow💭 Notes
Groundwork for a route blocker - it will add a "complete your profile details" screen that has to look like the other authentication screens but is reached after login, outside the
/authroutes. Two pieces it needs were split out:AuthPageFrame- the background, logo, language picker and legal links, lifted out ofAuthContainer.AuthContaineris now just the/authlayout route: the frame around an<Outlet/>.AuthAside-RegisterRoute/RegisterAsidemade generic and moved next toAuthCard, plusshouldRenderAuthAside()so a screen can decide whether to open the column at all.useEnvironmentQuery- to avoid making multiple calls to environment endpointPure refactor, no behavior change intended.
👀 Preview steps
authRedesignEnabledfeature flag on/#/auth/registerwelcome_messagesitewide message