import TextArea from "@/components/generics/textArea/TextArea"; import { GoStarFill } from "react-icons/go"; import Button from "@/components/generics/button/Button"; import { useMemo, useState } from "react"; import { CommentProps } from "./CommentProps"; import { UserScore } from "@/api/predictions/types"; import Input from "@/components/generics/input/Input"; import "./Comment.scss"; const Comment = ({ onSubmit, loading, log_id }: CommentProps) => { const [score, setScore] = useState(null); const [hover, setHover] = useState(0); const [commentText, setCommentText] = useState(""); const [showMessage, setShowMessage] = useState(false); const [manualEstimate, setManualEstimate] = useState(""); const [llmEstimate, setLlmEstimate] = useState(""); // eslint-disable-next-line @typescript-eslint/no-explicit-any const handleInput = (event: any) => { setCommentText(event.target.value); }; const handleFeedback = () => { setShowMessage(true); setTimeout(() => { setShowMessage(false); }, 2000); }; const handleSubmit = async () => { if (score !== null && log_id != null) { onSubmit( { log_id: log_id, userComment: commentText, userScore: score, llmEstimate: Number(llmEstimate), manualEstimate: Number(manualEstimate), }, () => { handleFeedback(); setCommentText(""); setScore(null); setLlmEstimate(""); setManualEstimate(""); } ); } }; const ratingView = useMemo(() => { return Array.from({ length: 5 }, (_, i) => ( )); }, [hover, score]); return (
Оцените ответ: {ratingView}