"use client"; import { Button } from "@/components/ui/button"; import { Download, RotateCcw, MessageCircle } from "lucide-react"; import { useState } from "react"; import { HistoryItem, HistoryPart } from "@/lib/types"; import Image from "next/image"; interface ImageResultDisplayProps { imageUrl: string; description: string | null; onReset: () => void; conversationHistory?: HistoryItem[]; } export function ImageResultDisplay({ imageUrl, description, onReset, conversationHistory = [], }: ImageResultDisplayProps) { const [showHistory, setShowHistory] = useState(false); const handleDownload = () => { // Create a temporary link element const link = document.createElement("a"); link.href = imageUrl; link.download = `gemini-image-${Date.now()}.png`; document.body.appendChild(link); link.click(); document.body.removeChild(link); }; const toggleHistory = () => { setShowHistory(!showHistory); }; return (

Generated Image

{conversationHistory.length > 0 && ( )}
Generated
{description && (

Description

{description}

)} {showHistory && conversationHistory.length > 0 && (

Conversation History

{conversationHistory.map((item, index) => (

{item.role === "user" ? "You" : "Gemini"}

{item.parts.map((part: HistoryPart, partIndex) => (
{part.text &&

{part.text}

} {part.image && (
{`${item.role}
)}
))}
))}
)}
); }