Skip to content

Commit

Permalink
[FLASK] Fix transaction insight data display (#16023)
Browse files Browse the repository at this point in the history
* stringify content to display

* check if data is a string to avoid stringifying it

* prettify JSON data
  • Loading branch information
GuillaumeRx authored Oct 5, 2022
1 parent 3271b81 commit ca6701c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ui/components/app/confirm-page-container/flask/index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.snap-insight {
word-wrap: break-word;

&__container__data__json {
word-wrap: break-word;
overflow-x: auto;
}
}
17 changes: 16 additions & 1 deletion ui/components/app/confirm-page-container/flask/snap-insight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit ca6701c

Please sign in to comment.