1
1
import React , { useState } from 'react'
2
- import ApiCardWithModal from './apiCardWithModal'
3
- import { ModalWindowContent } from '../ui-constants'
4
2
import InputWithLabel from '../inputWithLabel'
5
3
import {
6
4
getCertOfNewVoteDelegation ,
@@ -11,8 +9,9 @@ import {
11
9
getDRepNoConfidence ,
12
10
getVoteDelegCert ,
13
11
} from '../../utils/cslTools'
12
+ import GovToolsPanel from './govToolsPanel'
14
13
15
- const VoteDelationCard = ( { api, wasm, onWaiting, onError, getters, setters} ) => {
14
+ const VoteDelegationPanel = ( { api, wasm, onWaiting, onError, getters, setters} ) => {
16
15
const [ currentTarget , setTarget ] = useState ( '' )
17
16
const [ currentStake , setStake ] = useState ( '' )
18
17
const { currentDRepIdBech32, currentRegPubStakeKey, currentUnregPubStakeKey, getCertBuilder} = getters
@@ -28,7 +27,9 @@ const VoteDelationCard = ({api, wasm, onWaiting, onError, getters, setters}) =>
28
27
return getCslCredentialFromBech32 ( wasm , input )
29
28
} catch ( err2 ) {
30
29
onWaiting ( false )
31
- console . error ( `Error in parsing credential, not Hex or Bech32: ${ JSON . stringify ( err1 ) } , ${ JSON . stringify ( err2 ) } ` )
30
+ console . error (
31
+ `Error in parsing credential, not Hex or Bech32: ${ JSON . stringify ( err1 ) } , ${ JSON . stringify ( err2 ) } ` ,
32
+ )
32
33
onError ( )
33
34
return null
34
35
}
@@ -83,31 +84,29 @@ const VoteDelationCard = ({api, wasm, onWaiting, onError, getters, setters}) =>
83
84
}
84
85
}
85
86
86
- const apiProps = {
87
- buttonLabel : 'voteDelegation' ,
87
+ const panelProps = {
88
+ certLabel : 'voteDelegation' ,
88
89
clickFunction : buildVoteDelegationCert ,
89
90
}
90
91
91
92
return (
92
- < ApiCardWithModal { ...apiProps } >
93
- < div className = { ModalWindowContent . contentPadding } >
94
- < InputWithLabel
95
- inputName = "Target of vote delegation | abstain | no confidence"
96
- inputValue = { currentDRepIdBech32 }
97
- onChangeFunction = { ( event ) => {
98
- setTarget ( event . target . value )
99
- } }
100
- />
101
- < InputWithLabel
102
- inputName = "Stake credential"
103
- inputValue = { currentRegPubStakeKey . length > 0 ? currentRegPubStakeKey : currentUnregPubStakeKey }
104
- onChangeFunction = { ( event ) => {
105
- setStake ( event . target . value )
106
- } }
107
- />
108
- </ div >
109
- </ ApiCardWithModal >
93
+ < GovToolsPanel { ...panelProps } >
94
+ < InputWithLabel
95
+ inputName = "Target of vote delegation | abstain | no confidence"
96
+ inputValue = { currentDRepIdBech32 }
97
+ onChangeFunction = { ( event ) => {
98
+ setTarget ( event . target . value )
99
+ } }
100
+ />
101
+ < InputWithLabel
102
+ inputName = "Stake credential"
103
+ inputValue = { currentRegPubStakeKey . length > 0 ? currentRegPubStakeKey : currentUnregPubStakeKey }
104
+ onChangeFunction = { ( event ) => {
105
+ setStake ( event . target . value )
106
+ } }
107
+ />
108
+ </ GovToolsPanel >
110
109
)
111
110
}
112
111
113
- export default VoteDelationCard
112
+ export default VoteDelegationPanel
0 commit comments