import { useState } from 'react'; import { createLogger } from '@automaker/utils/logger'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { Button } from '@/components/ui/button'; import { Label } from '@/components/ui/label'; import { HotkeyButton } from '@/components/ui/hotkey-button'; import { DescriptionImageDropZone, FeatureImagePath as DescriptionImagePath, ImagePreviewMap, } from '@/components/ui/description-image-dropzone'; import { MessageSquare } from 'lucide-react'; import { Feature } from '@/store/app-store'; import { EnhanceWithAI, EnhancementHistoryButton, type EnhancementMode, type BaseHistoryEntry, } from '../shared'; const logger = createLogger('FollowUpDialog'); /** * A single entry in the follow-up prompt history */ export interface FollowUpHistoryEntry extends BaseHistoryEntry { prompt: string; } interface FollowUpDialogProps { open: boolean; onOpenChange: (open: boolean) => void; feature: Feature | null; prompt: string; imagePaths: DescriptionImagePath[]; previewMap: ImagePreviewMap; onPromptChange: (prompt: string) => void; onImagePathsChange: (paths: DescriptionImagePath[]) => void; onPreviewMapChange: (map: ImagePreviewMap) => void; onSend: () => void; isMaximized: boolean; /** History of prompt versions for restoration */ promptHistory?: FollowUpHistoryEntry[]; /** Callback to add a new entry to prompt history */ onHistoryAdd?: (entry: FollowUpHistoryEntry) => void; } export function FollowUpDialog({ open, onOpenChange, feature, prompt, imagePaths, previewMap, onPromptChange, onImagePathsChange, onPreviewMapChange, onSend, isMaximized, promptHistory = [], onHistoryAdd, }: FollowUpDialogProps) { const handleClose = (openState: boolean) => { if (!openState) { onOpenChange(false); } }; return ( { if ((e.metaKey || e.ctrlKey) && e.key === 'Enter' && prompt.trim()) { e.preventDefault(); onSend(); } }} > Follow-Up Prompt Send additional instructions to continue working on this feature. {feature && ( Feature: {feature.description.slice(0, 100)} {feature.description.length > 100 ? '...' : ''} )}
{/* Version History Button */} entry.prompt} title="Prompt History" restoreMessage="Prompt restored from history" />
{/* Enhancement Section */} { const timestamp = new Date().toISOString(); // Add original text first (so user can restore to pre-enhancement state) // Only add if it's different from the last history entry const lastEntry = promptHistory[promptHistory.length - 1]; if (!lastEntry || lastEntry.prompt !== originalText) { onHistoryAdd?.({ prompt: originalText, timestamp, source: promptHistory.length === 0 ? 'initial' : 'edit', }); } // Add enhanced text onHistoryAdd?.({ prompt: enhancedText, timestamp, source: 'enhance', enhancementMode: mode, }); }} />

The agent will continue from where it left off, using the existing context. You can attach screenshots to help explain the issue.

Send Follow-Up
); }