diff --git a/gui/src/components/FeedbackButtons.tsx b/gui/src/components/FeedbackButtons.tsx index 6ad0992df..009666859 100644 --- a/gui/src/components/FeedbackButtons.tsx +++ b/gui/src/components/FeedbackButtons.tsx @@ -12,7 +12,7 @@ export interface FeedbackButtonsProps { item: ChatHistoryItem; } -export default function FeedbackButtons({ item }: FeedbackButtonsProps) { +export function FeedbackButtons({ item }: FeedbackButtonsProps) { const [feedback, setFeedback] = useState(undefined); const ideMessenger = useContext(IdeMessengerContext); const sessionId = useAppSelector((store) => store.session.id); @@ -41,7 +41,7 @@ export default function FeedbackButtons({ item }: FeedbackButtonsProps) { onClick={() => sendFeedback(true)} > sendFeedback(false)} > diff --git a/gui/src/components/GenerateRuleDialog/GenerationScreen.tsx b/gui/src/components/GenerateRuleDialog/GenerationScreen.tsx new file mode 100644 index 000000000..317873d5c --- /dev/null +++ b/gui/src/components/GenerateRuleDialog/GenerationScreen.tsx @@ -0,0 +1,95 @@ +import { useEffect, useRef, useState } from "react"; +import Spinner from "../gui/Spinner"; +import { Button } from "../ui"; + +interface GenerationScreenProps { + generatedContent: string; + isGenerating: boolean; + error: string | null; + onBack: () => void; + onContinue: () => void; +} + +export function GenerationScreen({ + generatedContent, + isGenerating, + error, + onBack, + onContinue, +}: GenerationScreenProps) { + const [editableContent, setEditableContent] = useState(""); + const textareaRef = useRef(null); + + // Update editable content when generation completes + useEffect(() => { + if (!isGenerating && generatedContent) { + setEditableContent(generatedContent); + } + }, [isGenerating, generatedContent]); + + // Auto-scroll textarea as content streams in + useEffect(() => { + if (textareaRef.current && isGenerating) { + textareaRef.current.scrollTop = textareaRef.current.scrollHeight; + } + }, [generatedContent, isGenerating]); + + const displayContent = isGenerating ? generatedContent : editableContent; + const showSpinner = isGenerating && !generatedContent; + + return ( +
+
+
+

Your rule

+

+ Review and edit your generated rule below +

+
+
+
+
+