1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 20:02:58 +01:00

[FLASK] Fix transaction insight data display (#16023)

* stringify content to display

* check if data is a string to avoid stringifying it

* prettify JSON data
This commit is contained in:
Guillaume Roux 2022-10-05 19:43:44 +02:00 committed by GitHub
parent 3271b812e3
commit ca6701c27e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,8 @@
.snap-insight {
word-wrap: break-word;
&__container__data__json {
word-wrap: break-word;
overflow-x: auto;
}
}

View File

@ -64,7 +64,22 @@ export const SnapInsight = ({ transaction, chainId, selectedSnap }) => {
>
{key}
</Typography>
<Typography variant={TYPOGRAPHY.H6}>{data[key]}</Typography>
{typeof data[key] === 'string' ? (
<Typography variant={TYPOGRAPHY.H6}>
{data[key]}
</Typography>
) : (
<Box
className="snap-insight__container__data__json"
backgroundColor={COLORS.BACKGROUND_ALTERNATIVE}
padding={3}
>
<Typography variant={TYPOGRAPHY.H7}>
<pre>{JSON.stringify(data[key], null, 2)}</pre>
</Typography>
</Box>
)}
</div>
))}
</Box>