Merge pull request #2573 from jonnylynchy/feature/publishUpdateModal

Update modal for edits to existing claims (different verbiage)
This commit is contained in:
Sean Yesmunt 2019-06-26 11:09:00 -04:00 committed by GitHub
commit c30f0efda1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 10 deletions

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import { doHideModal } from 'redux/actions/app';
import ModalSendTip from './view';
import ModalPublishSuccess from './view';
import { doClearPublish } from 'redux/actions/publish';
import { push } from 'connected-react-router';
@ -13,4 +13,4 @@ const perform = dispatch => ({
export default connect(
null,
perform
)(ModalSendTip);
)(ModalPublishSuccess);

View file

@ -7,17 +7,21 @@ type Props = {
clearPublish: () => void,
navigate: string => void,
uri: string,
isEdit: boolean,
};
class ModalPublishSuccess extends React.PureComponent<Props> {
render() {
const { closeModal, clearPublish, navigate, uri } = this.props;
const { closeModal, clearPublish, navigate, uri, isEdit } = this.props;
const contentLabel = isEdit ? 'Updates published' : 'File published';
const publishMessage = isEdit ? 'updates have been' : 'file has been';
const publishType = isEdit ? 'updates' : 'file';
return (
<Modal
isOpen
title={__('Success')}
contentLabel={__('File published')}
contentLabel={__(contentLabel)}
onConfirmed={() => {
clearPublish();
navigate('/$/published');
@ -25,11 +29,11 @@ class ModalPublishSuccess extends React.PureComponent<Props> {
}}
>
<section className="card__content">
<p>{__('Your file has been published to LBRY at the address')}</p>
<p>{__(`Your ${publishMessage} published to LBRY at the address`)}</p>
<blockquote>{uri}</blockquote>
<p>
{__(
'The file will take a few minutes to appear for other LBRY users. Until then it will be listed as "pending" under your published files.'
`The ${publishType} will take a few minutes to appear for other LBRY users. Until then it will be listed as "pending" under your published files.`
)}
</p>
</section>

View file

@ -303,17 +303,18 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
type: ACTIONS.PUBLISH_SUCCESS,
});
actions.push(doOpenModal(MODALS.PUBLISH, { uri }));
// We have to fake a temp claim until the new pending one is returned by claim_list_mine
// We can't rely on claim_list_mine because there might be some delay before the new claims are returned
// Doing this allows us to show the pending claim immediately, it will get overwritten by the real one
const isMatch = claim => claim.claim_id === pendingClaim.claim_id;
const isEdit = myClaims.some(isMatch);
const myNewClaims = isEdit
? myClaims.map(claim => (isMatch(claim) ? pendingClaim : claim))
: myClaims.concat(pendingClaim);
actions.push(doOpenModal(MODALS.PUBLISH, { uri, isEdit }));
actions.push({
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
data: {

View file

@ -284,5 +284,8 @@
"Connecting...": "Connecting...",
"Downloading stream... not long left now!": "Downloading stream... not long left now!",
"Downloading: ": "Downloading: ",
"% complete": "% complete"
"% complete": "% complete",
"Updates published": "Updates published",
"Your updates have been published to LBRY at the address": "Your updates have been published to LBRY at the address",
"The updates will take a few minutes to appear for other LBRY users. Until then your file will be listed as \"pending\" under your published files.": "The updates will take a few minutes to appear for other LBRY users. Until then your file will be listed as \"pending\" under your published files."
}