feat: display screenshots

This commit is contained in:
karishmas6
2024-10-16 14:53:59 +05:30
parent 8b26ba17a7
commit bc08759cec

View File

@@ -184,19 +184,16 @@ export const RunContent = ({ row, currentLog, interpretationInProgress, logEndRe
Binary output</Typography> Binary output</Typography>
{Object.keys(row.binaryOutput).map((key) => { {Object.keys(row.binaryOutput).map((key) => {
try { try {
const binaryBuffer = JSON.parse(row.binaryOutput[key].data); const imageUrl = row.binaryOutput[key];
const b64 = Buffer.from(binaryBuffer.data).toString('base64');
return ( return (
<Box key={`number-of-binary-output-${key}`} sx={{ <Box key={`number-of-binary-output-${key}`} sx={{
width: 'max-content', width: 'max-content',
}}> }}>
<Typography key={`binary-output-key-${key}`}> <Typography key={`binary-output-key-${key}`}>
{key}: {key}:
<a href={`data:${row.binaryOutput[key].mimetype};base64,${b64}`} <a href={imageUrl} download={key} style={{ margin: '10px' }}>Download</a>
download={key} style={{ margin: '10px' }}>Download</a>
</Typography> </Typography>
<img key={`image-${key}`} src={`data:${row.binaryOutput[key].mimetype};base64,${b64}`} <img key={`image-${key}`} src={imageUrl} alt={key} height='auto' width='700px' />
alt={key} height='auto' width='700px' />
</Box> </Box>
) )
} catch (e) { } catch (e) {