Update modal for edits to existing claims (different verbiage) #2573
4 changed files with 18 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideModal } from 'redux/actions/app';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalSendTip from './view';
|
import ModalPublishSuccess from './view';
|
||||||
import { doClearPublish } from 'redux/actions/publish';
|
import { doClearPublish } from 'redux/actions/publish';
|
||||||
import { push } from 'connected-react-router';
|
import { push } from 'connected-react-router';
|
||||||
|
|
||||||
|
@ -13,4 +13,4 @@ const perform = dispatch => ({
|
||||||
export default connect(
|
export default connect(
|
||||||
null,
|
null,
|
||||||
perform
|
perform
|
||||||
)(ModalSendTip);
|
)(ModalPublishSuccess);
|
||||||
|
|
|
@ -7,17 +7,21 @@ type Props = {
|
||||||
clearPublish: () => void,
|
clearPublish: () => void,
|
||||||
navigate: string => void,
|
navigate: string => void,
|
||||||
uri: string,
|
uri: string,
|
||||||
|
isEdit: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModalPublishSuccess extends React.PureComponent<Props> {
|
class ModalPublishSuccess extends React.PureComponent<Props> {
|
||||||
render() {
|
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 (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isOpen
|
isOpen
|
||||||
title={__('Success')}
|
title={__('Success')}
|
||||||
contentLabel={__('File published')}
|
contentLabel={__(contentLabel)}
|
||||||
onConfirmed={() => {
|
onConfirmed={() => {
|
||||||
clearPublish();
|
clearPublish();
|
||||||
navigate('/$/published');
|
navigate('/$/published');
|
||||||
|
@ -25,11 +29,11 @@ class ModalPublishSuccess extends React.PureComponent<Props> {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<section className="card__content">
|
<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>
|
<blockquote>{uri}</blockquote>
|
||||||
<p>
|
<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>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -303,17 +303,18 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
|
||||||
type: ACTIONS.PUBLISH_SUCCESS,
|
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 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
|
// 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
|
// 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 isMatch = claim => claim.claim_id === pendingClaim.claim_id;
|
||||||
const isEdit = myClaims.some(isMatch);
|
const isEdit = myClaims.some(isMatch);
|
||||||
|
|
||||||
const myNewClaims = isEdit
|
const myNewClaims = isEdit
|
||||||
? myClaims.map(claim => (isMatch(claim) ? pendingClaim : claim))
|
? myClaims.map(claim => (isMatch(claim) ? pendingClaim : claim))
|
||||||
: myClaims.concat(pendingClaim);
|
: myClaims.concat(pendingClaim);
|
||||||
|
|
||||||
|
actions.push(doOpenModal(MODALS.PUBLISH, { uri, isEdit }));
|
||||||
|
|
||||||
actions.push({
|
actions.push({
|
||||||
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED,
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -284,5 +284,8 @@
|
||||||
"Connecting...": "Connecting...",
|
"Connecting...": "Connecting...",
|
||||||
"Downloading stream... not long left now!": "Downloading stream... not long left now!",
|
"Downloading stream... not long left now!": "Downloading stream... not long left now!",
|
||||||
"Downloading: ": "Downloading: ",
|
"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."
|
||||||
|
|||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue
I see
comma-dangle
in .eslintrc.json and .prettierrc.json, but doesn't look like it's being respected.