Skip to content

Commit 8dd4305

Browse files
committed
fix: styling issues
1 parent a485575 commit 8dd4305

File tree

1 file changed

+33
-17
lines changed

1 file changed

+33
-17
lines changed

src/mqueryfront/src/components/ActionShowMatchContext.js

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,29 @@ const useClickOutside = (ref, callback) => {
2525
};
2626

2727
function base64ToHex(str64) {
28-
return atob(str64)
29-
.split("")
30-
.map(function (aChar) {
31-
return ("0" + aChar.charCodeAt(0).toString(16)).slice(-2);
32-
})
33-
.join("")
34-
.toUpperCase(); // Per your example output
28+
return (
29+
atob(str64)
30+
.split("")
31+
.map(function (aChar) {
32+
return ("0" + aChar.charCodeAt(0).toString(16)).slice(-2);
33+
})
34+
.join(" ")
35+
.toUpperCase() + " "
36+
);
37+
}
38+
39+
function base64ToUtf8(str64) {
40+
return (
41+
atob(str64)
42+
.split("")
43+
.map(function (aChar) {
44+
if (32 <= aChar.charCodeAt(0) && aChar.charCodeAt(0) < 127) {
45+
return aChar;
46+
}
47+
return ".";
48+
})
49+
.join(" ") + " "
50+
);
3551
}
3652

3753
const ActionShowMatchContext = (props) => {
@@ -66,21 +82,21 @@ const ActionShowMatchContext = (props) => {
6682
</td>
6783
<td
6884
scope="row"
69-
className="text-monospace"
70-
style={{ width: "25%" }}
85+
className="text-monospace text-break"
86+
style={{ width: "45%" }}
7187
>
72-
{atob(foundSample["before"])}
73-
{<b>{atob(foundSample["matching"])}</b>}
74-
{atob(foundSample["after"])}
88+
{base64ToHex(foundSample["before"])}
89+
{<b>{base64ToHex(foundSample["matching"])}</b>}
90+
{base64ToHex(foundSample["after"])}
7591
</td>
7692
<td
7793
scope="row"
78-
className="text-monospace"
79-
style={{ width: "50%" }}
94+
className="text-monospace text-break"
95+
style={{ width: "30%" }}
8096
>
81-
{base64ToHex(foundSample["before"])}
82-
{<b>{base64ToHex(foundSample["matching"])}</b>}
83-
{base64ToHex(foundSample["after"])}
97+
{base64ToUtf8(foundSample["before"])}
98+
{<b>{base64ToUtf8(foundSample["matching"])}</b>}
99+
{base64ToUtf8(foundSample["after"])}
84100
</td>
85101
</>
86102
);

0 commit comments

Comments
 (0)