Skip to content

Commit f447b91

Browse files
committed
updated vote delegation
1 parent 5e2800a commit f447b91

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

src/components/cards/voteDelegation.js renamed to src/components/cards/voteDelegationPanel.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import React, {useState} from 'react'
2-
import ApiCardWithModal from './apiCardWithModal'
3-
import {ModalWindowContent} from '../ui-constants'
42
import InputWithLabel from '../inputWithLabel'
53
import {
64
getCertOfNewVoteDelegation,
@@ -11,8 +9,9 @@ import {
119
getDRepNoConfidence,
1210
getVoteDelegCert,
1311
} from '../../utils/cslTools'
12+
import GovToolsPanel from './govToolsPanel'
1413

15-
const VoteDelationCard = ({api, wasm, onWaiting, onError, getters, setters}) => {
14+
const VoteDelegationPanel = ({api, wasm, onWaiting, onError, getters, setters}) => {
1615
const [currentTarget, setTarget] = useState('')
1716
const [currentStake, setStake] = useState('')
1817
const {currentDRepIdBech32, currentRegPubStakeKey, currentUnregPubStakeKey, getCertBuilder} = getters
@@ -28,7 +27,9 @@ const VoteDelationCard = ({api, wasm, onWaiting, onError, getters, setters}) =>
2827
return getCslCredentialFromBech32(wasm, input)
2928
} catch (err2) {
3029
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+
)
3233
onError()
3334
return null
3435
}
@@ -83,31 +84,29 @@ const VoteDelationCard = ({api, wasm, onWaiting, onError, getters, setters}) =>
8384
}
8485
}
8586

86-
const apiProps = {
87-
buttonLabel: 'voteDelegation',
87+
const panelProps = {
88+
certLabel: 'voteDelegation',
8889
clickFunction: buildVoteDelegationCert,
8990
}
9091

9192
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>
110109
)
111110
}
112111

113-
export default VoteDelationCard
112+
export default VoteDelegationPanel

0 commit comments

Comments
 (0)