This commit is contained in:
Desktop
2025-11-13 00:07:34 +05:00
parent fcf6f5f1bc
commit 469e07e046
3 changed files with 121 additions and 5 deletions

View File

@@ -20,9 +20,10 @@ export interface ContentImageData {
interface ContentImageCellProps {
image: ContentImageData | null;
maxPromptLength?: number;
onImageClick?: () => void;
}
export default function ContentImageCell({ image, maxPromptLength = 100 }: ContentImageCellProps) {
export default function ContentImageCell({ image, maxPromptLength = 100, onImageClick }: ContentImageCellProps) {
const [showFullPrompt, setShowFullPrompt] = useState(false);
// Check if image_path is a valid local file path (not a URL)
@@ -113,7 +114,14 @@ export default function ContentImageCell({ image, maxPromptLength = 100 }: Conte
<img
src={getLocalImageUrl(image.image_path)}
alt={prompt || 'Generated image'}
className="w-full h-24 object-cover rounded border border-gray-300 dark:border-gray-600"
className={`w-full h-24 object-cover rounded border border-gray-300 dark:border-gray-600 ${
onImageClick ? 'cursor-pointer hover:opacity-80 transition-opacity' : ''
}`}
onClick={() => {
if (onImageClick) {
onImageClick();
}
}}
onError={(e) => {
// Show empty placeholder if local image fails to load
const target = e.target as HTMLImageElement;