fix: resolve TypeScript build error in AIOnboarding and Scanner components

- Fix null type error in AIOnboarding.tsx line 352: img src attribute
- Fix similar issue in Scanner.tsx line 237: capturedImage null handling
- Use '|| undefined' pattern to satisfy React 19/Next.js 15 type requirements
- Both components now properly handle null/undefined image states
This commit is contained in:
Daniel Bedeleanu
2026-04-15 09:35:44 +03:00
parent 6c57b1b0c2
commit 65b24079cb
3 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{ {
"version": "1.9.20", "version": "1.9.21",
"last_build": "2026-04-14-2250", "last_build": "2026-04-14-2300",
"codename": "AIFix", "codename": "TSFix",
"commit": "manual" "commit": "manual"
} }

View File

@@ -349,7 +349,7 @@ export default function AIOnboarding({ onCancel, onComplete, categories, invento
) : extractedItems.length === 0 ? ( ) : extractedItems.length === 0 ? (
<div className="flex-1 flex flex-col gap-6 min-h-0 overflow-hidden"> <div className="flex-1 flex flex-col gap-6 min-h-0 overflow-hidden">
<div className="relative flex-1 min-h-0 rounded-[2.5rem] overflow-hidden border-4 border-slate-900 shadow-2xl bg-slate-900"> <div className="relative flex-1 min-h-0 rounded-[2.5rem] overflow-hidden border-4 border-slate-900 shadow-2xl bg-slate-900">
<img src={image} className="w-full h-full object-contain" alt="Captured label" /> <img src={image || undefined} className="w-full h-full object-contain" alt="Captured label" />
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none" /> <div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none" />
{uploading && ( {uploading && (

View File

@@ -234,7 +234,7 @@ export default function Scanner({ onScanSuccess, onOCRMatch, paused }: ScannerPr
{isSelecting && capturedImage && ( {isSelecting && capturedImage && (
<div className="absolute inset-0 z-50 bg-slate-950 flex flex-col"> <div className="absolute inset-0 z-50 bg-slate-950 flex flex-col">
<div className="relative flex-1 bg-black flex items-center justify-center overflow-hidden"> <div className="relative flex-1 bg-black flex items-center justify-center overflow-hidden">
<img src={capturedImage} className="max-w-full max-h-full object-contain" id="ocr-canvas-preview" /> <img src={capturedImage || undefined} className="max-w-full max-h-full object-contain" id="ocr-canvas-preview" />
<div className="absolute inset-0 flex items-center justify-center"> <div className="absolute inset-0 flex items-center justify-center">
<div className="relative" style={{ width: '100%', height: '100%' }}> <div className="relative" style={{ width: '100%', height: '100%' }}>
{detectedWords.map((w, i) => ( {detectedWords.map((w, i) => (