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';
|
2019-10-23 21:39:51 +02:00
|
|
|
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';
|
2020-07-09 16:58:43 +02:00
|
|
|
import Nag from 'component/common/nag';
|
2018-03-26 23:32:43 +02:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
closeModal: () => void,
|
|
|
|
clearPublish: () => void,
|
2021-03-24 06:22:02 +01:00
|
|
|
navigate: (string) => void,
|
2018-03-26 23:32:43 +02:00
|
|
|
uri: string,
|
2019-06-26 03:18:05 +02:00
|
|
|
isEdit: boolean,
|
2019-11-01 18:27:01 +01:00
|
|
|
filePath: ?string,
|
2020-07-09 16:58:43 +02:00
|
|
|
lbryFirstError: ?string,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
|
|
|
|
2019-04-10 23:27:12 +02:00
|
|
|
class ModalPublishSuccess extends React.PureComponent<Props> {
|
2021-04-03 21:31:57 +02:00
|
|
|
componentDidMount() {
|
|
|
|
const { clearPublish } = this.props;
|
|
|
|
clearPublish();
|
|
|
|
}
|
2018-03-26 23:32:43 +02:00
|
|
|
render() {
|
2021-10-19 06:49:51 +02:00
|
|
|
const { closeModal, clearPublish, navigate, uri, isEdit, filePath, lbryFirstError } = this.props;
|
2021-03-24 06:22:02 +01:00
|
|
|
// $FlowFixMe
|
|
|
|
let contentLabel;
|
2021-10-19 06:49:51 +02:00
|
|
|
if (isEdit) {
|
2021-03-24 06:22:02 +01:00
|
|
|
contentLabel = __('Update published');
|
|
|
|
} else {
|
|
|
|
contentLabel = __('File published');
|
|
|
|
}
|
|
|
|
|
|
|
|
let publishMessage;
|
|
|
|
if (isEdit) {
|
|
|
|
publishMessage = __('Your update is now pending. It will take a few minutes to appear for other users.');
|
|
|
|
} else {
|
2021-07-20 18:44:15 +02:00
|
|
|
publishMessage = __('Your content will be live shortly.');
|
2021-03-24 06:22:02 +01:00
|
|
|
}
|
2018-03-26 23:32:43 +02:00
|
|
|
|
2020-02-11 19:19:09 +01:00
|
|
|
function handleClose() {
|
|
|
|
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
|
2021-10-19 06:49:51 +02:00
|
|
|
title={__('Success')}
|
2020-06-12 06:57:36 +02:00
|
|
|
subtitle={publishMessage}
|
2020-02-11 19:19:09 +01:00
|
|
|
body={
|
|
|
|
<React.Fragment>
|
|
|
|
<div className="card--inline">
|
|
|
|
<ClaimPreview type="small" uri={uri} />
|
|
|
|
</div>
|
2022-01-07 20:02:33 +01:00
|
|
|
{filePath && (
|
2020-02-11 19:19:09 +01:00
|
|
|
<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">
|
2021-10-19 06:49:51 +02:00
|
|
|
<Button
|
|
|
|
button="primary"
|
|
|
|
label={__('View My Uploads')}
|
|
|
|
onClick={() => {
|
|
|
|
clearPublish();
|
|
|
|
navigate(`/$/${PAGES.UPLOADS}`);
|
|
|
|
closeModal();
|
|
|
|
}}
|
|
|
|
/>
|
2020-02-11 19:19:09 +01:00
|
|
|
<Button button="link" label={__('Close')} onClick={handleClose} />
|
2020-04-02 23:34:48 +02:00
|
|
|
</div>
|
2020-02-11 19:19:09 +01:00
|
|
|
}
|
2020-07-09 16:58:43 +02: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;
|