diff --git a/components/PromptPanel.tsx b/components/PromptPanel.tsx index c985c7b..1094b78 100644 --- a/components/PromptPanel.tsx +++ b/components/PromptPanel.tsx @@ -6,11 +6,13 @@ import {useRef} from 'react'; interface PromptPanelProps { prompts: PromptInput[]; addPrompt: (prompt: string) => void; + changeUpNextPrompt: (prompt: string) => void; } export default function PromptPanel({ prompts, addPrompt, + changeUpNextPrompt, }: PromptPanelProps) { const inputPrompt = useRef(null); @@ -28,7 +30,7 @@ export default function PromptPanel({
{ e.preventDefault(); const prompt = e.currentTarget.prompt.value; - addPrompt(prompt); + changeUpNextPrompt(prompt); inputPrompt.current.value = ''; }}> // need not just order, but some context of where we are in time, and when that prompt will be primary (some global step state) const promptEntryClassNames = { 0: "font-light text-sm text-gray-400 text-opacity-40", diff --git a/pages/index.tsx b/pages/index.tsx index 49a3d86..d223862 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -144,6 +144,11 @@ export default function Home() { addPrompt={(prompt: string) => { setPromptInputs([...promptInputs, { prompt: prompt }]); }} + changeUpNextPrompt={(prompt: string) => { + const newPromptInputs = [...promptInputs]; + newPromptInputs[newPromptInputs.length - 1].prompt = prompt; + setPromptInputs(newPromptInputs); + }} />