Merge pull request #945 from getmaxun/drender-fix

fix: crawl and search data rendering
This commit is contained in:
Karishma Shukla
2026-01-22 18:56:01 +05:30
committed by GitHub

View File

@@ -1255,7 +1255,11 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
{key} {key}
</TableCell> </TableCell>
<TableCell sx={{ wordBreak: 'break-word' }}> <TableCell sx={{ wordBreak: 'break-word' }}>
{value === undefined || value === '' ? '-' : String(value)} {value === undefined || value === ''
? '-'
: typeof value === 'object'
? JSON.stringify(value)
: String(value)}
</TableCell> </TableCell>
</TableRow> </TableRow>
)) ))
@@ -1294,7 +1298,9 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
m: 0 m: 0
}} }}
> >
{crawlData[0][currentCrawlIndex].text} {typeof crawlData[0][currentCrawlIndex].text === 'object'
? JSON.stringify(crawlData[0][currentCrawlIndex].text, null, 2)
: crawlData[0][currentCrawlIndex].text}
</Typography> </Typography>
</Paper> </Paper>
</AccordionDetails> </AccordionDetails>
@@ -1329,33 +1335,41 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
m: 0 m: 0
}} }}
> >
{crawlData[0][currentCrawlIndex].html} {typeof crawlData[0][currentCrawlIndex].html === 'object'
? JSON.stringify(crawlData[0][currentCrawlIndex].html, null, 2)
: crawlData[0][currentCrawlIndex].html}
</Typography> </Typography>
</Paper> </Paper>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
)} )}
{crawlData[0][currentCrawlIndex].links && crawlData[0][currentCrawlIndex].links.length > 0 && ( {(() => {
<Accordion defaultExpanded sx={{ mb: 2 }}> const validLinks = crawlData[0][currentCrawlIndex].links?.filter((link: any) =>
<AccordionSummary expandIcon={<ExpandMoreIcon />}> typeof link === 'string' && link.trim() !== ''
<Box sx={{ display: 'flex', alignItems: 'center' }}> ) || [];
<Typography variant='h6'>
Links ({crawlData[0][currentCrawlIndex].links.length}) return validLinks.length > 0 && (
</Typography> <Accordion defaultExpanded sx={{ mb: 2 }}>
</Box> <AccordionSummary expandIcon={<ExpandMoreIcon />}>
</AccordionSummary> <Box sx={{ display: 'flex', alignItems: 'center' }}>
<AccordionDetails> <Typography variant='h6'>
<Paper sx={{ maxHeight: 200, overflow: 'auto', p: 1 }}> Links ({validLinks.length})
{crawlData[0][currentCrawlIndex].links.map((link: string, idx: number) => (
<Typography key={idx} sx={{ fontSize: '0.75rem', mb: 0.5 }}>
{link}
</Typography> </Typography>
))} </Box>
</Paper> </AccordionSummary>
</AccordionDetails> <AccordionDetails>
</Accordion> <Paper sx={{ maxHeight: 200, overflow: 'auto', p: 1 }}>
)} {validLinks.map((link: string, idx: number) => (
<Typography key={idx} sx={{ fontSize: '0.75rem', mb: 0.5 }}>
{link}
</Typography>
))}
</Paper>
</AccordionDetails>
</Accordion>
);
})()}
<Box sx={{ display: 'flex', gap: 2, mt: 2 }}> <Box sx={{ display: 'flex', gap: 2, mt: 2 }}>
<Button <Button
@@ -1499,7 +1513,11 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
{key} {key}
</TableCell> </TableCell>
<TableCell sx={{ wordBreak: 'break-word' }}> <TableCell sx={{ wordBreak: 'break-word' }}>
{value === undefined || value === '' ? '-' : String(value)} {value === undefined || value === ''
? '-'
: typeof value === 'object'
? JSON.stringify(value)
: String(value)}
</TableCell> </TableCell>
</TableRow> </TableRow>
)) ))
@@ -1573,7 +1591,9 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
m: 0 m: 0
}} }}
> >
{searchData[currentSearchIndex].html} {typeof searchData[currentSearchIndex].html === 'object'
? JSON.stringify(searchData[currentSearchIndex].html, null, 2)
: searchData[currentSearchIndex].html}
</Typography> </Typography>
</Paper> </Paper>
</AccordionDetails> </AccordionDetails>
@@ -1608,33 +1628,63 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
m: 0 m: 0
}} }}
> >
{searchData[currentSearchIndex].markdown} {typeof searchData[currentSearchIndex].markdown === 'object'
? JSON.stringify(searchData[currentSearchIndex].markdown, null, 2)
: searchData[currentSearchIndex].markdown}
</Typography> </Typography>
</Paper> </Paper>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
)} )}
{searchData[currentSearchIndex].links && searchData[currentSearchIndex].links.length > 0 && ( {(() => {
<Accordion defaultExpanded sx={{ mb: 2 }}> const validLinks = searchData[currentSearchIndex].links?.filter((link: any) =>
<AccordionSummary expandIcon={<ExpandMoreIcon />}> typeof link === 'string' && link.trim() !== ''
<Box sx={{ display: 'flex', alignItems: 'center' }}> ) || [];
<Typography variant='h6'>
Links ({searchData[currentSearchIndex].links.length}) return validLinks.length > 0 && (
</Typography> <Accordion sx={{ mb: 2 }}>
</Box> <AccordionSummary expandIcon={<ExpandMoreIcon />}>
</AccordionSummary> <Box sx={{ display: 'flex', alignItems: 'center' }}>
<AccordionDetails> <Typography variant='h6'>
<Paper sx={{ maxHeight: 200, overflow: 'auto', p: 1 }}> Links ({validLinks.length})
{searchData[currentSearchIndex].links.map((link: string, idx: number) => (
<Typography key={idx} sx={{ fontSize: '0.75rem', mb: 0.5 }}>
{link}
</Typography> </Typography>
))} </Box>
</AccordionSummary>
<AccordionDetails>
<Paper
sx={{
p: 2,
maxHeight: '300px',
overflow: 'auto',
backgroundColor: darkMode ? '#1e1e1e' : '#f5f5f5'
}}
>
{validLinks.map((link: string, linkIdx: number) => {
return (
<Box key={linkIdx} sx={{ mb: 0.5 }}>
<Link
href={link}
target="_blank"
rel="noopener noreferrer"
sx={{
color: '#FF00C3',
textDecoration: 'none',
fontSize: '0.75rem',
'&:hover': { textDecoration: 'underline' },
wordBreak: 'break-all'
}}
>
{link}
</Link>
</Box>
);
})}
</Paper> </Paper>
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
)} );
})()}
<Box sx={{ display: 'flex', alignItems: 'center', mt: 2 }}> <Box sx={{ display: 'flex', alignItems: 'center', mt: 2 }}>
<Button <Button