From 91ff24638c045a676d8ff3995a491e5373134869 Mon Sep 17 00:00:00 2001 From: Ravindra <42912207+KR-Ravindra@users.noreply.github.com> Date: Fri, 27 Oct 2023 09:43:48 -0700 Subject: [PATCH] QUICK CHANGES --- src/components/homePage/index.js | 172 +++++++++++--------- src/components/homePage/keywordListFrame.js | 49 +++--- 2 files changed, 128 insertions(+), 93 deletions(-) diff --git a/src/components/homePage/index.js b/src/components/homePage/index.js index 7b576ef..1b7a01d 100644 --- a/src/components/homePage/index.js +++ b/src/components/homePage/index.js @@ -2,16 +2,16 @@ import React, { useState, useEffect } from "react"; import "./index.css"; import ScraperTextFrame from "./scraperTextFrame"; import "./animation.css"; -import html2pdf from 'html2pdf.js'; -import scraperText from '../../api/scraperText'; +import html2pdf from "html2pdf.js"; +import scraperText from "../../api/scraperText"; import MultiAlgoComparision from "../../api/multiAlgo"; import keywordList from "../../api/keyword"; -import KeywordListFrame from './keywordListFrame'; -import AlgoComparision from './algoComparision'; -import TableComponent from './recommendationTableComponent'; +import KeywordListFrame from "./keywordListFrame"; +import AlgoComparision from "./algoComparision"; +import TableComponent from "./recommendationTableComponent"; import RecommendationList from "../../api/recommendation"; -import AnalyzerList from "../../api/analyzer" -import InsightTable from './inSight' +import AnalyzerList from "../../api/analyzer"; +import InsightTable from "./inSight"; function HomePage() { const [urlInput, setUrlInput] = useState(""); @@ -20,8 +20,8 @@ function HomePage() { const [scraperData, setScraperData] = useState(""); const [keywordListData, setKeywordListData] = useState(""); const [multialgo, setMultialgo] = useState(""); - const [recommendationListData, setRecommendationListData]=useState('') - const [analyzerData, setAnalyzerData]= useState(""); + const [recommendationListData, setRecommendationListData] = useState(""); + const [analyzerData, setAnalyzerData] = useState(""); const [scrollPosition, setScrollPosition] = useState(0); const [scrollUp, setScrollUp] = useState(false); const [resetScroll, setResetScroll] = useState(false); @@ -63,7 +63,7 @@ function HomePage() { }; // const handleDownload = () => { - // // const element = document.getElementById('pdf-container'); + // // const element = document.getElementById('pdf-container'); // // html2pdf(element); // window.print(); // }; @@ -74,6 +74,11 @@ function HomePage() { }; const handleSubmit = () => { + setScraperData(""); + setKeywordListData(""); + setMultialgo(""); + setRecommendationListData(""); + setAnalyzerData(""); setLoading(true); if (urlInput.trim() === "") { @@ -87,61 +92,62 @@ function HomePage() { }; console.log("Form submitted:", payload); - const scraperTextData= scraperText(payload); - scraperTextData.then((response)=> - setScraperData(response)) - .catch(error => { - console.error('API error:', error); + const scraperTextData = scraperText(payload); + scraperTextData + .then((response) => setScraperData(response)) + .catch((error) => { + console.error("API error:", error); }) .finally(() => { - setLoading(false); + console.log("Finalised"); }); - const keywordListData= keywordList(payload) + const keywordListData = keywordList(payload); - keywordListData.then((response)=> - setKeywordListData(response)) - .catch(error => { - console.error('API error:', error); + keywordListData + .then((response) => setKeywordListData(response)) + .catch((error) => { + console.error("API error:", error); }) .finally(() => { - setLoading(false); + console.log("Finalised"); }); - const recommendationList=RecommendationList(payload); - recommendationList.then((response) => - setRecommendationListData(response)) - .catch(error => { - console.error('API error:', error); + const recommendationList = RecommendationList(payload); + recommendationList + .then((response) => setRecommendationListData(response)) + .catch((error) => { + console.error("API error:", error); }) .finally(() => { - setLoading(false); + console.log("Finalised"); }); - const multialgoComparision = MultiAlgoComparision(payload); - multialgoComparision.then((response) => - setMultialgo(response)) - .catch(error => { - console.error('API error:', error); + multialgoComparision + .then((response) => setMultialgo(response)) + .catch((error) => { + console.error("API error:", error); }) .finally(() => { - setLoading(false); + console.log("Finalised"); }); - const urlAnalyzerData=AnalyzerList(payload) - urlAnalyzerData.then((response) => - setAnalyzerData(response)) - .catch(error => { - console.error('API error:', error); + const urlAnalyzerData = AnalyzerList(payload); + urlAnalyzerData + .then((response) => setAnalyzerData(response)) + .catch((error) => { + console.error("API error:", error); }) .finally(() => { setLoading(false); }); - }; return ( -