-
Notifications
You must be signed in to change notification settings - Fork 0
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 check for similar items using regex. #27
Conversation
Co-authored-by: Sarah <[email protected]>
Visit the preview URL for this PR (updated for commit 9edd71e): https://tcl-76-smart-shopping-list--pr27-mp-sm-check-for-exis-0yfpi088.web.app (expires Mon, 23 Sep 2024 21:56:16 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 512b1a88be8ae05fd3e727b99332819df760271d |
nit-pick / non-blocking: From a UX perspective, I think the alert message could be cleaner: maybe just "a similar item is already on your list" or "A similar item is already on your list: Do you still want to add "bagel"?" The second suggestion requires another confirmation. |
nit-pick / non-blocking: I had "bagels" on my list, and was able to add "bagel". |
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.
This could be cool! I think this could be a good option having a second suggestion. Could make it easier to do this for now before a check for plural strings. |
…ilar items detected
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.
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.
Looks good so far. I do like the prompt that warns about similar items and leaves it to the user if to add it.
Perhaps for the case of an exact match you can alert the user that the item is already on the list?
Also I had the same issue as @arandel1 in that if a plural version of an item existed, the app would still lit me add a singular form
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.
Looks great, well done! 🎉
Description
-First we passed in data as props to the
ManageList
component. After that we were able to use the data object to filter and grab items that matched a users input.-Then we passed in a regex expression into the
.replace
method to check both spacing and characters in the data and users input. We usedtoLowerCase()
to check for matching letters regardless of case.-We filtered through the list to find any matches, and if the filtered list was > 0 users were alerted that the item exists and
addItem
would not execute.Related Issue
closes #10
Acceptance Criteria
apples
and the user addsapples
.apples
and the user addsaPples
orapples,
ora pples
.Type of Changes
-enhancement
Updates
-Alert with a pop-up if a similar item exists.
Testing Steps / QA Criteria
dateCreated
should not update.