1
- import React from "react" ;
1
+ import React , { CSSProperties } from "react" ;
2
2
3
3
import ContractViewState from "../../../shared/viewState/contractViewState" ;
4
4
import ContractViewRequest from "../../../shared/messages/contractViewRequest" ;
@@ -23,6 +23,47 @@ export default function Contract({ viewState, postMessage }: Props) {
23
23
viewState . autoCompleteData . contractPaths [ hash ] ||
24
24
viewState . autoCompleteData . contractPaths [ name ] ||
25
25
[ ] ;
26
+
27
+ const [ hovering , setHovering ] = React . useState ( false ) ;
28
+
29
+ const tooltipStyle : CSSProperties = {
30
+ visibility : hovering ? "visible" : "hidden" ,
31
+ minWidth : "300px" , // adjust this value as needed or keep as 'auto'
32
+ maxWidth : "600px" , // prevent the tooltip from becoming too wide
33
+ backgroundColor : "#555" ,
34
+ color : "#fff" ,
35
+ textAlign : "center" ,
36
+ borderRadius : "6px" ,
37
+ padding : "5px" ,
38
+
39
+ /* Position the tooltip */
40
+ position : "absolute" ,
41
+ zIndex : 1 ,
42
+ bottom : "150%" /* Place tooltip above the element */ ,
43
+ left : "50%" ,
44
+ transform : "translateX(-30%)" , // Use transform to center the tooltip
45
+
46
+ opacity : hovering ? 1 : 0 ,
47
+ transition : "opacity 0.3s" ,
48
+ } ;
49
+
50
+ const iconStyle : CSSProperties = {
51
+ position : "relative" ,
52
+ display : "inline-flex" ,
53
+ justifyContent : "center" ,
54
+ alignItems : "center" ,
55
+ width : "15px" ,
56
+ height : "15px" ,
57
+ cursor : "pointer" ,
58
+ fontSize : "12px" ,
59
+ fontWeight : "bold" ,
60
+ borderRadius : "50%" ,
61
+ backgroundColor : hovering ? "grey" : "white" ,
62
+ color : "black" ,
63
+ transition : "background-color 0.3s" ,
64
+ marginLeft : "5px" ,
65
+ } ;
66
+
26
67
return (
27
68
< div style = { { padding : 10 } } >
28
69
< h1 > { name } </ h1 >
@@ -57,6 +98,32 @@ export default function Contract({ viewState, postMessage }: Props) {
57
98
< em > — click to copy contract hash to clipboard</ em >
58
99
</ div >
59
100
</ p >
101
+ < p style = { { paddingLeft : 20 } } >
102
+ < div style = { { fontWeight : "bold" , marginBottom : 10 , marginTop : 15 } } >
103
+ < span > Hash (reversed):</ span >
104
+ < span
105
+ style = { iconStyle }
106
+ onMouseEnter = { ( ) => setHovering ( true ) }
107
+ onMouseLeave = { ( ) => setHovering ( false ) }
108
+ >
109
+ ?
110
+ < span style = { tooltipStyle } >
111
+ Various tools in the Neo N3 ecosystem expect different byte order
112
+ for contract hash strings. Please check the byte order expected by
113
+ the tools you are using.
114
+ </ span >
115
+ </ span >
116
+ </ div >
117
+ < div
118
+ style = { { cursor : "pointer" , paddingLeft : 20 } }
119
+ onClick = { ( ) => postMessage ( { copyHash : true , reverse : true } ) }
120
+ >
121
+ < strong >
122
+ < Hash hash = { hash } reverse = { true } />
123
+ </ strong > { " " }
124
+ < em > — click to copy contract hash to clipboard</ em >
125
+ </ div >
126
+ </ p >
60
127
{ ! ! supportedStandards . length && (
61
128
< p style = { { paddingLeft : 20 } } >
62
129
< div style = { { fontWeight : "bold" , marginBottom : 10 , marginTop : 15 } } >
0 commit comments