feat: integrate barcode scanning functionality and create AGENTS.MD #2

Merged
9961 merged 2 commits from barcode into main 2026-05-27 13:34:14 +00:00
Owner

Summary

This PR adds an end-to-end barcode intake flow so users can scan Red Bull cans with camera input and log entries through the existing intake pipeline.

  • Adds camera-based barcode scanning UI with native BarcodeDetector support and @zxing/browser fallback, including error handling, duplicate-scan debounce, and manual barcode entry fallback.
  • Introduces typed barcode lookup architecture with verified barcode seed data, product resolution against existing flavour definitions, unknown-barcode manual mapping flow, and reusable preview/confirmation UI.
  • Adds Appwrite-backed barcode catalog support (barcode_products) with setup-script provisioning, verified barcode seeding, and per-user mapping sync with local-storage fallback.
  • Keeps intake creation unified by converting scanned products into standard EntryDraft objects and sending them through the same save/limits/sync logic as manual entries.

Why

Manual entry for common products is repetitive. This change reduces friction by turning a barcode scan into a normal intake entry while preserving all existing metrics, streaks, import/export behavior, and Appwrite sync.

Test Plan

  • Run npm run setup:appwrite and confirm barcode_products table is created and verified rows are seeded.
  • Run npm run lint.
  • Run npm run build.
  • Open scanner from UI and confirm camera permission prompt appears only when scanner opens.
  • Scan a known EAN/UPC barcode and verify product preview appears with correct flavour/size/price/caffeine.
  • Click Add now and confirm entry appears in logbook/overview as a standard intake record.
  • Scan or type an unknown barcode and verify manual mapping form appears.
  • Save manual mapping, rescan the same barcode, and confirm it auto-resolves.
  • Close scanner/cancel flow and confirm camera stream stops cleanly
## Summary This PR adds an end-to-end barcode intake flow so users can scan Red Bull cans with camera input and log entries through the existing intake pipeline. - Adds camera-based barcode scanning UI with native BarcodeDetector support and @zxing/browser fallback, including error handling, duplicate-scan debounce, and manual barcode entry fallback. - Introduces typed barcode lookup architecture with verified barcode seed data, product resolution against existing flavour definitions, unknown-barcode manual mapping flow, and reusable preview/confirmation UI. - Adds Appwrite-backed barcode catalog support (barcode_products) with setup-script provisioning, verified barcode seeding, and per-user mapping sync with local-storage fallback. - Keeps intake creation unified by converting scanned products into standard EntryDraft objects and sending them through the same save/limits/sync logic as manual entries. ## Why Manual entry for common products is repetitive. This change reduces friction by turning a barcode scan into a normal intake entry while preserving all existing metrics, streaks, import/export behavior, and Appwrite sync. ## Test Plan - [x] Run npm run setup:appwrite and confirm barcode_products table is created and verified rows are seeded. - [x] Run npm run lint. - [x] Run npm run build. - [x] Open scanner from UI and confirm camera permission prompt appears only when scanner opens. - [x] Scan a known EAN/UPC barcode and verify product preview appears with correct flavour/size/price/caffeine. - [x] Click Add now and confirm entry appears in logbook/overview as a standard intake record. - [ ] Scan or type an unknown barcode and verify manual mapping form appears. - [x] Save manual mapping, rescan the same barcode, and confirm it auto-resolves. - [x] Close scanner/cancel flow and confirm camera stream stops cleanly
9961 added 2 commits 2026-05-27 13:33:45 +00:00
- Added a new `barcode_products` collection to the Appwrite setup for managing barcode data.
- Implemented barcode scanning feature with a dedicated modal for scanning and adding products.
- Introduced new components for barcode product preview and management.
- Updated the setup script to seed verified barcode products from a JSON file.
- Enhanced the application state management to handle barcode-related actions and user interactions.
9961 merged commit 839d00aee1 into main 2026-05-27 13:34:14 +00:00
9961 deleted branch barcode 2026-05-27 13:34:23 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: 9961/Red-Bull-Tracker#2