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

91 lines
2.8 KiB
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// @flow
2020-07-23 19:02:07 +02:00
import * as PAGES from 'constants/pages';
2018-03-26 23:32:43 +02:00
import React from 'react';
import { Modal } from 'modal/modal';
import ClaimPreview from 'component/claimPreview';
2019-11-01 18:27:01 +01:00
import Button from 'component/button';
2020-02-11 19:19:09 +01:00
import Card from 'component/common/card';
import Nag from 'component/common/nag';
2018-03-26 23:32:43 +02:00
type Props = {
closeModal: () => void,
clearPublish: () => void,
navigate: string => void,
uri: string,
isEdit: boolean,
2019-11-01 18:27:01 +01:00
filePath: ?string,
lbryFirstError: ?string,
2018-03-26 23:32:43 +02:00
};
2019-04-10 23:27:12 +02:00
class ModalPublishSuccess extends React.PureComponent<Props> {
2018-03-26 23:32:43 +02:00
render() {
const { closeModal, clearPublish, navigate, uri, isEdit, filePath, lbryFirstError } = this.props;
const contentLabel = isEdit ? __('Update published') : __('File published');
const publishMessage = isEdit
? __('Your update is now pending on LBRY. It will take a few minutes to appear for other users.')
: __('Your file is now pending on LBRY. It will take a few minutes to appear for other users.');
2018-03-26 23:32:43 +02:00
2020-02-11 19:19:09 +01:00
function handleClose() {
clearPublish();
closeModal();
}
2018-03-26 23:32:43 +02:00
return (
2020-02-11 19:19:09 +01:00
<Modal isOpen type="card" contentLabel={__(contentLabel)} onAborted={handleClose}>
<Card
title={__('Success')}
subtitle={publishMessage}
2020-02-11 19:19:09 +01:00
body={
<React.Fragment>
<div className="card--inline">
<ClaimPreview type="small" uri={uri} />
</div>
{filePath && !IS_WEB && (
<p className="help">
<React.Fragment>
{__(
`Upload will continue in the background, please do not shut down immediately. Leaving the app running helps the network, thank you!`
)}{' '}
<Button button="link" href="https://lbry.com/faq/host-content" label={__('Learn More')} />
</React.Fragment>
</p>
)}
</React.Fragment>
}
actions={
2020-04-29 23:37:14 +02:00
<div className="section__actions">
2020-02-11 19:19:09 +01:00
<Button
button="primary"
2020-07-23 19:11:53 +02:00
label={__('View My Uploads')}
2020-02-11 19:19:09 +01:00
onClick={() => {
clearPublish();
2020-07-23 19:02:07 +02:00
navigate(`/$/${PAGES.UPLOADS}`);
2020-02-11 19:19:09 +01:00
closeModal();
}}
/>
<Button button="link" label={__('Close')} onClick={handleClose} />
2020-04-02 23:34:48 +02:00
</div>
2020-02-11 19:19:09 +01:00
}
nag={
lbryFirstError && (
<Nag
relative
type="error"
message={
<span>
{__('Your file was published to LBRY, but the YouTube upload failed.')}
<br />
{lbryFirstError}
</span>
}
/>
)
}
2020-02-11 19:19:09 +01:00
/>
2018-03-26 23:32:43 +02:00
</Modal>
);
}
}
2019-04-10 23:27:12 +02:00
export default ModalPublishSuccess;