From 034d472adfbba928d4781efdc740874a109d5268 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Wed, 8 Jan 2020 10:27:07 -0500 Subject: [PATCH 1/3] Display thank you page content dynamically --- src/App.js | 21 ++++++++++++++++--- src/ThankYou.js | 56 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/src/App.js b/src/App.js index fe02834a6..b6bb0857a 100644 --- a/src/App.js +++ b/src/App.js @@ -56,7 +56,10 @@ class App extends React.Component { reviewQuestions: [], questions: this.resetQuestions(), pages: { - thankYou: , + thankYou: , congrats: , @@ -687,8 +690,6 @@ class App extends React.Component { this.setState({ question, prevQuestion: Object.keys(this.state.questions).includes(question) ? this.state.questions[question].prev : '', - }, () => { - console.log(this.state.questions); }); } @@ -839,6 +840,20 @@ class App extends React.Component { } submit = () => { + if (this.state.questions.buildingTypes.value !== '' && this.state.questions.buildingTypes.value === 20) { + if(this.state.questions.waitList.value === 1) { + this.state.pages.thankYou = ; + } + else { + this.state.pages.thankYou = ; + } + } this.setState({ submitted: true, }, () => { diff --git a/src/ThankYou.js b/src/ThankYou.js index 12ed955a7..e4e58a6fc 100644 --- a/src/ThankYou.js +++ b/src/ThankYou.js @@ -2,27 +2,49 @@ import React from "react"; import result from './utils/images/spot-results-more-info.svg'; // with import import './index.css'; - const ThankYou = (props) => { - const content = ( -
- -
- Thank You! -
-
- Looks like we need more information to see if your building is a good fit for air source heat pumps. - We'll send you an email to find a time to chat or you can {' '} - call us at {process.env.REACT_APP_BLOCPOWER_CONTACT}. -
-
- ); + // If building type is not single family (for NYC BIS) and for other surveys + var data = +
+ Looks like we need more information to see if your building is a good fit for air source heat pumps. + We'll send you an email to find a time to chat or you can {' '} + call us at {process.env.REACT_APP_BLOCPOWER_CONTACT}. +
+ + // If building type is single family and user has joined the waitlist + if (props.singleFamWaitList === true) { + data = +
+ Thanks for joining our waitlist! + We'll be in touch as soon as we expand our services! +
+ If you’d like to reach out to us in the meantime you can call us at {process.env.REACT_APP_BLOCPOWER_CONTACT}. +
+ } - return ( + // If building type is single family but user has not joined the waitlist + if (props.singleFamNoWaitList === true) { + data =
- {content} + Sorry to see you go! Come back any time if you change your mind! +
+ } + + const content = ( +
+ +
+ Thank You!
- ); + { data } +
+ ); + + return ( +
+ {content} +
+ ); } export default ThankYou; -- GitLab From 892d964852d0fb961b5b6859b5b73149d07e5cb2 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Wed, 8 Jan 2020 11:21:34 -0500 Subject: [PATCH 2/3] Refactoring the code --- src/App.js | 30 ++++++++++++++++-------------- src/ThankYou.js | 17 +++++++---------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/App.js b/src/App.js index b6bb0857a..24d5d31f1 100644 --- a/src/App.js +++ b/src/App.js @@ -57,8 +57,8 @@ class App extends React.Component { questions: this.resetQuestions(), pages: { thankYou: , congrats: { - if (this.state.questions.buildingTypes.value !== '' && this.state.questions.buildingTypes.value === 20) { - if(this.state.questions.waitList.value === 1) { - this.state.pages.thankYou = ; - } - else { - this.state.pages.thankYou = ; - } } + + // 1 - Yes & 2 - No for joining the waitlist + if(this.state.questions.waitList.value === 1) { + this.state.pages.thankYou = ; + } + + this.setState({ submitted: true, }, () => { diff --git a/src/ThankYou.js b/src/ThankYou.js index e4e58a6fc..009f0946d 100644 --- a/src/ThankYou.js +++ b/src/ThankYou.js @@ -11,24 +11,21 @@ const ThankYou = (props) => { call us at {process.env.REACT_APP_BLOCPOWER_CONTACT}. + console.log(props) // If building type is single family and user has joined the waitlist - if (props.singleFamWaitList === true) { + if (props.singleFamily === true) { data = + props.waitList === true ?
Thanks for joining our waitlist! We'll be in touch as soon as we expand our services!
If you’d like to reach out to us in the meantime you can call us at {process.env.REACT_APP_BLOCPOWER_CONTACT}. -
- } - - // If building type is single family but user has not joined the waitlist - if (props.singleFamNoWaitList === true) { - data = + :
- Sorry to see you go! Come back any time if you change your mind! -
- } + Sorry to see you go! Come back any time if you change your mind! + + } const content = (
-- GitLab From 119c89723a3e85078dbcc3a6a9fe880ac4de3122 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Wed, 8 Jan 2020 11:22:03 -0500 Subject: [PATCH 3/3] Remove console log --- src/ThankYou.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ThankYou.js b/src/ThankYou.js index 009f0946d..6c7ee2804 100644 --- a/src/ThankYou.js +++ b/src/ThankYou.js @@ -11,7 +11,6 @@ const ThankYou = (props) => { call us at {process.env.REACT_APP_BLOCPOWER_CONTACT}.
- console.log(props) // If building type is single family and user has joined the waitlist if (props.singleFamily === true) { data = -- GitLab