diff --git a/app/story/[storySlug]/story-editor-client.tsx b/app/story/[storySlug]/story-editor-client.tsx index 75915f8..1e93da9 100644 --- a/app/story/[storySlug]/story-editor-client.tsx +++ b/app/story/[storySlug]/story-editor-client.tsx @@ -55,6 +55,7 @@ export function StoryEditorClient() { const [showGenerateModal, setShowGenerateModal] = useState(false); const [showDeleteDialog, setShowDeleteDialog] = useState(false); const [pageToDelete, setPageToDelete] = useState(null); + const [showRedrawDialog, setShowRedrawDialog] = useState(false); const [loadingPageId, setLoadingPageId] = useState(null); const [isLoading, setIsLoading] = useState(true); const [existingCharacterImages, setExistingCharacterImages] = useState< @@ -163,11 +164,16 @@ export function StoryEditorClient() { setShowGenerateModal(true); }; - const handleRedrawPage = async () => { + const handleRedrawPage = () => { if (!apiKey) { setShowApiModal(true); return; } + setShowRedrawDialog(true); + }; + + const confirmRedrawPage = async () => { + setShowRedrawDialog(false); const currentPageData = pages[currentPage]; if (!currentPageData) return; @@ -179,7 +185,7 @@ export function StoryEditorClient() { method: "POST", headers: { "Content-Type": "application/json", - "x-api-key": apiKey, + "x-api-key": apiKey!, }, body: JSON.stringify({ storyId: story?.slug, @@ -498,6 +504,23 @@ export function StoryEditorClient() { + + + + + Redraw Page + + Are you sure you want to redraw page {currentPage + 1}? This will regenerate the image for this page with a fresh result. + + + + Cancel + + Redraw + + + + ); }