added update modal for edit/update publish vs new publish, corrected copy pasta on modal variable in publish modal

This commit is contained in:
Jon Lynch 2019-06-24 23:05:46 -05:00
parent 2d89bdbd7f
commit d66d63cca0
7 changed files with 86 additions and 5 deletions

View file

@ -22,6 +22,7 @@ export const FIRST_SUBSCRIPTION = 'firstSubscription';
export const SEND_TIP = 'send_tip';
export const SOCIAL_SHARE = 'social_share';
export const PUBLISH = 'publish';
export const PUBLISH_UPDATE = 'publish_update';
export const SEARCH = 'search';
export const CONFIRM_TRANSACTION = 'confirm_transaction';
export const CONFIRM_THUMBNAIL_UPLOAD = 'confirm_thumbnail_upload';

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

@ -0,0 +1,16 @@
import { connect } from 'react-redux';
import { doHideModal } from 'redux/actions/app';
import ModalPublishUpdateSuccess from './view';
import { doClearPublish } from 'redux/actions/publish';
import { push } from 'connected-react-router';
const perform = dispatch => ({
closeModal: () => dispatch(doHideModal()),
clearPublish: () => dispatch(doClearPublish()),
navigate: path => dispatch(push(path)),
});
export default connect(
null,
perform
)(ModalPublishUpdateSuccess);

View file

@ -0,0 +1,41 @@
// @flow
import React from 'react';
import { Modal } from 'modal/modal';
type Props = {
closeModal: () => void,
clearPublish: () => void,
navigate: string => void,
uri: string,
};
class ModalPublishUpdateSuccess extends React.PureComponent<Props> {
render() {
const { closeModal, clearPublish, navigate, uri } = this.props;
return (
<Modal
isOpen
title={__('Success')}
contentLabel={__('Updates published')}
onConfirmed={() => {
clearPublish();
navigate('/$/published');
closeModal();
}}
>
<section className="card__content">
<p>{__('Your updates have been published to LBRY at the address')}</p>
<blockquote>{uri}</blockquote>
<p>
{__(
'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.'
)}
</p>
</section>
</Modal>
);
}
}
export default ModalPublishUpdateSuccess;

View file

@ -22,6 +22,7 @@ import ModalConfirmTransaction from 'modal/modalConfirmTransaction';
import ModalSocialShare from 'modal/modalSocialShare';
import ModalSendTip from 'modal/modalSendTip';
import ModalPublish from 'modal/modalPublish';
import ModalPublishUpdate from 'modal/modalPublishUpdate';
import ModalOpenExternalResource from 'modal/modalOpenExternalResource';
import ModalConfirmThumbnailUpload from 'modal/modalConfirmThumbnailUpload';
import ModalWalletEncrypt from 'modal/modalWalletEncrypt';
@ -88,6 +89,8 @@ function ModalRouter(props: Props) {
return <ModalSocialShare {...modalProps} />;
case MODALS.PUBLISH:
return <ModalPublish {...modalProps} />;
case MODALS.PUBLISH_UPDATE:
return <ModalPublishUpdate {...modalProps} />;
case MODALS.CONFIRM_EXTERNAL_RESOURCE:
return <ModalOpenExternalResource {...modalProps} />;
case MODALS.CONFIRM_TRANSACTION:

View file

@ -303,13 +303,16 @@ 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 publishModal = isEdit ? MODALS.PUBLISH_UPDATE : MODALS.PUBLISH;
actions.push(doOpenModal(publishModal, { uri }));
const myNewClaims = isEdit
? myClaims.map(claim => (isMatch(claim) ? pendingClaim : claim))
: myClaims.concat(pendingClaim);

View file

@ -284,5 +284,22 @@
"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.",
"Clear": "Clear",
"You are currently editing a claim.": "You are currently editing a claim.",
"If you don't choose a file, the file from your existing claim": "If you don't choose a file, the file from your existing claim",
"will be used.": "will be used.",
"You should reselect your file to choose a thumbnail": "You should reselect your file to choose a thumbnail",
"You are currently editing this claim. If you change the URL, you will need to reselect a file.": "You are currently editing this claim. If you change the URL, you will need to reselect a file.",
"Checking the winning claim amount...": "Checking the winning claim amount...",
"If you bid more than": "If you bid more than",
"when someone navigates to": "when someone navigates to",
"it will load your published content": "it will load your published content",
"However, you can get a longer version of this URL for any bid": "However, you can get a longer version of this URL for any bid",
"Take a snapshot from your video": "Take a snapshot from your video",
"Editing...": "Editing...",
"Success": "Success"
}