From 42a3759cc05e83691be980209edf184e78cdd443 Mon Sep 17 00:00:00 2001 From: Aliyev Doniyor Date: Sat, 28 Jul 2018 12:47:45 +0500 Subject: [PATCH] Disable confirm button after pressing "Use It Now" button Closes #1823 --- .../modal/modalAutoUpdateDownloaded/view.jsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/renderer/modal/modalAutoUpdateDownloaded/view.jsx b/src/renderer/modal/modalAutoUpdateDownloaded/view.jsx index 544eb4f02..c10eace7a 100644 --- a/src/renderer/modal/modalAutoUpdateDownloaded/view.jsx +++ b/src/renderer/modal/modalAutoUpdateDownloaded/view.jsx @@ -1,9 +1,23 @@ +// @flow import React from 'react'; import { ipcRenderer } from 'electron'; import { Modal } from 'modal/modal'; import Button from 'component/button'; -class ModalAutoUpdateDownloaded extends React.PureComponent { +type Props = { + closeModal: any => any, + declineAutoUpdate: () => any, +}; + +class ModalAutoUpdateDownloaded extends React.PureComponent { + constructor(props: ModalProps) { + super(props); + + this.state = { + disabled: false, + }; + } + render() { const { closeModal, declineAutoUpdate } = this.props; @@ -14,7 +28,9 @@ class ModalAutoUpdateDownloaded extends React.PureComponent { contentLabel={__('Update Downloaded')} confirmButtonLabel={__('Use it Now')} abortButtonLabel={__('Upgrade on Close')} + confirmButtonDisabled={this.state.disabled} onConfirmed={() => { + this.setState({ disabled: true }); ipcRenderer.send('autoUpdateAccepted'); }} onAborted={() => { -- 2.45.3