Skip to content

Conversation

Beraliv
Copy link
Contributor

@Beraliv Beraliv commented May 2, 2019

I think everyone would enjoy to learn design patterns based on incorrect answers, at least at the end of the game

So I:

  1. Extended several components
  2. Change a structure of the store
  3. Added incorrect answers at the end of the game

TODO:

  • Tests
  • Coverage tests
  • Code review
  • Check for styles on different devices

@@ -18,7 +18,6 @@ const patterns = [
codeES5: 'Code ES5 - Prototype',
codeES6: 'Code ES6 - Prototype',
answered: false,
answerId: null,
Copy link
Contributor Author

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

</StyledButton>
);
};
export const Button = ({ id, label, onClick = () => {}, theme = {} }) => (
Copy link
Contributor Author

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 }) => (
Copy link
Contributor Author

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`
Copy link
Contributor Author

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,
Copy link
Contributor Author

@Beraliv Beraliv May 2, 2019

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]);
Copy link
Contributor Author

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

@@ -18,7 +18,6 @@ const patterns = [
codeES5: 'Code ES5 - Prototype',
codeES6: 'Code ES6 - Prototype',
answered: false,
answerId: null,
correct: null
Copy link
Contributor Author

@Beraliv Beraliv May 2, 2019

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 💡

@Beraliv Beraliv changed the title Good to provide incorrect answers at the end of the game 💡Good to provide incorrect answers at the end of the game May 2, 2019
answerId: null,
correct: null
correct: null,
variants: [{
Copy link
Contributor Author

@Beraliv Beraliv May 2, 2019

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

@Beraliv
Copy link
Contributor Author

Beraliv commented May 6, 2019

What do you think @zoltantothcom?

@Beraliv
Copy link
Contributor Author

Beraliv commented Oct 26, 2019

ping @zoltantothcom ?

@Beraliv
Copy link
Contributor Author

Beraliv commented Jun 3, 2020

what do you think @zoltantothcom ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant