This commit is contained in:
Jacob Evans
2019-02-19 13:09:05 -08:00
parent c16e62b5bf
commit 5acdab849e
2 changed files with 22 additions and 18 deletions

View File

@@ -9,15 +9,10 @@ interface LedgerSignNoteProps {
isVisible: boolean;
}
export const LedgerSignNote: React.StatelessComponent<LedgerSignNoteProps> = ({
text,
isVisible,
}) => {
export const LedgerSignNote: React.StatelessComponent<LedgerSignNoteProps> = ({ text, isVisible }) => {
return (
<Wrapper isVisible={isVisible}>
<Text>
{text}
</Text>
<Text>{text}</Text>
</Wrapper>
);
};
@@ -27,7 +22,7 @@ LedgerSignNote.defaultProps = {
};
const Wrapper = styled.div<LedgerSignNoteProps>`
background-color: #7A7A7A;
background-color: #7a7a7a;
display: flex;
align-items: center;
padding: 28px 30px;
@@ -38,8 +33,8 @@ const Wrapper = styled.div<LedgerSignNoteProps>`
left: 0;
right: 0;
justify-content: center;
opacity: ${props => props.isVisible ? 1 : 0};
visibility: ${props => props.isVisible ? 'visible' : 'hidden'};
opacity: ${props => (props.isVisible ? 1 : 0)};
visibility: ${props => (props.isVisible ? 'visible' : 'hidden')};
`;
const Text = styled.p`

View File

@@ -188,7 +188,10 @@ export class VoteForm extends React.Component<Props> {
Back
</Button>
<ButtonDisabled disabled={!votePreference}>Submit</ButtonDisabled>
<LedgerSignNote text={'Accept or reject signature on the Ledger'} isVisible={isAwaitingLedgerSignature} />
<LedgerSignNote
text={'Accept or reject signature on the Ledger'}
isVisible={isAwaitingLedgerSignature}
/>
</ButtonRow>
</Form>
);
@@ -233,7 +236,13 @@ export class VoteForm extends React.Component<Props> {
try {
const signedVote = await this._signVoteAsync(makerAddress, typedData);
// Store the signed vote
this.setState(prevState => ({ ...prevState, signedVote, voteHash: voteHashHex, isSuccessful: true, isAwaitingLedgerSignature: false }));
this.setState(prevState => ({
...prevState,
signedVote,
voteHash: voteHashHex,
isSuccessful: true,
isAwaitingLedgerSignature: false,
}));
const voteDomain = utils.isProduction() ? `https://${configs.DOMAIN_VOTE}` : 'http://localhost:3000';
const voteEndpoint = `${voteDomain}/v1/vote`;
@@ -267,12 +276,12 @@ export class VoteForm extends React.Component<Props> {
onError
? onError(errorMessage)
: this.setState({
errors: {
signError: errorMessage,
},
isSuccessful: false,
isAwaitingLedgerSignature: false,
});
errors: {
signError: errorMessage,
},
isSuccessful: false,
isAwaitingLedgerSignature: false,
});
this.setState({
isAwaitingLedgerSignature: false,
});