Closed a-type closed 1 year ago
This has been difficult to approach, conceptually. Maybe what I need to do is stop thinking of the pantry as a list of items which were purchased, but rather as a food database which records last purchase date.
This needs some ground-up design thinking...
What I want from the pantry:
Also, existing food database management is awkward and hidden in settings.
So, instead of marking items as purchased, I could:
Open question: what happens if the item didn't have an assigned food?
When using an item, instead of deleting the grocery item (no longer exists), I can clear the purchased timestamp on the food. No purchased timestamp === not in inventory.
Expiration logic is similar-- expiresAt = purchasedAt + expirationEstimate. Compare with now to find expired items. Same indexing logic as currently exists on items.
Same deal, each food entry has a quick add button.
Snoozing expiration... maybe similar logic as well. Currently items store an expiresAt. That can just be bumped a few days.
I'm thinking by-category breakdown, still. Maybe as cards instead of line items, like recipes. Can I show only 1 page for each category, ordered by most recent purchases, with an option to expand? That would be an index like... Category->Purchased At, Order Desc, Limit X
. Seems valid.
Expiring items still go up top.
Another problem: by immediately deleting purchased items, now I have to keep track of them ephemerally while they animate out. And I won't know whether an item was deleted because it was purchased, or because it was just deleted. For instance, when a different user opens the app and syncs recent purchases and deletions.
So I could keep the purchased flag in place on items and set it before deleting, I guess. But I don't think the client can rely on getting those two simultaneous operations fine-grained enough to see the progression of state.
Should purchased items just be kept around and deleted after a certain amount of time?
Another thing I want to do on the pantry page: quickly add foods I know I have, but didn't go through the grocery list.
Instead of adding a new purchased item like now, this can be done by looking up the food name I put in, and setting the purchased timestamp to now.
I'm thinking separate categories, maybe as cards? The giant list is not easy to scan.