fix: add photo_path fields to frontend Item interface to display saved photos

The backend returns photo_path, photo_thumbnail_path, and photo_upload_date
from the AI auto-save feature, but the frontend Item interface was missing
these fields, causing images not to display in ItemDetailModal and InventoryTable.

Updated:
- frontend/lib/db.ts: Added missing photo fields to Item interface
- frontend/components/ItemDetailModal.tsx: Use photo_path first, fallback to image_url
- frontend/components/InventoryTable.tsx: Use photo_path first, fallback to image_url

This ensures the UI can now display photos saved by the auto-photo-save feature.
This commit is contained in:
2026-04-21 19:45:19 +03:00
parent 2e61dfe935
commit b5fb2a8cdb
3 changed files with 13 additions and 6 deletions

View File

@@ -22,7 +22,11 @@ export default function ItemDetailModal({
}: ItemDetailModalProps) {
const [showPhotoUpload, setShowPhotoUpload] = useState(false);
const [currentPhoto, setCurrentPhoto] = useState<{ thumbnail_url: string; full_url: string } | null>(
item.image_url ? { thumbnail_url: item.image_url, full_url: item.image_url } : null
item.photo_path && item.photo_thumbnail_path
? { thumbnail_url: item.photo_thumbnail_path, full_url: item.photo_path }
: item.image_url
? { thumbnail_url: item.image_url, full_url: item.image_url }
: null
);
const [isDeleting, setIsDeleting] = useState(false);
const photoUploadRef = useRef<HTMLDivElement>(null);