Skip to content
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

Scoring feature #12

Merged
merged 6 commits into from
Apr 30, 2024
Merged

Scoring feature #12

merged 6 commits into from
Apr 30, 2024

Conversation

cmwilson21
Copy link
Owner

@cmwilson21 cmwilson21 commented Apr 22, 2024

  • Created scoring feature via localStorage.
  • Updated the ternary expression around the "isCorrect" functionality.
  • Fixed the openssl error in json file

Related to but doesn't close #10

Comment on lines +24 to +26
"build": "react-scripts --openssl-legacy-provider build",
"test": "react-scripts --openssl-legacy-provider test",
"eject": "react-scripts --openssl-legacy-provider eject"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will the need for --openssl-legacy-provider go away if you switch from create-react-app?

src/components/game/GameCard.js Outdated Show resolved Hide resolved
src/components/game/GameCard.js Outdated Show resolved Hide resolved
@@ -101,17 +109,14 @@ const CardBody = ({ article, nextButton }) => {
onChange={changeHandler("reuters")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean onChange={() => changeHandler("reuters")}
what you have now invokes the change handler as soon as it executes that line of code.

The fact that you demoed it and this was working as is is a bit confusing to me...

edit: I see your changeHandler returns an anonymous function, is there a particular reason for this that you discovered?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for this one, I had already made a changeHandler that was trying to do two jobs, capturing the radio button change and comparing the sources, which should have been in the submitHandler. This was just how the refactor/separation of the two functions (changeHandler and handleSubmit) played out. But, really, the changeHandler function isn't really even needed, since an anonymous function would work on the onChange, like you mentioned.

I think in my previous edit to the changeHandler, it made sense at the time because I was passing it in 5 different times so it was an attempt to dry up the code. But now, I've got the RadioButtons rendering via a map, so won't be repeating that code anyway. Removing the changeHandler now makes a lot of sense.

src/components/game/GameCard.js Outdated Show resolved Hide resolved
@@ -40,6 +40,14 @@ const RadioButton = ({ label, value, onChange }) => {
const CardBody = ({ article, nextButton }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd break this file into separate component files for better legibility.

cmwilson21 and others added 4 commits April 23, 2024 21:27
Co-authored-by: Ivy Feraco <unjust@gmail.com>
… boolean, and other refactors. it was a refactor party
…into scoring-feature

 the commit.
"merging the changes commits made from PR request"
Copy link

vercel bot commented Apr 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlines-up ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 5:49pm

@cmwilson21 cmwilson21 merged commit e2de91a into main Apr 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Incoming feature - Scoring
2 participants