-
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
Adds ability to join existing shopping list #21
Conversation
Visit the preview URL for this PR (updated for commit d8c024b): https://tcl-55-smart-shopping-list--pr21-jf-yj-join-shopping-rnplqx79.web.app (expires Sat, 29 Apr 2023 16:18:01 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 607d14028385ebfcc7c9ec69a7bb14d95ed54078 |
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.
Code looks good and everything works as expected!
Just wondering though, are Firebase tokens meant to be case-sensitive? It looks like they're all lowercase so far, and the input only allows for tokens entered with matching case. Should users be able to enter their token, e.g. "My Test List" and still have that accepted?
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.
Everything looks great and is functioning as intended!
@ticiadev made a good point about the case sensitivity. All of the random words that are generated through the npm package are lowercase (see https://www.npmjs.com/package/@the-collab-lab/shopping-list-utils?activeTab=code ). That said, the user story doesn't address if the Join Existing List should be case sensitive as it is now. Maybe we can discuss Sunday and add to a future story depending on what we decide?
<Route path="/" element={<Layout />}> | ||
<Route | ||
index | ||
loader={() => listToken && redirect('/list')} |
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.
Great solution and works really well!
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.
Nice!
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 work! 🚀
const [message, setMessage] = useState(''); | ||
|
||
useEffect(() => { | ||
const timer = setTimeout(() => { |
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 like that the error message timeout is consistent across the app now. I think we should try to remember this going forward for other user issues as well.
const handleChange = (e) => setUserEnteredToken(e.target.value); | ||
const handleFormSubmit = (e) => { | ||
e.preventDefault(); | ||
streamListItems(userEnteredToken, (snapshot) => { |
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.
It'd be a good idea here to check if there's no token and display an appropriate message.
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.
Resolved! Nice catch!
}} | ||
> | ||
<label htmlFor="join-list">Join an existing list</label> | ||
<input |
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.
Nice use of semantics 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.
So far, so good! The flicker on redirect is gone!
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.
great work!
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 job @jeremiahfallin and @Yaosaur 🚀
Description
This PR adds a form to allow users to enter an existing list token so they can join an existing list whilst giving feedback if they entered an invalid list token.
It also changes our routing to adopt
createBrowserRouter
andcreateRoutesFromElements
so that we can use the loader action which is not compatible with the originalBrowserRouter
to remove flickering when redirecting. The code also adds a redirect to prevent users with tokens to access to home view.Related Issue
Closes #5
Acceptance Criteria
If a user doesn’t already have a token:
the user is redirected to the List view and shown the items on that list
If a user does already have a token:
Type of Changes
Updates
Before
After
Testing Steps / QA Criteria
In your terminal, use
git checkout -b jf-yj-join-shopping-list
to create a new branch and switch over.Use
git pull origin jf-yj-join-shopping-list
to bring the changes from remote to local.npm start
to start a local instance of our app.Remove tcl-shopping-list-token from local storage prior to testing.
List not found. Please try another token.
, should display below the join button that will clearly automatically after a delay.