Commit Graph

18 Commits

Author SHA1 Message Date
8d47732de4 debug: add comprehensive logging for image adjustment flow
Added detailed console logging across entire image adjustment pipeline:

1. ImageAdjustmentModal.handleConfirm():
   - Original image dimensions
   - User inputs (rotation, zoom, pan, crop)
   - Canvas processing steps
   - Final blob size

2. AIOnboarding.handleImageAdjustmentConfirm():
   - Adjustments received from modal
   - Item being updated
   - extractedImageBlob status before/after

3. useAIExtraction.confirmSingleItem():
   - newItem being built
   - extractedImageBlob attached
   - imageProcessing attached

This will help identify where values are lost or incorrect in the flow.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-22 13:53:05 +03:00
ba581744ec refactor: improve checkbox styling and remove popup
- Update photo save checkbox to match app design (border-slate-600, htmlFor label)
- Remove success popup overlay - modal closes immediately after save
- Simplify confirmSingleItem to remove setTimeout logic
- Toast notification used for user feedback instead
2026-04-22 09:17:56 +03:00
99a4cae572 fix: show item save confirmation with image before closing
- Add savingIndex state to track saving operation
- Display success overlay with saved image for 1.5 seconds
- Show item name in confirmation message
- Prevents modal from closing immediately after save

Fixes user complaint about image disappearing too quickly without confirmation
2026-04-22 09:07:44 +03:00
c3f63ade6a feat: add image confirmation step to AI extraction flow
Users now see the extracted photo during item editing and can choose to:
- 'Use Photo': Auto-save the image with the item
- 'Skip Photo': Create item without saving the photo

Changes:
1. frontend/components/AIOnboarding.tsx: Added image preview panel in edit form
   - Shows extracted image to user
   - Buttons to accept/reject photo
   - Visual feedback when photo is skipped

2. frontend/hooks/useAIExtraction.ts: Updated confirmSingleItem and confirmAllItems
   - Respect user's photo decision (_skipPhoto flag)
   - Only pass extractedImageBlob if user approved it
   - Prevents unwanted auto-photo-save

This gives users full control over which extracted photos are auto-saved.
2026-04-21 20:00:55 +03:00
eaa2d2d29f fix: replace toast.warning with toast.success in useItemCreate
toast.warning is not a valid method in react-hot-toast API. Changed to
toast.success since the item was successfully created even if photo upload failed.
2026-04-21 19:47:16 +03:00
08fc785583 feat: pass extracted image and image_processing metadata to item creation
- Updated confirmSingleItem() to include extractedImageBlob and imageProcessing
- Updated confirmAllItems() to pass image data for bulk item creation
- Each extracted item now carries its own image_processing metadata
- All items in bulk creation share the same extracted image blob
- Added 12 comprehensive tests verifying data is passed correctly
- All 465 frontend tests passing, zero regressions
2026-04-21 19:27:17 +03:00
fab1e81cf6 feat: auto-upload photo after item creation if image_processing provided 2026-04-21 19:22:10 +03:00
d73b7e45a1 feat: store extracted image blob and image_processing metadata in useAIExtraction hook 2026-04-21 19:04:16 +03:00
2ba1994022 fix: remove console.error and update uploadPhoto type signature in item creation 2026-04-21 13:26:09 +03:00
31899be050 feat(phase2): integrate photo upload into item creation
- Create frontend/app/items/create.tsx with multi-step item creation workflow (Details → Photo Upload → Preview → Confirm)
- Create frontend/hooks/useItemCreate.ts custom hook managing form state, step navigation, and photo upload
- Add integration tests for item creation workflow with photo upload support
- Photo upload step supports manual crop UI with crop bounds submission
- ManualCropUI visible by default with toggle to use full photo
- Photo uploaded before item confirmation, ensuring photo is attached
- Works with mobile camera capture via ItemPhotoUpload component
- All 374 tests passing
2026-04-21 13:20:06 +03:00
b2e2daf40d feat(phase2): implement ManualCropUI with drag handles
- useCropHandles.ts: Hook managing crop bounds state, drag operations, and constraints
  - 8 draggable handles (4 corners + 4 edges)
  - Real-time crop bounds calculation during drag
  - Constrained within image bounds (no dragging outside)
  - Minimum crop size enforcement (100x100px)
  - Support for mobile (touch) and desktop (mouse) events
  - Bounds validation on initialization

- ManualCropUI.tsx: Interactive crop preview component
  - Responsive image display with calculated scaling
  - Semi-transparent overlay outside crop box with visible bounding box
  - 8 draggable handles with visual feedback (highlight/scale on hover)
  - 'Use Full Photo' button to clear crop and show full image
  - Real-time onCropChange callbacks to parent
  - Error handling for failed image loads
  - Touch and mouse event support (desktop + mobile)
  - TypeScript strict mode compliant

- Tests: 26 comprehensive test cases
  - Hook tests (26 passing): initialization, setCrop, resetCrop, drag operations (corners, edges), constraints, endDrag, edge cases
  - Component tests (26 passing): rendering, handles, overlay, callbacks, button, error handling, dimensions, touch/mouse support, responsive behavior, size enforcement, bounds display

All 364 tests passing (13 test files, zero regressions)
Minimum crop size: 100x100px
Handle visual feedback on hover/drag
TypeScript strict mode: ✓
2026-04-21 13:05:37 +03:00
db9aafd47f feat(phase2): implement ItemPhotoUpload component and hook 2026-04-21 12:31:23 +03:00
a520b1ba2b refactor: extract useAIExtraction hook from AIOnboarding.tsx 2026-04-19 12:31:21 +03:00
cf45437bb0 refactor: extract useInventoryFilter hook from inventory/page.tsx 2026-04-19 12:29:22 +03:00
6dfc76ad92 refactor: extract useSync hook from page.tsx 2026-04-19 12:24:25 +03:00
f5441a7ca7 refactor: extract useStockAdjustment hook from page.tsx 2026-04-19 12:23:06 +03:00
5b8c6039ef refactor: extract useScanner hook from page.tsx 2026-04-19 12:21:15 +03:00
db918a86ab feat(admin): finalizing modular refactoring with testing suite and UI polish 2026-04-15 16:41:20 +03:00