diff --git a/ui/app/(prowler)/lighthouse/_components/chat/composer.tsx b/ui/app/(prowler)/lighthouse/_components/chat/composer.tsx new file mode 100644 index 0000000000..4f24f2f103 --- /dev/null +++ b/ui/app/(prowler)/lighthouse/_components/chat/composer.tsx @@ -0,0 +1,134 @@ +"use client"; + +import { ArrowRight, Square } from "lucide-react"; +import { type FormEvent } from "react"; + +import { Button } from "@/components/shadcn/button/button"; +import { Textarea } from "@/components/shadcn/textarea/textarea"; + +interface ChatComposerPanelProps { + feedback: string | null; + canRetry: boolean; + onRetry: () => void; + canSend: boolean; + input: string; + isStreaming: boolean; + selectedConfigurationConnected: boolean; + onInputChange: (value: string) => void; + onStop: () => void; + onSubmit: (event: FormEvent) => void; + onSubmitText: (text: string) => Promise; +} + +// Feedback banner + input, shared by the empty and active chat layouts so the +// two branches can't drift apart. +export function ChatComposerPanel({ + feedback, + canRetry, + onRetry, + ...composerProps +}: ChatComposerPanelProps) { + return ( + <> + + + + ); +} + +function ChatFeedbackBar({ + feedback, + canRetry, + onRetry, +}: { + feedback: string | null; + canRetry: boolean; + onRetry: () => void; +}) { + if (!feedback) return null; + + return ( +
+ {feedback} + {canRetry && ( + + )} +
+ ); +} + +interface ChatComposerProps { + canSend: boolean; + input: string; + isStreaming: boolean; + selectedConfigurationConnected: boolean; + onInputChange: (value: string) => void; + onStop: () => void; + onSubmit: (event: FormEvent) => void; + onSubmitText: (text: string) => Promise; +} + +function ChatComposer({ + canSend, + input, + isStreaming, + selectedConfigurationConnected, + onInputChange, + onStop, + onSubmit, + onSubmitText, +}: ChatComposerProps) { + return ( +
+