-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from PALLAVIKHEDLE/main
main into scrapper
- Loading branch information
Showing
7 changed files
with
202 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import * as React from 'react'; | ||
import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, styled } from '@mui/material'; | ||
|
||
const StyledTableCell = styled(TableCell)(({ theme }) => ({ | ||
backgroundColor: '#FABB2E', | ||
color: theme.palette.common.black, | ||
padding: '8px', | ||
fontWeight: 'bold', | ||
marginRight: '3px', | ||
})); | ||
|
||
const StyledTableRow = styled(TableRow)(({ theme }) => ({ | ||
'&:nth-of-type(odd)': { | ||
backgroundColor: theme.palette.action.hover, | ||
padding: '8px', | ||
}, | ||
// hide last border | ||
'&:last-child td, &:last-child th': { | ||
border: 0, | ||
}, | ||
})); | ||
|
||
const StickyTableHead = styled(TableHead)({ | ||
position: 'sticky', | ||
top: 0, | ||
zIndex: 1, | ||
backgroundColor: '#FABB2E', | ||
}); | ||
|
||
const TableWrapper = styled('div')({ | ||
overflowY: 'auto', | ||
maxHeight: '43%', | ||
marginRight:'10%', | ||
marginTop:'5%', | ||
marginLeft: '10%' | ||
}) | ||
|
||
export default function InsightTable({ analyzerData }) { | ||
console.log('analyzerData', analyzerData); | ||
|
||
return ( | ||
<TableWrapper> | ||
<TableContainer component={Paper}> | ||
<Table aria-label="customized table"> | ||
<StickyTableHead> | ||
<TableRow> | ||
<StyledTableCell align='center'>Insights</StyledTableCell> | ||
</TableRow> | ||
</StickyTableHead> | ||
<TableBody> | ||
{analyzerData && analyzerData.pages.map((page, pageIndex) => ( | ||
// Create a new row for each warning | ||
page.warnings.map((warning, warningIndex) => ( | ||
<StyledTableRow key={`${pageIndex}-${warningIndex}`}> | ||
{warning} | ||
</StyledTableRow> | ||
)) | ||
))} | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
</TableWrapper> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<div className='scrapercontainer'> | ||
<h1 className='h1textStyle'>Scraper context for {props.url}</h1> | ||
<div className='scraperData'> | ||
<p>{props.scraperData?.scrapedContent}</p> | ||
</div> | ||
<div className='h1container'> | ||
<h1 className='h1textStyle'>Scrapper context for </h1> | ||
{props&&<h2 className='urlText'>{props?.url}</h2>} | ||
</div> | ||
|
||
{props.analyzerData&&props?.analyzerData.pages[0]?.description && | ||
<Card className='cardStyle'> | ||
<CardContent className='cardContentStyle'> | ||
Description: {props?.analyzerData.pages[0].description} | ||
</CardContent> | ||
</Card> | ||
} | ||
|
||
|
||
<div className='scraperData'> | ||
<p>{props?.scraperData?.scrapedContent}</p> | ||
</div> | ||
</div> | ||
); | ||
} | ||
export default ScraperTextFrame; | ||
export default ScraperTextFrame; |