import React, { useState } from "react"; import { generateImage } from "../services/gemini"; import { GeneratedImage } from "../services/types"; const ImageView: React.FC = () => { const [prompt, setPrompt] = useState(""); const [loading, setLoading] = useState(false); const [history, setHistory] = useState([]); const [aspectRatio, setAspectRatio] = useState<"1:1" | "16:9" | "9:16">( "1:1" ); const handleGenerate = async () => { if (!prompt.trim() || loading) return; setLoading(true); try { const url = await generateImage(prompt, aspectRatio); setHistory((prev) => [{ url, prompt, timestamp: new Date() }, ...prev]); } catch (error) { console.error(error); alert("Asset generation failed. Please refine your parameters."); } finally { setLoading(false); } }; return (

Image Forge

Generate high-fidelity visual assets for your brand and projects.

setPrompt(e.target.value)} placeholder="High-resolution architectural render of a modern workspace..." className="w-full bg-slate-50 text-slate-800 rounded-2xl px-6 py-4 focus:outline-none focus:ring-4 focus:ring-blue-500/10 border border-slate-200 text-lg transition-all" />
{history.length === 0 && !loading && (

Project Gallery Empty

Initialize generation to view results.

)}
{loading && (

Computing Vision...

)} {history.map((img, i) => (
{img.prompt}

"{img.prompt}"

Export Resolution
))}
); }; export default ImageView;