Closed isaiahasanchez closed 1 year ago
Visit the preview URL for this PR (updated for commit a1a0479):
https://tcl-65-smart-shopping-list--pr28-is-ld-12-sort-shoppi-dshop024.web.app
(expires Sat, 30 Sep 2023 18:43:10 GMT)
🔥 via Firebase Hosting GitHub Action 🌎
Sign: a91b8fb0f37677e20d8afa3e8ea496251536f9b8
Updated with changes. Moved the text into a span in the label, and used css variables set in ListItem and in a media query to use different colors in light and dark mode. Also removed formatting styling from ListItem, where it didn't have an impact, and added grid styling to the label. This looks neater than flexbox, but may complicate adding the delete button to the ListItem.
Description
Added comparePurchaseUrgency function that can be used to sort items by the urgency of which the user is expected to need to buy the item again. Used a sort function with comparePurchaseUrgency on all the data in useShoppingListData. This ensured all data would appear in the proper sorting order.
Added text indicators on the list items. Added styling as well based on the color preference of a dark background. Chose to add styling via listItem.css for code simplicity. Indicators that were added were "soon", "kind of soon", "not soon", "inactive" and we chose to also include "overdue" for items for which the dateNextPurchased had passed.
Related Issue
closes #12
Acceptance Criteria
api/firestore.js
exports a newcomparePurchaseUrgency
function with the following behaviorscomparePurchaseUrgency
to sort “overdue” items to the top of the listType of Changes
Updates
Before
After
Testing Steps / QA Criteria
inactive items: have a dateLastPurchased more than 60 days in the past overdue items: an item with dateNextPurchased in the past soon items: an item with dateNextPurchased within 7 days or less from now kind of soon items: an item with dateNextPurchased between 7 and 30 days from now not soon: an item with dateNextPurchased over 30 days from now