"use client"; import { useEffect, useState } from "react"; import aiStyles from "@/styles/ai.module.css"; import styles from "./AiPromptPanel.module.css"; type Props = { open: boolean; title: string; initialPrompt: string; busy?: boolean; error?: string; disabled?: boolean; onClose: () => void; onRun: (prompt: string) => void; }; export default function AiPromptPanel({ open, title, initialPrompt, busy = false, error = "", disabled = false, onClose, onRun, }: Props) { const [prompt, setPrompt] = useState(initialPrompt); useEffect(() => { if (open) setPrompt(initialPrompt); }, [open, initialPrompt]); if (!open) return null; return (

{title}

Edit the prompt, then run AI to fill this field.