lbry-desktop/ui/modal/modalAutoUpdateDownloaded/view.jsx
2019-11-11 13:27:29 -05:00

58 lines
1.4 KiB
JavaScript

// @flow
import React from 'react';
// @if TARGET='app'
import { ipcRenderer } from 'electron';
// @endif
import { Modal } from 'modal/modal';
import Button from 'component/button';
type Props = {
closeModal: any => any,
declineAutoUpdate: () => any,
};
type State = {
disabled: boolean,
};
class ModalAutoUpdateDownloaded extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
disabled: false,
};
}
render() {
const { closeModal, declineAutoUpdate } = this.props;
return (
<Modal
isOpen
type="confirm"
contentLabel={__('Upgrade Downloaded')}
title={__('LBRY Leveled Up')}
confirmButtonLabel={__('Upgrade Now')}
abortButtonLabel={__('Not now')}
confirmButtonDisabled={this.state.disabled}
onConfirmed={() => {
this.setState({ disabled: true });
ipcRenderer.send('autoUpdateAccepted');
}}
onAborted={() => {
declineAutoUpdate();
closeModal();
}}
>
<p>{__('A new version of LBRY is ready for you.')}</p>
<p className="help">
{__('Want to know what has changed?')} See the{' '}
<Button button="link" label={__('release notes')} href="https://github.com/lbryio/lbry-desktop/releases" />.
</p>
</Modal>
);
}
}
export default ModalAutoUpdateDownloaded;