2018-09-26 19:48:07 +02:00
|
|
|
// @flow
|
2017-12-21 22:08:54 +01:00
|
|
|
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,
|
2022-03-03 02:09:21 +01:00
|
|
|
upgradeInitialized: boolean,
|
|
|
|
failedInstallation: boolean,
|
2018-09-26 19:48:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class ModalDownloading extends React.PureComponent<Props> {
|
2017-04-07 07:15:22 +02:00
|
|
|
render() {
|
2022-03-03 02:09:21 +01:00
|
|
|
const {
|
|
|
|
downloadProgress,
|
|
|
|
downloadComplete,
|
|
|
|
downloadItem,
|
|
|
|
startUpgrade,
|
|
|
|
cancelUpgrade,
|
|
|
|
upgradeInitialized,
|
|
|
|
failedInstallation,
|
|
|
|
} = this.props;
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
return (
|
2020-08-26 22:28:33 +02:00
|
|
|
<Modal title={__('Downloading update')} isOpen contentLabel={__('Downloading update')} type="custom">
|
2019-07-21 23:31:22 +02:00
|
|
|
{downloadProgress ? `${downloadProgress}% ${__('complete')}` : null}
|
|
|
|
<Line percent={downloadProgress || 0} strokeWidth="4" />
|
|
|
|
{downloadComplete ? (
|
|
|
|
<React.Fragment>
|
|
|
|
<p>{__('Click "Begin Upgrade" to start the upgrade process.')}</p>
|
2019-11-20 04:29:24 +01:00
|
|
|
<p>
|
|
|
|
{__(
|
|
|
|
'The app will close (if not, quit with CTRL-Q), and you will be prompted to install the latest version of LBRY.'
|
|
|
|
)}
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
{__('To launch installation manually, close LBRY (CTRL-Q) and run the command below in the terminal.')}
|
|
|
|
</p>
|
2019-07-21 23:31:22 +02:00
|
|
|
<blockquote>sudo dpkg -i {downloadItem}</blockquote>
|
|
|
|
<p>{__('After the install is complete, please reopen the app.')}</p>
|
2020-01-15 05:34:28 +01:00
|
|
|
<p>
|
|
|
|
{__('Note: You can also install the AppImage version for streamlined updates.')}{' '}
|
2020-01-16 23:03:41 +01:00
|
|
|
<Button button="link" label={__('Download here.')} href="https://lbry.com/get/lbry.AppImage" />
|
2020-01-15 05:34:28 +01:00
|
|
|
</p>
|
2019-07-21 23:31:22 +02:00
|
|
|
</React.Fragment>
|
|
|
|
) : null}
|
2019-01-14 19:40:06 +01:00
|
|
|
|
2022-03-03 02:09:21 +01:00
|
|
|
{failedInstallation && <p>{__('There was an error during installation. Please, try again.')}</p>}
|
|
|
|
|
2019-01-14 19:40:06 +01:00
|
|
|
<div className="card__actions">
|
2022-03-03 02:09:21 +01:00
|
|
|
{downloadComplete ? (
|
|
|
|
<Button
|
|
|
|
disabled={upgradeInitialized}
|
|
|
|
button="primary"
|
|
|
|
label={__(upgradeInitialized ? 'Installing, please wait...' : 'Begin Upgrade')}
|
|
|
|
onClick={startUpgrade}
|
|
|
|
/>
|
|
|
|
) : null}
|
|
|
|
<Button disabled={upgradeInitialized} button="link" label={__('Cancel')} onClick={cancelUpgrade} />
|
2019-01-14 19:40:06 +01:00
|
|
|
</div>
|
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;
|