lbry-desktop/src/renderer/modal/modalDownloading/view.jsx

75 lines
2.1 KiB
React
Raw Normal View History

2018-09-26 19:48:07 +02:00
// @flow
import React from 'react';
import { Modal } from 'modal/modal';
import { Line } from 'rc-progress';
2018-03-26 23:32:43 +02:00
import Button from 'component/button';
2017-04-07 07:15:22 +02:00
2018-09-26 19:48:07 +02:00
type Props = {
downloadProgress: ?number,
downloadComplete: boolean,
downloadItem: string,
startUpgrade: () => void,
cancelUpgrade: () => void,
};
class ModalDownloading extends React.PureComponent<Props> {
2017-04-07 07:15:22 +02:00
render() {
const {
downloadProgress,
downloadComplete,
downloadItem,
startUpgrade,
cancelUpgrade,
} = this.props;
2017-04-07 07:15:22 +02:00
return (
2018-09-26 19:48:07 +02:00
<Modal
title={__('Downloading Update')}
isOpen
contentLabel={__('Downloading Update')}
type="custom"
>
<section className="card__content">
{downloadProgress ? `${downloadProgress}% ${__('complete')}` : null}
<Line percent={downloadProgress || 0} strokeWidth="4" />
2017-11-24 15:31:05 +01:00
{downloadComplete ? (
2018-09-26 19:48:07 +02:00
<React.Fragment>
<p>{__('Click "Begin Upgrade" to start the upgrade process.')}</p>
<p>
{__(
'The app will close, and you will be prompted to install the latest version of LBRY.'
)}
</p>
<p>
{__(
'To launch installation manually, close LBRY and run the command below in the terminal.'
)}
</p>
<blockquote>sudo dpkg -i {downloadItem}</blockquote>
<p>{__('After the install is complete, please reopen the app.')}</p>
</React.Fragment>
) : null}
<div className="modal__buttons">
{downloadComplete ? (
<Button
button="primary"
label={__('Begin Upgrade')}
className="modal__button"
onClick={startUpgrade}
/>
) : null}
2018-03-26 23:32:43 +02:00
<Button
2018-09-26 19:48:07 +02:00
button="link"
label={__('Cancel')}
2017-11-24 15:31:05 +01:00
className="modal__button"
2018-09-26 19:48:07 +02:00
onClick={cancelUpgrade}
2017-11-24 15:31:05 +01:00
/>
2018-09-26 19:48:07 +02:00
</div>
</section>
2017-04-07 07:15:22 +02:00
</Modal>
2017-06-06 23:19:12 +02:00
);
2017-04-07 07:15:22 +02:00
}
}
2017-07-02 20:23:38 +02:00
export default ModalDownloading;