"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 (
{description}
{item.role === "user" ? "You" : "Gemini"}
{part.text}
} {part.image && (