lbry-desktop/ui/modal/modalAutoUpdateDownloaded/view.jsx

46 lines
1 KiB
React
Raw Permalink Normal View History

// @flow
import React, { useState } from 'react';
2019-03-05 05:46:57 +01:00
// @if TARGET='app'
2018-04-17 00:51:35 +02:00
import { ipcRenderer } from 'electron';
2019-03-05 05:46:57 +01:00
// @endif
2018-02-24 01:24:00 +01:00
import { Modal } from 'modal/modal';
import LastReleaseChanges from 'component/lastReleaseChanges';
2017-12-08 11:08:50 +01:00
type Props = {
closeModal: any => any,
declineAutoUpdate: () => any,
};
const ModalAutoUpdateDownloaded = (props: Props) => {
const { closeModal, declineAutoUpdate } = props;
const [disabled, setDisabled] = useState(false);
const handleConfirm = () => {
setDisabled(true);
ipcRenderer.send('autoUpdateAccepted');
};
const handleAbort = () => {
declineAutoUpdate();
closeModal();
};
2017-12-22 07:42:04 +01:00
return (
<Modal
isOpen
type="confirm"
contentLabel={__('Upgrade Downloaded')}
title={__('LBRY leveled up')}
confirmButtonLabel={__('Upgrade Now')}
abortButtonLabel={__('Not Now')}
confirmButtonDisabled={disabled}
onConfirmed={handleConfirm}
onAborted={handleAbort}
>
<LastReleaseChanges />
</Modal>
);
};
2017-12-08 11:08:50 +01:00
export default ModalAutoUpdateDownloaded;