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

[MF] Refactoring for readability and maintenance #73

Merged
merged 12 commits into from
Apr 2, 2024
Merged

Conversation

krsnamara
Copy link
Collaborator

Description

This code extracts most of the logic from List.jsx that handles sorting of the list items by urgency and alphabetically. It creates new files to handle this abstraction. There is a new utils file that will hold some of the sorting and filtering functions. These functions are then imported into the List.jsx and a new SortedDataMap component. Once these functions have run the SortedDataMap will render the sorted list items onto the current /list page.

In addition the inputs in the add item dialog have been removed from List.jsx and pasted into the new AddItem component with the handleInput change functionality to update the form state values.

The goal was to trim the size of the file and better organize for maintainability.

Related Issue

closes #72
subissue #14

Acceptance Criteria

  • Create utils file that handles sorted logic
  • Create component for entering new Item
  • Separate the sorting data jsx into its own component
  • Use the sortedData utils file to effectively filtered data and sort into urgency arrays

Type of Changes

Use one or more labels to help your team understand the nature of the change(s) you’re proposing. E.g., bug fix or enhancement are common ones.

Updates

Does not update the UI

Testing Steps / QA Criteria

Upon login the app should function in the same way prior to refactor. Try adding an item and verifying that item is sorted correctly.

@krsnamara krsnamara added refactoring design sprint design sprint from issue 14 labels Mar 29, 2024
@krsnamara krsnamara self-assigned this Mar 29, 2024
Copy link
Collaborator

@hsiangj hsiangj left a comment

Choose a reason for hiding this comment

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

A lot of heavy lifting in this one! Left a comment in sortedData.js.

src/utils/sortedData.js Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Apr 1, 2024

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

https://tcl-69-smart-shopping-list--pr73-mf-refactor-v2-f8os23pr.web.app

(expires Tue, 09 Apr 2024 00:20:00 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 93172cc46147b7d365c2b1b8239b61e2efb07a80

Copy link
Collaborator

@hsiangj hsiangj left a comment

Choose a reason for hiding this comment

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

New sort looks great, thanks Marty!

Copy link
Collaborator

@mxmason mxmason left a comment

Choose a reason for hiding this comment

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

Good stuff! Some optional comments about renaming some stuff.

src/utils/sortedData.js Outdated Show resolved Hide resolved
src/utils/sortedData.js Outdated Show resolved Hide resolved
src/utils/sortedData.js Outdated Show resolved Hide resolved
@krsnamara krsnamara merged commit 35c1db9 into main Apr 2, 2024
2 checks passed
@krsnamara krsnamara changed the title Mf refactor v2 [MF] Refactoring for readability and maintenance Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design sprint design sprint from issue 14 refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring List.jsx for readability and maintenance
3 participants