-
Notifications
You must be signed in to change notification settings - Fork 0
Handle adding duplicate items: allow separate item for unpacked, merge when packed #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThis change implements automatic merging of duplicate baggage items when unpacked items are marked as packed. When adding items, duplicates are kept separate if already packed; upon packing an unpacked duplicate, it merges with its packed counterpart. A new toast notification method and comprehensive test coverage support this functionality. Changes
Sequence DiagramsequenceDiagram
participant User
participant BaggageCard
participant ToastContext
User->>BaggageCard: Add duplicate item (packed variant exists)
BaggageCard->>BaggageCard: Search unpacked items only
BaggageCard->>BaggageCard: Create new unpacked item (qty: 1)
BaggageCard->>User: Display separate unpacked card
User->>BaggageCard: Mark unpacked duplicate as packed
BaggageCard->>BaggageCard: Detect unpacked → packed transition
BaggageCard->>BaggageCard: Find packed item with same name
BaggageCard->>BaggageCard: Merge quantities & remove unpacked
BaggageCard->>ToastContext: mergeItems(itemName, totalQty)
ToastContext->>User: Show success toast with merge notification
BaggageCard->>User: Display single packed card (merged qty)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…erge on pack Co-authored-by: dralan71 <195392503+dralan71@users.noreply.github.com>
…BaggageCard component for clarity
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
When adding an item that already exists as packed, users need a way to track new unpacked items separately until they're physically packed.
Changes
BaggageCard.tsx-addItem: Check only for unpacked duplicates. If matching item exists but is packed, create new unpacked item instead of incrementing quantity.BaggageCard.tsx-updateItem: When marking item as packed, detect and merge with existing packed item of same name, combining quantities.ToastContext.tsx: AddmergeItemstoast notification for merge feedback.Example Flow
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.