"use client"; import { useEffect } from "react"; import { useWorkflowStore } from "@/store/workflowStore"; import { PredictedCostResult, formatCost, PRICING } from "@/utils/costCalculator"; interface CostDialogProps { predictedCost: PredictedCostResult; incurredCost: number; onClose: () => void; } export function CostDialog({ predictedCost, incurredCost, onClose }: CostDialogProps) { const resetIncurredCost = useWorkflowStore((state) => state.resetIncurredCost); useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { if (e.key === "Escape") { onClose(); } }; window.addEventListener("keydown", handleKeyDown); return () => window.removeEventListener("keydown", handleKeyDown); }, [onClose]); const handleReset = () => { if (confirm("Reset incurred cost to $0.00?")) { resetIncurredCost(); } }; return (

Workflow Costs

{/* Predicted Cost Section */}
Predicted Cost {formatCost(predictedCost.totalCost)}
{predictedCost.breakdown.length > 0 && (
{predictedCost.breakdown.map((item, idx) => (
{item.count}x {item.model === "nano-banana" ? "Nano Banana" : "Nano Banana Pro"} {item.model === "nano-banana-pro" && ` (${item.resolution})`} {formatCost(item.subtotal)}
))}
)} {predictedCost.nodeCount === 0 && (

No generation nodes in workflow

)}
{/* Incurred Cost Section */}
Incurred Cost {formatCost(incurredCost)}

Actual API spend from successful generations

{incurredCost > 0 && ( )}
{/* Pricing Reference */}

Pricing Reference:

Nano Banana (Flash): ${PRICING["nano-banana"]["1K"]}/image

Nano Banana Pro 1K/2K: ${PRICING["nano-banana-pro"]["1K"]}/image

Nano Banana Pro 4K: ${PRICING["nano-banana-pro"]["4K"]}/image

All prices in USD

); }