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

Create input to allow users to name their list #31

Merged
merged 5 commits into from May 20, 2023
Merged

Conversation

yiremorlans
Copy link
Collaborator

@yiremorlans yiremorlans commented May 17, 2023

Description

These changes implement an input on the Home view that allows the user to enter their own list name(letters and numbers only). From the List view, users can now check out of their current list and return to the Home view to join an existing list or create a new one.

There is a pattern attribute with a regex expression for input validation on both the Create New List input and Join Exisiting List input. This prevents punctuation and other characters such as ?!#$ from being used for list names.

This code also addresses a bug that previously allowed users to navigate to the List view without first creating a list.

Related Issue

closes #30

Acceptance Criteria

  • There is an input box on the Home page above/alongside the "Create New List" button.
  • Upon creation, the user is shown the name of the list via Chippy's message box.
  • As Chippy's message box changes to user activity, it should always default back to a standard message that includes the user's list name.

Type of Changes

Type
🐛 Bug fix
✨ New feature
🔨 Refactoring
💯 Add tests
🔗 Update dependencies
📜 Docs

Updates

Before

Screenshot 2023-05-17 at 4 18 24 PM

After

Screenshot 2023-05-17 at 4 19 42 PM Screenshot 2023-05-17 at 4 20 15 PM Screenshot 2023-05-17 at 4 24 53 PM

Testing Steps / QA Criteria

You can check the localStorage in the browser dev tools when the list token is removed by clicking to check out to another list on the List view.

@github-actions
Copy link

github-actions bot commented May 17, 2023

Visit the preview URL for this PR (updated for commit c37bd71):

https://tcl-56-smart-shopping-li-ffe7d--pr31-ym-user-names-lis-q1op8g6y.web.app

(expires Sat, 27 May 2023 19:53:42 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 9c51cec5927ae3f1253a2134be95c1a07393f9a7

@yiremorlans yiremorlans marked this pull request as ready for review May 19, 2023 19:35
@@ -70,7 +69,7 @@ export function ListItem({ item, listId }) {
{item.name} {deleteError}
</label>

<li>Purchase again: {purchaseUrgencyMessage(item)}</li>
<span>Purchase again: {purchaseUrgencyMessage(item)}</span>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is the correct semantic choice for displaying this info, and the li element within the other li element was rendering an error on the dev browser console.

@@ -13,7 +13,15 @@ export function getFutureDate(offset) {

// transforms Firebase date object to JS date object
export function transformToJSDate(date) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function was refactored to return a new Date timestamp without the hours accounted for. The difference in hours would determine the order the items were sorted and the alphabetical sorting did not look accurate because sometimes an item would be a few hours apart.

For example: Apples, Coffee, and Bananas were all purchased April 25, but because Bananas were added a little bit after Coffee the list would look like Apples, Coffee, and Bananas. With the new fix, it will render Apples, Bananas, and Coffee if they were all purchased on the same day regardless of time.

@yiremorlans
Copy link
Collaborator Author

There were merge conflicts to be resolved and it required I change the formatting of certain elements to fit into the new layout style. The UI screenshots are representative of the style prior to the stylistic changes, but the functionality introduced with checking out to a different list remains the same.

@yiremorlans yiremorlans merged commit fd3f971 into main May 20, 2023
2 checks passed
@yiremorlans yiremorlans deleted the ym-user-names-list branch May 20, 2023 20:25
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.

As a user, I want to be able to name and see my list name in case I want to share it
1 participant