Disable confirm button after pressing "Use It Now" button #1831

Merged
doniyor2109 merged 1 commit from master into master 2018-07-31 01:02:07 +02:00

View file

@ -1,9 +1,23 @@
// @flow
import React from 'react'; import React from 'react';
import { ipcRenderer } from 'electron'; import { ipcRenderer } from 'electron';
import { Modal } from 'modal/modal'; import { Modal } from 'modal/modal';
import Button from 'component/button'; import Button from 'component/button';
class ModalAutoUpdateDownloaded extends React.PureComponent { type Props = {
closeModal: any => any,
declineAutoUpdate: () => any,
};
class ModalAutoUpdateDownloaded extends React.PureComponent<Props> {
constructor(props: ModalProps) {
super(props);
this.state = {
disabled: false,
};
}
render() { render() {
const { closeModal, declineAutoUpdate } = this.props; const { closeModal, declineAutoUpdate } = this.props;
@ -14,7 +28,9 @@ class ModalAutoUpdateDownloaded extends React.PureComponent {
contentLabel={__('Update Downloaded')} contentLabel={__('Update Downloaded')}
confirmButtonLabel={__('Use it Now')} confirmButtonLabel={__('Use it Now')}
abortButtonLabel={__('Upgrade on Close')} abortButtonLabel={__('Upgrade on Close')}
confirmButtonDisabled={this.state.disabled}
onConfirmed={() => { onConfirmed={() => {
this.setState({ disabled: true });
ipcRenderer.send('autoUpdateAccepted'); ipcRenderer.send('autoUpdateAccepted');
}} }}
onAborted={() => { onAborted={() => {