@@ -59,10 +59,33 @@ const VoteOptions = ({ metaEvidence, votesData, complexRuling, setComplexRuling,
5959 const isSingleSelect = metaEvidence . rulingOptions . type === "single-select" ;
6060 const isMultipleSelect = metaEvidence . rulingOptions . type === "multiple-select" ;
6161 const isDateTime = metaEvidence . rulingOptions . type === "datetime" ;
62+ const isHash = metaEvidence . rulingOptions . type === "hash" ;
6263
6364 let inputComponent ;
6465
65- if ( isMultipleSelect ) {
66+ if ( isHash ) {
67+ inputComponent = (
68+ < StyledInput
69+ disabled = { ! votesData . canVote }
70+ onInput = { ( e ) => {
71+ const newValue = e . target . value ;
72+ if ( / ^ ( 0 ) ? ( [ x X ] ) ? [ 0 - 9 a - f A - F ] { 0 , 64 } $ / . test ( newValue ) ) {
73+ if ( ! / 0 { 64 } / . test ( newValue ) ) {
74+ setComplexRuling ( newValue ) ;
75+ }
76+ }
77+ } }
78+ onBlur = { ( ) => {
79+ const emptyOrUndefined = typeof complexRuling === "undefined" || complexRuling === "" ;
80+ const formatted = complexRuling ?. replace ( "0x" , "" ) . padStart ( 64 , "0" ) ;
81+ setComplexRuling ( emptyOrUndefined ? "" : `0x${ formatted } ` ) ;
82+ } }
83+ value = { complexRuling }
84+ placeholder = "0xffff...ffff"
85+ size = "large"
86+ />
87+ ) ;
88+ } else if ( isMultipleSelect ) {
6689 inputComponent = (
6790 < div style = { { paddingTop : "1rem" } } >
6891 < Checkbox . Group
@@ -382,6 +405,9 @@ export default function CaseDetailsCard({ ID }) {
382405 case "uint" :
383406 choice = complexRuling ;
384407 break ;
408+ case "hash" :
409+ choice = complexRuling ;
410+ break ;
385411 default :
386412 choice = id ;
387413 break ;
@@ -390,6 +416,7 @@ export default function CaseDetailsCard({ ID }) {
390416 case "multiple-select" :
391417 case "datetime" :
392418 case "uint" :
419+ case "hash" :
393420 choice = realitioLibQuestionFormatter . answerToBytes32 ( choice , {
394421 decimals : metaEvidence . rulingOptions . precision ,
395422 type : metaEvidence . rulingOptions . type ,
@@ -983,6 +1010,10 @@ const StyledInputNumber = styled(InputNumber)`
9831010 width: 80%;
9841011` ;
9851012
1013+ const StyledInput = styled ( Input ) `
1014+ width: 80%;
1015+ ` ;
1016+
9861017const StyledButtonsDiv = styled . div `
9871018 display: flex;
9881019 flex-wrap: wrap;
0 commit comments