-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added validation to current row submission #8
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
… when error is throw
@kirandash This PR is ready for review when you get a chance :) Im trying to assign you as reviewer, but for some reason it won't let me. so im leaving a comment here. |
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.
Hi @Jing1524 Thanks for the PR 🙏🏻
It's awesome ⭐️
There is just a minor bug though. Please fix it before I can merge. Feel free to let me know if you face any issues.
And sorry for the late response.
setInvalidWordRowIndex(currentRowIndex) // Store the index of the invalid word | ||
return // prevent user going to next row after invalid error thrown | ||
} | ||
|
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 should also do setInvalidWordError(false)
in your code.
Because of this there is a bug now. If you enter a wrong word, it's showing the error message properly. But when user corrects the word, the highlighting of letters does not work. Because invalidWordError is still true.
How to Fix?
- You can do
setInvalidWordError(false)
here in else condition or, - Run a timer and set it to false after 2 seconds or
- Set it to false when user hits "Backspace"
I would prefer the second option since that's what is implemented on the official wordle site https://www.nytimes.com/games/wordle/index.html
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.
Good Point!
will sort that out later today, and let you know once im done! Thank you for the feedback. :)
Updates:
Added 2 piece of states: invalidWordError and wordList to handle the current row validation.
react-wordle-site/src/App.tsx
Lines 34 to 37 in 1f532ce
below is the check for the current row:
react-wordle-site/src/App.tsx
Lines 86 to 92 in 1f532ce
Also updated below to clear the background color when the word is invalid, while not interrupt the previous row background color:
react-wordle-site/src/App.tsx
Lines 161 to 167 in 1f532ce
Aside from the logic, also updated the background color for incorrect letter, so its more readable.
Fixes #2