Closed lindseyindev closed 2 years ago
Visit the preview URL for this PR (updated for commit f1aec73):
https://tcl-36-smart-shopping-list--pr31-ld-sm-sort-shopping-xqul8gx8.web.app
(expires Sat, 26 Feb 2022 19:07:48 GMT)
π₯ via Firebase Hosting GitHub Action π
Fantastic PR and comments: you've explained what was done for users and for devs audience, plus what you considered doing and what was blocker (grouped lists).
@lindseyindev @shelleymcq - I failed to say (even though I thought it) - your solution is very creative and thoughtful! There were so many intricate pieces to this issue, and you solved them all in really interesting ways (isActive
, groups
, colorClass
, sorting methods, unique rendering). π π
Yay for making code better!! Thank you everyone for the feedback and I love seeing all these perspectives to help make our app better π I think I looked at almost everything mentioned but if I missed something please let me know
Also I really love how @rudidev08 showed us this grouping strategy the logic is so brilliant and allows us to centralize our sorting instead of having these sort methods really detached from the rendering and it makes it really easy for styling as a section
An update on what it looks like with the list of items Shelley was able to format so there are items in every section
**the bottom container's corners look cut off but that's just from the page screenshot extension I use, in live all the corners look rounded
I'm going to make an issue for some later refactoring to hide groups with no items~
Description
We added an isActive data point to each item on /AddItem and we are setting the isActive data point to true in /listItem if there are more than 2 purchases and the days since last transaction is not greater than 2 * the previous estimate.
We added sorting algorithms to the list sorting by previous estimate then sorting by inActive property, this sorts by dates and then places any inactive items at the bottom of the list. Note: Firebase sorts alphabetically by item Id so 2 items with the same previous estimate will be sorted alphabetically.
We set a "Need to buy" temporary text for each item to convey the estimate in a written rather than visual way, would love ideas on restructuring this! Shelley had a great idea to group the items together based on frequency and isActive but we weren't sure on how to do that without breaking up the list and doing separate renders.
We made a function to return tailwind classes based on how soon a user is expected to purchase an item and set temporary colors for each item:
if an item's estimated purchase days are < 7 the background color is set to green for that item
if an item's estimated purchase days are < 30 the background color is set to yellow for that item
if an item's estimated purchase days are >=30 the background color is set to rose for that item
if an item's isActive property is false the background color is set to gray.
Related Issue
closes #12
Acceptance Criteria
Type of Changes
Updates
Before
After
Testing Steps / QA Criteria