Update ContentImageCell.tsx

This commit is contained in:
Desktop
2025-11-12 10:51:46 +05:00
parent c41efc5f96
commit 8496043258

View File

@@ -97,7 +97,7 @@ export default function ContentImageCell({ image, maxPromptLength = 100 }: Conte
{image.status === 'generated' && (
<div className="space-y-1">
{/* Always load from image_path if available */}
{/* Always load from image_path - no fallback */}
{image.image_path && image.image_path.trim() ? (
<>
<img
@@ -130,33 +130,6 @@ export default function ContentImageCell({ image, maxPromptLength = 100 }: Conte
</a>
)}
</>
) : image.image_url ? (
// Fallback: if no image_path, show image_url (for backward compatibility)
<a
href={image.image_url}
target="_blank"
rel="noopener noreferrer"
className="block group"
>
<img
src={image.image_url}
alt={prompt || 'Generated image'}
className="w-full h-24 object-cover rounded border border-gray-300 dark:border-gray-600 group-hover:opacity-80 transition-opacity"
onError={(e) => {
// Fallback to placeholder if image fails to load
const target = e.target as HTMLImageElement;
target.style.display = 'none';
const parent = target.parentElement;
if (parent) {
parent.innerHTML = `
<div class="w-full h-24 bg-gray-200 dark:bg-gray-700 rounded border-2 border-dashed border-gray-300 dark:border-gray-600 flex items-center justify-center">
<p class="text-xs text-gray-500 dark:text-gray-400">Image not available</p>
</div>
`;
}
}}
/>
</a>
) : (
<div className="w-full h-24 bg-yellow-100 dark:bg-yellow-900/20 rounded border border-yellow-300 dark:border-yellow-700 flex items-center justify-center">
<p className="text-xs text-yellow-700 dark:text-yellow-400">No image available</p>