fix: complete image pipeline - rotation, URL, preview

- Add rotation_degrees parameter to ImageProcessor.process_photo()
- Pass rotation through _auto_save_photo_from_extraction() to processor
- Allow no-crop fallback when crop_bounds is None
- Add buildPhotoUrl() helper to resolve backend URLs correctly
- Update frontend components to use backend URL for image sources
- Replace Use/Skip Photo buttons with checkbox in AI extraction UI
- Add images/ to .gitignore to prevent accidental commits

Addresses: rotation never applied, image 404s (relative to Next.js not backend), preview blank in edit form
This commit is contained in:
2026-04-22 08:50:25 +03:00
parent 1c13ebd76f
commit 64d177e791
10 changed files with 79 additions and 70 deletions

View File

@@ -2,7 +2,7 @@
import { useState, useEffect, useCallback } from 'react';
import { db, Item } from '@/lib/db';
import { inventoryApi } from '@/lib/api';
import { inventoryApi, getBackendUrl } from '@/lib/api';
import PageShell from '@/components/PageShell';
import Scanner from '@/components/Scanner';
import StatCard from '@/components/StatCard';
@@ -41,6 +41,7 @@ export default function InventoryPage() {
const [inventory, setInventory] = useState<Item[]>([]);
const [stats, setStats] = useState<any>(null);
const [currentUser, setCurrentUser] = useState<any | null>(null);
const [backendUrl, setBackendUrl] = useState<string>('');
const {
searchQuery,
@@ -85,7 +86,8 @@ export default function InventoryPage() {
if (savedUser) {
setCurrentUser(JSON.parse(savedUser));
}
getBackendUrl().then(setBackendUrl);
loadData();
}, []);
@@ -311,6 +313,7 @@ export default function InventoryPage() {
}
}}
categoriesList={categoriesList}
backendUrl={backendUrl}
/>
</div>