Feat: Sign up prompt on hub pages - #1125
JoshKornfeld wants to merge 12 commits into
Conversation
…t/climateconnect into feat/sign-up-pop-up-prompt
piperchester
left a comment
There was a problem hiding this comment.
Awesome work so far!
| buttonText={texts.join + "!"} | ||
| image={"/images/sign_up_prompt_image.jpg"} | ||
| infoTextOne={texts.receive_regular_updates_about_projects_topics} | ||
| infoTextTwo={texts.send_messages_comments_and_more} | ||
| onClose={handleCloseSignUpPrompt} | ||
| open={showSignUpPrompt} | ||
| subTitle={texts.sign_up_today_and_help_make_climate_neutral} | ||
| title={texts.change_the_world} |
There was a problem hiding this comment.
Nit: do you mind sorting these props? If you use VS Code this should be really easy with cmd+shift+p and type 'alphabetize'.
| export default function Signup() { | ||
| const { ReactGA } = useContext(UserContext); | ||
| const router = useRouter(); | ||
| const email = router.query.email; |
There was a problem hiding this comment.
Will .query always be defined? Want to minimize the chance for ReferenceError.
| // wasn't really sure how to handle the first time a user comes the page as the cookie being looked up is undefined at first | ||
| if (typeof cookieContent === "undefined") { | ||
| const expiryDate = new Date(); | ||
| const month = (expiryDate.getMonth() + 1) % 12; | ||
| /* | ||
| new Date = gets today's date. Then, the next line is to get next month. | ||
| We use modulo for the edge case where it is currently December and we want it to return 1, instead of 13. | ||
| We then set variable, expiryDate (now one month ahead), to our cookie. */ | ||
| expiryDate.setMonth(month); | ||
| const cookieProps = getCookieProps(expiryDate); | ||
| cookies.set("display_signup_prompt", "true", cookieProps); | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Do you mind writing a unit test for this behavior?
|
|
||
| export function getDisplaySignUpPromptFromCookie(cookieContent) { | ||
| const cookies = new Cookies(); | ||
| // wasn't really sure how to handle the first time a user comes the page as the cookie being looked up is undefined at first |
There was a problem hiding this comment.
That's fair! We could probably remove this comment, or keep its context in the PR description as opposed to the code.
| // wasn't really sure how to handle the first time a user comes the page as the cookie being looked up is undefined at first |
| de: "Alle Orte", | ||
| }, | ||
| sign_up_today_and_help_make_climate_neutral: { | ||
| en: `Sign up today and help to make ${hubName} climate neutral.`, |
There was a problem hiding this comment.
Honest question we might want to codify / standardize: do we always include punctuation in the translations? E.g., this .. I think it'd be useful to pick one way or the other: always include, or never include. WDYT?
|
|
||
|
|
| width:"65%", | ||
| height:"65%", | ||
| [theme.breakpoints.down("sm")]: { | ||
|
|
Description
Closes #1120
Introduces a new component
SignUpPromptDialogaccording to the design in the issue. This prompt will show up to users who are not logged in and are viewing a location hub (Climate Hub Erlangen) and under the condition that they did not a set a cookie "display_signup_prompt".The user can close the dialog which will prevent it from being shown for 30 days or until cookies are cleared. The user can also click join to sign up or enter their email and then click join. Clicking join will redirect the user to the sign up page. The input of the textfield will be displayed in the email field of sign up.
Missing features / TODO:
Test plan
Before landing
yarn lintpasses (frontend)yarn formatpasses (frontend)make formatpasses (backend)