Closed fullybaked closed 1 year ago
Hey @fullybaked I would like to give it a try
@nitin-pandita thanks so much for your interest, but this issue (and this whole repo) are for one of the teams in the current cohort of The Collab Lab and our participants will be working on it as part of the programme.
If you're interested in issues, or projects like this, you can check out The Collab Lab, and apply if you'd like to participate. We'll be running more cohorts next year.
e Collab Lab, and
@fullybaked Thank you for the reply, i would to participate
Summary
Sorting items by how soon the user might need to buy them will make it easier for the user to identify what they need to buy, which will in turn help them better plan their shopping trips. To that end, we will be sorting items into 4 possible groups, according to how urgently the user should buy the item:
To implement this feature, your team will need to create some new UI elements so the user knows how their items are sorted and write some logic behind-the-scenes to perform the sorting itself. Read the acceptance criteria and our notes carefully to be sure you understand the tasks at hand, and don’t be afraid to reach out to the rest of your team, and your mentors if you need help. You’ve got this!
Acceptance criteria
api/firestore.js
exports a newcomparePurchaseUrgency
function with the following behaviorsA stretch goal
If you complete all of the previous acceptance criteria, consider what happens when an item’s
dateNextPurchased
has passed, but it isn’t yet inactive. Let’s call that item “overdue”.comparePurchaseUrgency
to sort “overdue” items to the top of the listNotes
There's a lot to do for this issue! Read this section for some ideas about how to approach the tasks ahead. The
getDaysBetweenDates
function insrc/utils/dates.js
will be useful!Remember: The dates in the Firestore database are special
Timestamp
objects. You’ll need to call theirtoDate()
method to get a JavaScript Date that we can work with.Indicating purchase urgency in the UI
It’s tempting to use colors or icons to indicate how soon the user should buy an item. Keep in mind:
With these constraints, it’s probably best to render plain text, like “soon”, “kind of soon”, etc. in order to show urgency. You can still use color alongside that text, and the design of where that text goes is up to you!
Sorting the list
We’re sorting by multiple criteria:
dateNextPurchased
, andSorting by multiple criteria can be tricky! Refer to the MDN docs for
Array.prototype.sort
and refresh yourself on how to write compare functions so you can write thecomparePurchaseUrgency
function.