Skip to content

Commit

Permalink
show conf modal during submit
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBenc committed Aug 3, 2020
1 parent 6f79eae commit 89e29e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
20 changes: 16 additions & 4 deletions app/frontend/actions.ts
Expand Up @@ -379,6 +379,13 @@ export default ({setState, getState}: {setState: SetStateFn; getState: GetStateF
})
}

const closeConfirmationDialog = (state) => {
setState({
keepConfirmationDialogOpen: false,
shouldShowConfirmTransactionDialog: false,
})
}

const cancelTransaction = () => ({
shouldShowConfirmTransactionDialog: false,
})
Expand Down Expand Up @@ -795,6 +802,9 @@ export default ({setState, getState}: {setState: SetStateFn; getState: GetStateF
stopLoadingAction(state, {})
return
}
setState({
keepConfirmationDialogOpen: true,
})
setTransactionSummary('stake', plan, coins)
confirmTransaction(getState(), 'convert')
stopLoadingAction(state, {})
Expand Down Expand Up @@ -1023,9 +1033,11 @@ export default ({setState, getState}: {setState: SetStateFn; getState: GetStateF
}

const submitTransaction = async (state) => {
setState({
shouldShowConfirmTransactionDialog: false,
})
if (!state.keepConfirmationDialogOpen) {
setState({
shouldShowConfirmTransactionDialog: false,
})
}
if (state.usingHwWallet) {
setState({waitingForHwWallet: true})
loadingAction(state, `Waiting for ${state.hwWalletName}...`)
Expand Down Expand Up @@ -1055,7 +1067,7 @@ export default ({setState, getState}: {setState: SetStateFn; getState: GetStateF
const address = state.sendAddress.fieldValue
const donationAmount = state.donationAmount.coins
const didDonate = address === getDonationAddress() || donationAmount > 0

closeConfirmationDialog(state)
if (didDonate) {
setState({shouldShowThanksForDonation: true})
}
Expand Down
2 changes: 2 additions & 0 deletions app/frontend/state.ts
Expand Up @@ -26,6 +26,7 @@ export interface State {
visibleAddresses: Array<any> // TODO
sendAddress: any // TODO
sendAmount: any // TODO
keepConfirmationDialogOpen: boolean

sendTransactionSummary: SendTransactionSummary

Expand Down Expand Up @@ -204,6 +205,7 @@ const initialState: State = {
},
txConfirmType: '',
txSuccessTab: '',
keepConfirmationDialogOpen: false,
}

export {initialState}
4 changes: 3 additions & 1 deletion app/public/css/styles.css
Expand Up @@ -3118,7 +3118,7 @@ input:checked + .slider:before {
left: 0;
right: 0;
bottom: 0;
z-index: 20;
z-index: 998;
display: flex;
flex-direction: column;
justify-content: center;
Expand All @@ -3133,6 +3133,7 @@ input:checked + .slider:before {
line-height: 32px;
font-weight: bold;
color: white;
z-index: 999;
}

.spinner {
Expand All @@ -3155,6 +3156,7 @@ input:checked + .slider:before {
clip: rect(24px, 40px, 40px, 0);
-webkit-animation: rotate 2s cubic-bezier(0.77, 0, 0.175, 1) infinite;
animation: rotate 2s cubic-bezier(0.77, 0, 0.175, 1) infinite;
z-index: 999;
}

.spinner span::before {
Expand Down

0 comments on commit 89e29e7

Please sign in to comment.