Versiones actualizadas:

Frontend: v1.2.1 → v1.2.2
Backend: v1.0.97 → v1.0.98
Cambios en v1.2.2 / v1.0.98:

 Fix crítico: Error createObjectURL al continuar inspecciones existentes
 Soporte para fotos como File (nuevas) y URL string (existentes)
This commit is contained in:
2025-12-04 09:19:13 -03:00
parent d3676172e1
commit 311d363e31
5 changed files with 36 additions and 29 deletions

View File

@@ -5175,33 +5175,40 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl
{answers[currentQuestion.id].photos.length} archivo(s) cargado(s):
</div>
<div className="grid grid-cols-3 gap-2">
{answers[currentQuestion.id].photos.map((photo, index) => (
<div key={index} className="relative group">
{photo.type === 'application/pdf' ? (
<div className="w-full h-24 flex flex-col items-center justify-center bg-red-50 border-2 border-red-300 rounded-lg">
<span className="text-3xl">📝</span>
<span className="text-xs text-red-700 mt-1">PDF</span>
{answers[currentQuestion.id].photos.map((photo, index) => {
// Determinar si es un archivo nuevo (File/Blob) o una URL existente (string)
const isFile = photo instanceof File || photo instanceof Blob
const isPDF = isFile ? photo.type === 'application/pdf' : photo.endsWith('.pdf')
const photoURL = isFile ? URL.createObjectURL(photo) : photo
return (
<div key={index} className="relative group">
{isPDF ? (
<div className="w-full h-24 flex flex-col items-center justify-center bg-red-50 border-2 border-red-300 rounded-lg">
<span className="text-3xl">📝</span>
<span className="text-xs text-red-700 mt-1">PDF</span>
</div>
) : (
<img
src={photoURL}
alt={`Foto ${index + 1}`}
className="w-full h-24 object-cover rounded-lg border border-gray-300"
/>
)}
<button
type="button"
onClick={() => handleRemovePhoto(currentQuestion.id, index)}
className="absolute top-1 right-1 bg-red-600 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity"
title="Eliminar foto"
>
</button>
<div className="text-xs text-center text-gray-600 mt-1">
{isPDF ? (isFile ? photo.name : 'PDF') : `Foto ${index + 1}`}
</div>
) : (
<img
src={URL.createObjectURL(photo)}
alt={`Foto ${index + 1}`}
className="w-full h-24 object-cover rounded-lg border border-gray-300"
/>
)}
<button
type="button"
onClick={() => handleRemovePhoto(currentQuestion.id, index)}
className="absolute top-1 right-1 bg-red-600 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity"
title="Eliminar foto"
>
</button>
<div className="text-xs text-center text-gray-600 mt-1">
{photo.type === 'application/pdf' ? photo.name : `Foto ${index + 1}`}
</div>
</div>
))}
)
})}
</div>
{/* Analyze Button - Solo para ai_mode assisted/full y NO para ai_assistant */}

View File

@@ -153,7 +153,7 @@ export default function Sidebar({ user, activeTab, setActiveTab, sidebarOpen, se
className="w-10 h-10 object-contain bg-white rounded p-1"
/>
<p className="text-xs text-indigo-300 font-medium hover:text-indigo-200">
Ayutec v1.2.1
Ayutec v1.2.2
</p>
</a>
</div>