Change request/ID verification flow to use separate pages instead of a modal#7238
Change request/ID verification flow to use separate pages instead of a modal#7238
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Greptile SummaryConverts the privacy request flow from a modal-based approach to full-page Next.js routes, improving user experience with dedicated pages for form submission, ID verification, and success confirmation. Successfully refactored Key changes:
Minor improvements:
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: 7c0d9df |
| }} | ||
| data-testid={dataTestId} | ||
| > | ||
| <div style={{ width: "100%", maxWidth, padding: "48px 24px" }}> |
There was a problem hiding this comment.
style: uses div instead of semantic components - per coding standards, prefer Ant Design's Flex component or other semantic elements
| <div style={{ width: "100%", maxWidth, padding: "48px 24px" }}> | |
| <Flex style={{ width: "100%", maxWidth, padding: "48px 24px" }}> |
Context Used: Rule from dashboard - Avoid using div elements when possible. Use semantic HTML elements or component library alternativ... (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!
There was a problem hiding this comment.
Not as worried about semantic dom here, but some of the styles could use tailwind instead of being inline
| <div | ||
| style={{ | ||
| backgroundColor: "white", | ||
| padding: "48px", | ||
| width: "100%", | ||
| borderRadius: "4px", | ||
| boxShadow: | ||
| "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)", | ||
| }} |
There was a problem hiding this comment.
style: uses div for form container - prefer semantic or Flex component
| <div | |
| style={{ | |
| backgroundColor: "white", | |
| padding: "48px", | |
| width: "100%", | |
| borderRadius: "4px", | |
| boxShadow: | |
| "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)", | |
| }} | |
| <Flex | |
| style={{ | |
| backgroundColor: "white", | |
| padding: "48px", | |
| width: "100%", | |
| borderRadius: "4px", | |
| boxShadow: | |
| "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)", | |
| }} | |
| > |
Context Used: Rule from dashboard - Avoid using div elements when possible. Use semantic HTML elements or component library alternativ... (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!
speaker-ender
left a comment
There was a problem hiding this comment.
Some minor nits and questions but overall looks good.
| }} | ||
| data-testid={dataTestId} | ||
| > | ||
| <div style={{ width: "100%", maxWidth, padding: "48px 24px" }}> |
There was a problem hiding this comment.
Not as worried about semantic dom here, but some of the styles could use tailwind instead of being inline
| iconPath={action.icon_path} | ||
| description={action.description} | ||
| onOpen={onPrivacyModalOpen} | ||
| onOpen={handlePrivacyRequestOpen} |
There was a problem hiding this comment.
nit: should we change the onOpen prop to onClick to match the native ant card component since it's not "opening" something?
| if (onSuccessWithoutVerification) { | ||
| onSuccessWithoutVerification(); | ||
| } else { | ||
| onClose(); |
There was a problem hiding this comment.
nit: can we rename onClose since we aren't closing a modal?
| }, [getIdVerificationConfigQuery]); | ||
|
|
||
| if (Number.isNaN(parsedActionIndex)) { | ||
| return null; |
There was a problem hiding this comment.
Should we re-direct or throw some kind of error message if the route isn't valid instead of displaying nothing?
| const action = config.actions[parsedActionIndex] as | ||
| | PrivacyRequestOption | ||
| | undefined; |
There was a problem hiding this comment.
Is there a reason to type cast here?
| params: Promise<{ actionIndex: string }>; | ||
| searchParams: NextSearchParams; | ||
| }) => { | ||
| const { actionIndex } = await params; |
There was a problem hiding this comment.
I like the idea of having a dynamic route for the different actions.
Are we able to/do you think it makes sense to use the action title or some other identifier instead of an index?
Using the index is a little less stable. If someone re-organizes the config, the links to actions would be mixed up.
There was a problem hiding this comment.
Good suggestion, I've updated to use the action key instead of the index.
| title, | ||
| }: PrivacyRequestLayoutProps) => { | ||
| return ( | ||
| <AuthFormLayout |
There was a problem hiding this comment.
Is this component doing anything other than passing some defaults to the AuthFormLayout component? If so, why not just use the component directly?
| if (typeof window !== "undefined") { | ||
| sessionStorage.setItem("privacyRequestId", id); | ||
| } |
There was a problem hiding this comment.
accesses window.sessionStorage directly - prefer using global context when available rather than window access
| if (typeof window !== "undefined") { | |
| sessionStorage.setItem("privacyRequestId", id); | |
| } | |
| sessionStorage.setItem("privacyRequestId", id); |
Context Used: Rule from dashboard - Prefer passing configuration options as props to components instead of accessing global window objec... (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!
| if (typeof window !== "undefined") { | ||
| const storedId = sessionStorage.getItem("privacyRequestId"); | ||
| if (storedId) { | ||
| setPrivacyRequestId(storedId); | ||
| } else { | ||
| // If no request ID, redirect back to form | ||
| router.push(`/privacy-request/${encodeURIComponent(policyKey)}`); | ||
| } | ||
| } |
There was a problem hiding this comment.
accesses window.sessionStorage directly - prefer using global context when available rather than window access
| if (typeof window !== "undefined") { | |
| const storedId = sessionStorage.getItem("privacyRequestId"); | |
| if (storedId) { | |
| setPrivacyRequestId(storedId); | |
| } else { | |
| // If no request ID, redirect back to form | |
| router.push(`/privacy-request/${encodeURIComponent(policyKey)}`); | |
| } | |
| } | |
| const storedId = sessionStorage.getItem("privacyRequestId"); |
Context Used: Rule from dashboard - Prefer passing configuration options as props to components instead of accessing global window objec... (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!
Ticket ENG-2283
Description Of Changes
Converted the privacy request flow from a modal-based approach to full-page routes. The form, verification, and success states now use dedicated Next.js pages with a consistent layout. Refactored ExternalAuthLayout to use a shared AuthFormLayout component to reduce code duplication.
Code Changes
ExternalAuthLayoutto useAuthFormLayoutinstead of duplicating layout codeSteps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works