From e03dff80c6e899cf9c1039b66e84038acaed5a0d Mon Sep 17 00:00:00 2001 From: batsave Date: Fri, 19 Jan 2024 11:13:29 +0100 Subject: [PATCH] Refactor Chatbot component and add prop type validation --- frontend/src/pages/Chatbot.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/Chatbot.jsx b/frontend/src/pages/Chatbot.jsx index 15cd9b2..b05b153 100644 --- a/frontend/src/pages/Chatbot.jsx +++ b/frontend/src/pages/Chatbot.jsx @@ -1,14 +1,13 @@ import React, { useState, useEffect, useRef } from "react"; import io from "socket.io-client"; import "../scss/chatbot.scss"; - -/* eslint-disable */ +import PropTypes from "prop-types"; const socket = io(import.meta.env.VITE_BACKEND_URL); export default function Chatbot({ isVisible }) { const [messages, setMessages] = useState([]); const [currentMessage, setCurrentMessage] = useState(""); - const [isTyping, setIsTyping] = useState(false); + const [isTyping] = useState(false); const [hasInitiated, setHasInitiated] = useState(false); const messagesEndRef = useRef(null); @@ -56,7 +55,7 @@ export default function Chatbot({ isVisible }) {
{messages.map((message, index) => (
); } + +Chatbot.propTypes = { + isVisible: PropTypes.bool.isRequired, +};