-
Notifications
You must be signed in to change notification settings - Fork 35
💡Good to provide incorrect answers at the end of the game #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1. variantUuid 2. color highlight with incorrect answers
@@ -18,7 +18,6 @@ const patterns = [ | |||
codeES5: 'Code ES5 - Prototype', | |||
codeES6: 'Code ES6 - Prototype', | |||
answered: false, | |||
answerId: null, |
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.
answerId
is same as uuid
in the store
src/components/Button.jsx
Outdated
</StyledButton> | ||
); | ||
}; | ||
export const Button = ({ id, label, onClick = () => {}, theme = {} }) => ( |
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.
Added theme
to send the style of the button right in props
}; | ||
export const ButtonContainer = ({ current, onSubmitAnswer }) => ( | ||
<StyledButtonContainer> | ||
{current.variants.map(({ uuid, name }) => ( |
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.
moved all the logic below
|
||
SyntaxHighlighter.registerLanguage('javascript', js); | ||
|
||
const StyledButtonContainer = styled.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.
Copy-pasted the StyledButtonContainer
Can send it to helpers to get rid of repeats
@@ -14,8 +14,8 @@ export const submitMiddleware = ({ getState }) => next => action => { | |||
|
|||
const recentlyAnswered = { | |||
...filtered, | |||
variantUuid: action.payload, |
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.
Saved variantUuid
to compare it to the correct answer
const allOtherAnswers = patternsWithUuids.filter(pattern => pattern.uuid !== current.uuid); | ||
const additional = shuffle(allOtherAnswers).slice(0, 3); | ||
// shuffle the 4 answers | ||
const variants = shuffle([current, ...additional]); |
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.
answers
should be tied to variants
in order to show result incorrect answers
__tests__/Layout.test.js
Outdated
@@ -18,7 +18,6 @@ const patterns = [ | |||
codeES5: 'Code ES5 - Prototype', | |||
codeES6: 'Code ES6 - Prototype', | |||
answered: false, | |||
answerId: null, | |||
correct: null |
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 want to discuss the field correct
as it is now computed as uuid === variantUuid
💡
answerId: null, | ||
correct: null | ||
correct: null, | ||
variants: [{ |
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.
added variants
and variantUuid
for tests
What do you think @zoltantothcom? |
ping @zoltantothcom ? |
what do you think @zoltantothcom ? |
I think everyone would enjoy to learn design patterns based on incorrect answers, at least at the end of the game
So I:
TODO: