From 5a484a24a13b1a3174156d15c17f5d15a5e7e7ea Mon Sep 17 00:00:00 2001 From: PallaviKhedle Date: Thu, 26 Oct 2023 21:16:33 -0700 Subject: [PATCH 1/5] Description & style changes --- src/components/homePage/algoComparision.js | 4 +- src/components/homePage/scraperFrame.css | 49 ++++++++++++++++++++- src/components/homePage/scraperTextFrame.js | 26 ++++++++--- 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/src/components/homePage/algoComparision.js b/src/components/homePage/algoComparision.js index 7635469..773b026 100644 --- a/src/components/homePage/algoComparision.js +++ b/src/components/homePage/algoComparision.js @@ -103,7 +103,7 @@ const AlgoComparision = ({ multialgo }) => { // const name = algoData[context.dataIndex].algoName; // return `${label}: ${name}`; return `${label}` - + }, }, }, @@ -111,7 +111,7 @@ const AlgoComparision = ({ multialgo }) => { }; - return ; + return ; }; export default AlgoComparision; diff --git a/src/components/homePage/scraperFrame.css b/src/components/homePage/scraperFrame.css index e2bbfee..d0b7db3 100644 --- a/src/components/homePage/scraperFrame.css +++ b/src/components/homePage/scraperFrame.css @@ -6,16 +6,63 @@ height: 100vh; } +.h1container { + display: flex; + align-self: flex-start; + margin-left: 9.4%; +} + +.h1textStyle { + color: #FABB2E; + font-size: larger; + margin-top:5%; +} + +.urlText { + color: white; + margin-left: 10px; +} + .scraperData { color: white; border: 2px solid #FABB2E; padding: 10px; + min-width: 80%; max-width: 80%; text-align: center; overflow-y: auto; - max-height: 50vh; + min-height: 50vh; + +} +.cardStyle{ + width: 81%; + margin-bottom: 4%; + border: 3px solid white; + height:2%; + padding-bottom: 3%; + +} +.cardContentStyle { + background-color: #FABB2E; + color: black; + align-items: center; + font-weight: bold; + overflow-y: auto; + max-height: 5vh; +} + +.cardContentStyle::-webkit-scrollbar { + width: 6px; } +.cardContentStyle::-webkit-scrollbar-thumb { + background-color: black; + border-radius: 6px; +} + +.cardContentStyle::-webkit-scrollbar-track { + background-color: transparent; /* Color of the track */ +} .scraperData::-webkit-scrollbar { width: 6px; } diff --git a/src/components/homePage/scraperTextFrame.js b/src/components/homePage/scraperTextFrame.js index c2bacf5..08633c9 100644 --- a/src/components/homePage/scraperTextFrame.js +++ b/src/components/homePage/scraperTextFrame.js @@ -1,14 +1,30 @@ import React from 'react'; import './scraperFrame.css'; +import { Card, CardContent } from '@mui/material'; + function ScraperTextFrame(props) { + console.log('props', props); return (
-

Scraper context for {props.url}

-
-

{props.scraperData?.scrapedContent}

-
+
+

Scrapper context for

+ {props&&

{props?.url}

} +
+ + {props.analyzerData&&props?.analyzerData.pages[0]?.description && + + + Description: {props?.analyzerData.pages[0].description} + + + } + + +
+

{props?.scraperData?.scrapedContent}

+
); } -export default ScraperTextFrame; \ No newline at end of file +export default ScraperTextFrame; From d78b200b5560533a32160db7653701bec0e0ea0d Mon Sep 17 00:00:00 2001 From: PallaviKhedle Date: Thu, 26 Oct 2023 21:16:55 -0700 Subject: [PATCH 2/5] Analyzer API integrated --- src/api/analyzer.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/api/analyzer.js diff --git a/src/api/analyzer.js b/src/api/analyzer.js new file mode 100644 index 0000000..3ec70c5 --- /dev/null +++ b/src/api/analyzer.js @@ -0,0 +1,27 @@ +async function AnalyzerList(payload) { + let final_response + try { + const response = await fetch('http://34.105.100.197/api/v1/analyzer/', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(payload), + }) + .then((response) => { + if (response.status==200) { + return response.json(); + } + }) + .then(data => { + console.log('API response:', data); + final_response = data + return data + }) + return final_response; + } catch (error) { + console.error("Error fetching scraper text:", error); + return []; + } + } + export default AnalyzerList; \ No newline at end of file From 187b5c8cc60c6c901cbcfd58104ec807c634ea1f Mon Sep 17 00:00:00 2001 From: PallaviKhedle Date: Thu, 26 Oct 2023 21:17:13 -0700 Subject: [PATCH 3/5] recommendation Table changes --- src/components/homePage/index.js | 39 ++++++++++++------- ...ent.js => recommendationTableComponent.js} | 11 ++---- 2 files changed, 30 insertions(+), 20 deletions(-) rename src/components/homePage/{tableComponent.js => recommendationTableComponent.js} (89%) diff --git a/src/components/homePage/index.js b/src/components/homePage/index.js index 89eb61a..65877ae 100644 --- a/src/components/homePage/index.js +++ b/src/components/homePage/index.js @@ -8,8 +8,9 @@ import MultiAlgoComparision from "../../api/multiAlgo"; import keywordList from "../../api/keyword"; import KeywordListFrame from './keywordListFrame'; import AlgoComparision from './algoComparision'; -import TableComponent from './tableComponent'; +import TableComponent from './recommendationTableComponent'; import RecommendationList from "../../api/recommendation"; +import AnalyzerList from "../../api/analyzer" function HomePage() { const [urlInput, setUrlInput] = useState(""); @@ -19,6 +20,7 @@ function HomePage() { const [keywordListData, setKeywordListData] = useState(""); const [multialgo, setMultialgo] = useState(""); const [recommendationListData, setRecommendationListData]=useState('') + const [analyzerData, setAnalyzerData]= useState(""); const [scrollPosition, setScrollPosition] = useState(0); const [scrollUp, setScrollUp] = useState(false); const [resetScroll, setResetScroll] = useState(false); @@ -58,11 +60,11 @@ function HomePage() { setSelectedAlgorithm(event.target.value); }; - const handleDownload = () => { - // const element = document.getElementById('pdf-container'); - // html2pdf(element); - window.print(); - }; + // const handleDownload = () => { + // // const element = document.getElementById('pdf-container'); + // // html2pdf(element); + // window.print(); + // }; const handleScrollUp = () => { setScrollUp(true); @@ -124,6 +126,15 @@ function HomePage() { setLoading(false); }); + const urlAnalyzerData=AnalyzerList(payload) + urlAnalyzerData.then((response) => + setAnalyzerData(response)) + .catch(error => { + console.error('API error:', error); + }) + .finally(() => { + setLoading(false); + }); }; @@ -147,7 +158,9 @@ function HomePage() { - + + +