From e62faabf9fdfbefc1bbaf5476aceda55813efd0f Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 11:12:54 -0500 Subject: [PATCH 01/11] Add page for Feedback --- src/App.js | 31 ++++++++++++------ src/Feedback.js | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 src/Feedback.js diff --git a/src/App.js b/src/App.js index 15567fff5..5f9e4f556 100644 --- a/src/App.js +++ b/src/App.js @@ -8,7 +8,8 @@ import HeatDistribution from './HeatDistribution'; import SeparateBoiler from './SeparateBoiler'; import HeatingSystemAge from './HeatingSystemAge'; import HeatingSystemPlan from './HeatingSystemPlan'; -import UnitBreakdown from './UnitBreakdown' +import UnitBreakdown from './UnitBreakdown'; +import Feedback from './Feedback'; import BuildingTypes from './BuildingTypes'; import UtilityBills from './UtilityBills'; import ComfortIssues from './ComfortIssues'; @@ -183,7 +184,7 @@ class App extends React.Component { value: 0, answerIds: [1, 2], prev: '', - next: 'contact', + next: 'feedback', }, waitList: { id: 10, @@ -192,11 +193,18 @@ class App extends React.Component { value: 0, answerIds: [1, 2], prev: 'buildingTypes', + next: 'feedback', + }, + feedback: { + questionIds: [58], + title: 'How did you hear about us?', + answer: '', + prev: '', next: 'contact', }, contact: { title: 'Your Information', - prev: '', + prev: 'feedback', next: 'reviewAnswers', }, reviewAnswers: { @@ -642,13 +650,13 @@ class App extends React.Component { questionAnswers[questions[question].id] = value; } - questions.financeInterest.next = "contact"; + // questions.financeInterest.next = "contact"; this.setState({ questions }, () => { if (question === 'addressSearch') { this.props.onSubmitBuilding({ address: this.state.questions[question].value, }); - } else if (question === 'unitBreakdown'){ + } else if (question === 'unitBreakdown' || question === 'feedback'){ this.setQuestion(this.state.questions[question].next); this.props.onSubmitUserAnswer({ questionId: questions[question]['questionIds'], @@ -806,7 +814,6 @@ class App extends React.Component { questions['utilityBills'].questions[1].answer = ''; questions['utilityBills'].questions[0].value = 0; questions['utilityBills'].questions[1].value = 0; - questions['comfortIssues'].answer = []; questions['comfortIssues'].value = []; } @@ -854,7 +861,7 @@ class App extends React.Component { this.setState({ buildingQualified: false}); } - questions.contact.next = "reviewAnswers"; + // questions.contact.next = "reviewAnswers"; this.setState({ questions }, () => { this.setQuestion(tree.output.nextQuestion); }); @@ -864,10 +871,10 @@ class App extends React.Component { if (found === false) { const questions = this.state.questions; questions.buildingTypes.next = 'financeInterest'; - questions.financeInterest.next = 'reviewAnswers'; + // questions.financeInterest.next = 'reviewAnswers'; questions.financeInterest.prev = 'buildingTypes'; questions.reviewAnswers.next = 'thankYou'; - questions.contact.next = "reviewAnswers"; + // questions.contact.next = "reviewAnswers"; this.setState({ questions }, () => { this.setQuestion('financeInterest'); }); @@ -934,6 +941,7 @@ class App extends React.Component { } render() { + console.log(this.state.questions); const building = this.props.building; // TODO: Why did we comment out the section below? // const questions = this.props.questions; @@ -1004,6 +1012,11 @@ class App extends React.Component { questions={this.state.questions['unitBreakdown'].questionIds} answers={this.state.questions['unitBreakdown'].answers} />, + feedback: , buildingTypes: { + const val = event.target.value; + const name = event.target.name; + this.setState({ + ...this.state, + [name]: val, + }); + } + + prevQuestion = () => { + this.props.prevQuestion('feedback'); + } + + nextQuestion = () => { + this.props.nextQuestion( + 'feedback', + [], + [this.state.answer], + ); + } + + handleFocus = (event) => event.target.select(); + + render() { + const content = ( +
+
+ How did you hear about us? +
+
+ (Optional) +
+ + + this.handleInputChange(e)}> + + + + + + + {'<'} Back + + + + {/* Button will be disabled only if all inputs are 0 or any of the input is empty. */} + + + +
+ ); + + return ( +
+ {content} +
+ ); + } +} -- GitLab From 3f7b5dc0e2bea79d9e71103add1803db08a91a8f Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 13:31:18 -0500 Subject: [PATCH 02/11] Add feedback question in NYC tree --- src/App.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 5d68b2d1e..90e0eb1c2 100644 --- a/src/App.js +++ b/src/App.js @@ -709,14 +709,14 @@ class App extends React.Component { let questions = this.state.questions; // If the current question is financeInterset set financeInterset as prev page for contact if (this.props.building.data.surveyId === 1 && question === 'financeInterest') { - questions['contact'].prev = 'financeInterest'; + questions['feedback'].prev = 'financeInterest'; this.setState({ questions, }); } // If the current question is waitList set waitList as prev page for contact if (this.props.building.data.surveyId === 1 && question === 'waitList') { - questions['contact'].prev = 'waitList'; + questions['feedback'].prev = 'waitList'; this.setState({ questions, }); -- GitLab From fae64b112b1aa04da96cf418c85f229028605bfc Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 13:32:55 -0500 Subject: [PATCH 03/11] Change the question language --- src/Feedback.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Feedback.js b/src/Feedback.js index 7db1c79b4..11905da96 100644 --- a/src/Feedback.js +++ b/src/Feedback.js @@ -37,7 +37,7 @@ export default class Feedback extends React.Component { const content = (
- How did you hear about us? + How did you first hear about us?
(Optional) -- GitLab From e2e4b6bde364e000264693f7b07c2fadbac5662e Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 13:35:32 -0500 Subject: [PATCH 04/11] Add feedback question to tree for Oakland and Milwaukee --- src/App.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 90e0eb1c2..148a0dbf8 100644 --- a/src/App.js +++ b/src/App.js @@ -621,7 +621,7 @@ class App extends React.Component { }, ], prev: 'buildingPastImprovement', - next: 'contact', + next: 'feedback', } }; } @@ -723,7 +723,7 @@ class App extends React.Component { } // If the survey ID is 2 or 3, set buildingFutureWaterImprovement as prev page for contact if ([2, 3].includes(this.props.building.data.surveyId) && question === 'buildingNeeds') { - questions['contact'].prev = 'buildingFutureImprovement'; + questions['feedback'].prev = 'buildingFutureImprovement'; this.setState({ questions, }); -- GitLab From a0883ac1881778670d8594addee5d34d0a11a82b Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 16:52:36 -0500 Subject: [PATCH 05/11] Set next question of contact as review page --- src/App.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 148a0dbf8..65bc67950 100644 --- a/src/App.js +++ b/src/App.js @@ -861,7 +861,7 @@ class App extends React.Component { this.setState({ buildingQualified: false}); } - // questions.contact.next = "reviewAnswers"; + questions.contact.next = "reviewAnswers"; this.setState({ questions }, () => { this.setQuestion(tree.output.nextQuestion); }); @@ -879,7 +879,7 @@ class App extends React.Component { } // questions.financeInterest.next = 'reviewAnswers'; questions.reviewAnswers.next = 'thankYou'; - // questions.contact.next = "reviewAnswers"; + questions.contact.next = "reviewAnswers"; this.setState({ questions }, () => { this.setQuestion(questions.buildingTypes.next); }); -- GitLab From 8e737ad73c6b60dc878ce7e082b19d5ca79e4c5c Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 16:56:02 -0500 Subject: [PATCH 06/11] Set margin on feedback page --- src/Feedback.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Feedback.js b/src/Feedback.js index 11905da96..f6113122d 100644 --- a/src/Feedback.js +++ b/src/Feedback.js @@ -45,7 +45,7 @@ export default class Feedback extends React.Component { Date: Fri, 28 Feb 2020 17:14:52 -0500 Subject: [PATCH 07/11] Set feedback value in the state --- src/App.js | 5 ++--- src/Feedback.js | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/App.js b/src/App.js index 65bc67950..f65a3a3df 100644 --- a/src/App.js +++ b/src/App.js @@ -198,7 +198,7 @@ class App extends React.Component { feedback: { questionIds: [58], title: 'How did you hear about us?', - answer: '', + answers: '', prev: '', next: 'contact', }, @@ -946,7 +946,6 @@ class App extends React.Component { } render() { - console.log(this.state.questions); const building = this.props.building; // TODO: Why did we comment out the section below? // const questions = this.props.questions; @@ -1020,7 +1019,7 @@ class App extends React.Component { feedback: , buildingTypes: Date: Fri, 28 Feb 2020 17:22:29 -0500 Subject: [PATCH 08/11] Add feedback to review --- src/ReviewAnswers.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/ReviewAnswers.js b/src/ReviewAnswers.js index 89682de66..f7eea5fe1 100644 --- a/src/ReviewAnswers.js +++ b/src/ReviewAnswers.js @@ -36,6 +36,7 @@ export default class ReviewAnswers extends React.Component { } render() { + console.log(this.props.questions) const questions = this.props.questions; const phoneNumber = this.props.form.PHONE === 0 ? 'N/A' : this.props.form.PHONE; @@ -167,6 +168,24 @@ export default class ReviewAnswers extends React.Component { } }) } +
+ + +
+ How did you first hear about us? +
+
+ {this.props.questions['feedback'].answers[0]}
+
+ +
+ + this.editAnswer('contact') } /> + +
+
+
+
-- GitLab From 8ba47479399dfcbd2edb45fe6496876c00b530e9 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 17:32:46 -0500 Subject: [PATCH 09/11] Add apt types on review page --- src/ReviewAnswers.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/ReviewAnswers.js b/src/ReviewAnswers.js index f7eea5fe1..bedd7608b 100644 --- a/src/ReviewAnswers.js +++ b/src/ReviewAnswers.js @@ -36,7 +36,6 @@ export default class ReviewAnswers extends React.Component { } render() { - console.log(this.props.questions) const questions = this.props.questions; const phoneNumber = this.props.form.PHONE === 0 ? 'N/A' : this.props.form.PHONE; @@ -180,7 +179,31 @@ export default class ReviewAnswers extends React.Component {
- this.editAnswer('contact') } /> + this.editAnswer('feedback') } /> + +
+
+
+
+ +
+ + +
+ Apartment Unit Breakdown +
+
+ Studio: {this.props.questions['unitBreakdown'].answers[0]}
+ One Bedroom: {this.props.questions['unitBreakdown'].answers[1]}
+ Two Bedroom: {this.props.questions['unitBreakdown'].answers[2]}
+ Three Bedroom: {this.props.questions['unitBreakdown'].answers[3]}
+ Four Bedroom: {this.props.questions['unitBreakdown'].answers[4]}
+ Other: {this.props.questions['unitBreakdown'].answers[5]} +
+ +
+ + this.editAnswer('unitBreakdown') } />
-- GitLab From 8b7481a945c33c83fd3b5d6c6af29c83ee57d0ba Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 17:40:37 -0500 Subject: [PATCH 10/11] Add condition for disable button on Building type page --- src/BuildingTypes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BuildingTypes.js b/src/BuildingTypes.js index bb36fbdff..b7fd9dff9 100644 --- a/src/BuildingTypes.js +++ b/src/BuildingTypes.js @@ -114,7 +114,7 @@ export default class BuildingTypes extends React.Component { className="button" // className="continueButton" onClick={this.nextQuestion} - disabled={this.state.answer===0} + disabled={this.state.answer===''} > Continue > -- GitLab From 82423e35d901d893da9ad5ffe4475bf3f5a5e2a9 Mon Sep 17 00:00:00 2001 From: RujitRaval Date: Fri, 28 Feb 2020 17:51:09 -0500 Subject: [PATCH 11/11] Remove comments --- src/App.js | 2 -- src/Feedback.js | 1 - 2 files changed, 3 deletions(-) diff --git a/src/App.js b/src/App.js index f65a3a3df..44db54049 100644 --- a/src/App.js +++ b/src/App.js @@ -650,7 +650,6 @@ class App extends React.Component { questionAnswers[questions[question].id] = value; } - // questions.financeInterest.next = "contact"; this.setState({ questions }, () => { if (question === 'addressSearch') { this.props.onSubmitBuilding({ @@ -877,7 +876,6 @@ class App extends React.Component { questions.buildingTypes.next = 'financeInterest'; questions.financeInterest.prev = 'buildingTypes'; } - // questions.financeInterest.next = 'reviewAnswers'; questions.reviewAnswers.next = 'thankYou'; questions.contact.next = "reviewAnswers"; this.setState({ questions }, () => { diff --git a/src/Feedback.js b/src/Feedback.js index 24ccb0bba..f6113122d 100644 --- a/src/Feedback.js +++ b/src/Feedback.js @@ -46,7 +46,6 @@ export default class Feedback extends React.Component {