-
Notifications
You must be signed in to change notification settings - Fork 3
Victor/eco 1248/new branding ui #22
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments
// }, | ||
// { | ||
// type: PageType.SuccessBasedThankYou, | ||
// }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope these are tests
updateJsonSchema.js
Outdated
@@ -0,0 +1,38 @@ | |||
var offer_contents = (await OfferContent.find()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why plain js?
styles/src/page/earnThankYou.styl
Outdated
@@ -77,6 +87,6 @@ | |||
.diamond-r-1 | |||
left: 84vw; | |||
bottom: 13.3vw; | |||
width: 8.2vw | |||
width: 8.2vw */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete commented out code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this pass a linter
updateJsonSchema.js
Outdated
for (var i = 0; i < offer_contents.length; i++) { | ||
var oc = offer_contents[i]; | ||
var pageTypeNum = 0; | ||
for (const i = 0; i < offer_contents.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be let i = 0
?
updateJsonSchema.js
Outdated
for (var i = 0; i < offer_contents.length; i++) { | ||
var oc = offer_contents[i]; | ||
var pageTypeNum = 3; | ||
for (const i = 0; i < offer_contents.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
scripts/src/app.tsx
Outdated
const allData: any = Object.assign({}, this.state.data, answerData); // todo pollyfill Object.assign | ||
const newPageIndex = this.state.currentPage + 1; | ||
this.setState(Object.assign(this.state, { | ||
data: Object.assign(this.state.data, answerData), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- break this into two lines, nested Assign statements are hard to read.
- you need to assign to an empty literal and not to
this.state
, like so:
this.setState(Object.assign({}, this.state, {...
bridge.submitResult(allData); | ||
if (Object.keys(this.state.data)) { | ||
console.log("submit " + JSON.stringify(this.state.data)); | ||
bridge.submitResult(this.state.data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't make sense that this is here. This method should only navigate not submit. Move it back into onPageCompleteHandler
where it belongs.
scripts/src/app.tsx
Outdated
const isComplete = this.state.currentPage === (this.state.pages.length - 1); | ||
const isShouldExit = newPageIndex < 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Doc999tor How does it get to this state?
bridge.close(); | ||
} | ||
return; | ||
} | ||
|
||
this.setState({ | ||
if (isShouldExit) { | ||
console.log("exit " + JSON.stringify(this.state.data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this in production?
<div className="header-controls"> | ||
<button className="back-nav" onClick={this.props.navigateBack}><img src={ getImageUrl('ic-back') } /></button> | ||
<span></span> | ||
<div className={"pageProgress"}>{currentPage}/{totalQuestionPages}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className="pageProgress"
updateJsonSchema.js
Outdated
} | ||
|
||
await updatePolls(); | ||
await updateQuizzes(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
@@ -0,0 +1,38 @@ | |||
const offer_contents = (await OfferContent.find()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment explaining what this file does and how to use it.
const offer_contents = (await OfferContent.find()) | ||
|
||
async function updatePolls () { | ||
for (let i = 0; i < offer_contents.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use for...of
if (page.type !== pageTypeNum) { return false; } | ||
page.rewardText = page.title.replace(/ \${amount}.*/, ''); | ||
page.rewardValue = '${amount}'; | ||
page.title = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is title still used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every poll/quiz in test
has title. In some of them it's empty string. So I put here an empty string as well
const content = JSON.parse(oc.content); | ||
content.pages.forEach(page => { | ||
if (page.type !== pageTypeNum) { return false; } | ||
page.rewardText = page.title.replace(/ \${amount}.*/, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the only difference between quiz and poll I would just do an if statement here instead of code duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the code separately for more caution reasons, polls and after them quizzes.
I can execute the function with parameters: pageTypeNum
and contentType
, but it seemed to much ifs
No description provided.