diff --git a/frontend/src/components/Modals/ChatFeedback/index.jsx b/frontend/src/components/Modals/ChatFeedback/index.jsx new file mode 100644 index 00000000000..91209d13505 --- /dev/null +++ b/frontend/src/components/Modals/ChatFeedback/index.jsx @@ -0,0 +1,86 @@ +import React, { useState } from "react"; +import ModalWrapper from "@/components/ModalWrapper"; +import { X } from "@phosphor-icons/react"; +import Workspace from "@/models/workspace"; +import { useTranslation } from "react-i18next"; + +export default function ChatFeedbackModal({ + isOpen, + hideModal, + chatId, + slug, + onSubmitted, +}) { + const { t } = useTranslation(); + const [comment, setComment] = useState(""); + const [submitting, setSubmitting] = useState(false); + + const handleSubmit = async (e) => { + e.preventDefault(); + if (!chatId || !slug) { + hideModal(); + return; + } + setSubmitting(true); + try { + // Only forward the comment to parent if there's content; feedback is optional + if (comment && comment.trim() !== "") { + onSubmitted && onSubmitted(comment.trim()); + } + } catch (err) { + // ignore errors for now + } + setSubmitting(false); + hideModal(); + }; + + return ( + +
+
+
+

+ {t("chat_window.provide_feedback")} +

+
+ +
+
+
+

+ {t("chat_window.bad_response_optional_feedback")} +

+