the-collab-lab / tcl-74-smart-shopping-list

1 stars 0 forks source link

Issue #9 : mark an item on shopping list as purchased and implement 24HR expiration for repurchasing. #25

Closed dterceroparker closed 1 month ago

dterceroparker commented 1 month ago

Description

This pull request introduces a new feature that allows users to mark items as purchased on their shopping list. The feature is designed to help users track purchased items with a 24-hour interval, enhancing the user experience in managing their shopping history.

Database Changes

Incremental Logic: Added logic to increment totalPurchases when an item is marked as purchased. This keeps track of how many times an item has been bought.

24-Hour Purchase Frequency: Implemented dateLastPurchased to enforce a 24-hour purchase window, preventing users from needing to repurchase the same item within a day. The 24-hour purchase frequency prevents accidental duplicate purchases by automatically unchecking items after the time period elapses.

UI Enhancements

Toggleable Purchase Status: Introduced a semantic label that toggles between "Purchased" and "Not Purchased," visually indicating the item's current status.

Purchase History Tracking: Displayed the date and time of the last purchase, allowing users to track when an item was last bought.

Auto-refresh on Mount: Added a refresh function within useEffect to ensure the UI is updated every second when the component mounts, reflecting the latest data.

Related Issue

Closes #9

Acceptance Criteria

Type of Changes

Enhancement

Updates

Before

Screen Shot 2024-09-04 at 2 53 22 PM

After

Screen Shot 2024-09-04 at 2 49 21 PM Screen Shot 2024-09-04 at 2 51 35 PM Screen Shot 2024-09-04 at 2 50 48 PM

Testing Steps / QA Criteria

github-actions[bot] commented 1 month ago

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

https://tcl-74-smart-shopping-list--pr25-dtp-st-9-junqk0w9.web.app

(expires Sat, 14 Sep 2024 15:27:09 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 79d73546692f99aad8468c28e36db434e2c190ac

dterceroparker commented 1 month ago

Thank you so much, @stacy-tech and @NickRoccodev11! We implemented a disable toggle logic in Toggle.jsx and ListItem.jsx. Thank you for catching this :)