From d66d63cca05212107a81ec2520f5b13bf703492f Mon Sep 17 00:00:00 2001 From: Jon Lynch Date: Mon, 24 Jun 2019 23:05:46 -0500 Subject: [PATCH 1/4] added update modal for edit/update publish vs new publish, corrected copy pasta on modal variable in publish modal --- src/ui/constants/modal_types.js | 1 + src/ui/modal/modalPublish/index.js | 4 +-- src/ui/modal/modalPublishUpdate/index.js | 16 +++++++++ src/ui/modal/modalPublishUpdate/view.jsx | 41 ++++++++++++++++++++++++ src/ui/modal/modalRouter/view.jsx | 3 ++ src/ui/redux/actions/publish.js | 7 ++-- static/locales/en.json | 19 ++++++++++- 7 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 src/ui/modal/modalPublishUpdate/index.js create mode 100644 src/ui/modal/modalPublishUpdate/view.jsx diff --git a/src/ui/constants/modal_types.js b/src/ui/constants/modal_types.js index 8cd8ee674..4af98531f 100644 --- a/src/ui/constants/modal_types.js +++ b/src/ui/constants/modal_types.js @@ -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'; diff --git a/src/ui/modal/modalPublish/index.js b/src/ui/modal/modalPublish/index.js index ccb125053..f6c26449d 100644 --- a/src/ui/modal/modalPublish/index.js +++ b/src/ui/modal/modalPublish/index.js @@ -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); diff --git a/src/ui/modal/modalPublishUpdate/index.js b/src/ui/modal/modalPublishUpdate/index.js new file mode 100644 index 000000000..fe00d8727 --- /dev/null +++ b/src/ui/modal/modalPublishUpdate/index.js @@ -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); diff --git a/src/ui/modal/modalPublishUpdate/view.jsx b/src/ui/modal/modalPublishUpdate/view.jsx new file mode 100644 index 000000000..f4efc9cac --- /dev/null +++ b/src/ui/modal/modalPublishUpdate/view.jsx @@ -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 { + render() { + const { closeModal, clearPublish, navigate, uri } = this.props; + + return ( + { + clearPublish(); + navigate('/$/published'); + closeModal(); + }} + > +
+

{__('Your updates have been published to LBRY at the address')}

+
{uri}
+

+ {__( + '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.' + )} +

+
+
+ ); + } +} + +export default ModalPublishUpdateSuccess; diff --git a/src/ui/modal/modalRouter/view.jsx b/src/ui/modal/modalRouter/view.jsx index af910c611..4d2ad8b83 100644 --- a/src/ui/modal/modalRouter/view.jsx +++ b/src/ui/modal/modalRouter/view.jsx @@ -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 ; case MODALS.PUBLISH: return ; + case MODALS.PUBLISH_UPDATE: + return ; case MODALS.CONFIRM_EXTERNAL_RESOURCE: return ; case MODALS.CONFIRM_TRANSACTION: diff --git a/src/ui/redux/actions/publish.js b/src/ui/redux/actions/publish.js index b525c9632..67887e6f2 100644 --- a/src/ui/redux/actions/publish.js +++ b/src/ui/redux/actions/publish.js @@ -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); diff --git a/static/locales/en.json b/static/locales/en.json index 770d0e5b5..40dc113a2 100644 --- a/static/locales/en.json +++ b/static/locales/en.json @@ -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" } \ No newline at end of file From 57a6f78b6f28071d6a50afc3fc8b9f6f3f3184aa Mon Sep 17 00:00:00 2001 From: Jon Lynch Date: Tue, 25 Jun 2019 08:28:23 -0500 Subject: [PATCH 2/4] removing added lines from previous version --- static/locales/en.json | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/static/locales/en.json b/static/locales/en.json index 40dc113a2..bceb5f02d 100644 --- a/static/locales/en.json +++ b/static/locales/en.json @@ -287,19 +287,5 @@ "% 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" -} \ No newline at end of file + "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." +} From c52ad9c54cec23262c412580ae068372b1c32446 Mon Sep 17 00:00:00 2001 From: Jon Lynch Date: Tue, 25 Jun 2019 20:18:05 -0500 Subject: [PATCH 3/4] removed extraneous modal, added prop to publish modal to toggle text (edit or new) --- src/ui/constants/modal_types.js | 1 - src/ui/modal/modalPublish/view.jsx | 15 ++++++--- src/ui/modal/modalPublishUpdate/index.js | 16 --------- src/ui/modal/modalPublishUpdate/view.jsx | 41 ------------------------ src/ui/modal/modalRouter/view.jsx | 3 -- src/ui/redux/actions/publish.js | 6 ++-- 6 files changed, 13 insertions(+), 69 deletions(-) delete mode 100644 src/ui/modal/modalPublishUpdate/index.js delete mode 100644 src/ui/modal/modalPublishUpdate/view.jsx diff --git a/src/ui/constants/modal_types.js b/src/ui/constants/modal_types.js index 4af98531f..8cd8ee674 100644 --- a/src/ui/constants/modal_types.js +++ b/src/ui/constants/modal_types.js @@ -22,7 +22,6 @@ 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'; diff --git a/src/ui/modal/modalPublish/view.jsx b/src/ui/modal/modalPublish/view.jsx index bafaf319a..b98c56bba 100644 --- a/src/ui/modal/modalPublish/view.jsx +++ b/src/ui/modal/modalPublish/view.jsx @@ -7,17 +7,24 @@ type Props = { clearPublish: () => void, navigate: string => void, uri: string, + isEdit: boolean, }; class ModalPublishSuccess extends React.PureComponent { 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 ( { clearPublish(); navigate('/$/published'); @@ -25,11 +32,11 @@ class ModalPublishSuccess extends React.PureComponent { }} >
-

{__('Your file has been published to LBRY at the address')}

+

{__(`Your ${publishMessage} published to LBRY at the address`)}

{uri}

{__( - '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.` )}

diff --git a/src/ui/modal/modalPublishUpdate/index.js b/src/ui/modal/modalPublishUpdate/index.js deleted file mode 100644 index fe00d8727..000000000 --- a/src/ui/modal/modalPublishUpdate/index.js +++ /dev/null @@ -1,16 +0,0 @@ -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); diff --git a/src/ui/modal/modalPublishUpdate/view.jsx b/src/ui/modal/modalPublishUpdate/view.jsx deleted file mode 100644 index f4efc9cac..000000000 --- a/src/ui/modal/modalPublishUpdate/view.jsx +++ /dev/null @@ -1,41 +0,0 @@ -// @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 { - render() { - const { closeModal, clearPublish, navigate, uri } = this.props; - - return ( - { - clearPublish(); - navigate('/$/published'); - closeModal(); - }} - > -
-

{__('Your updates have been published to LBRY at the address')}

-
{uri}
-

- {__( - '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.' - )} -

-
-
- ); - } -} - -export default ModalPublishUpdateSuccess; diff --git a/src/ui/modal/modalRouter/view.jsx b/src/ui/modal/modalRouter/view.jsx index 4d2ad8b83..af910c611 100644 --- a/src/ui/modal/modalRouter/view.jsx +++ b/src/ui/modal/modalRouter/view.jsx @@ -22,7 +22,6 @@ 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'; @@ -89,8 +88,6 @@ function ModalRouter(props: Props) { return ; case MODALS.PUBLISH: return ; - case MODALS.PUBLISH_UPDATE: - return ; case MODALS.CONFIRM_EXTERNAL_RESOURCE: return ; case MODALS.CONFIRM_TRANSACTION: diff --git a/src/ui/redux/actions/publish.js b/src/ui/redux/actions/publish.js index 67887e6f2..5f9f8c132 100644 --- a/src/ui/redux/actions/publish.js +++ b/src/ui/redux/actions/publish.js @@ -309,14 +309,12 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat 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); + actions.push(doOpenModal(MODALS.PUBLISH, { uri, isEdit })); + actions.push({ type: ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED, data: { From 98d583a66533de505511962be86583995db9fea1 Mon Sep 17 00:00:00 2001 From: Jon Lynch Date: Tue, 25 Jun 2019 20:31:27 -0500 Subject: [PATCH 4/4] removed carriage returns --- src/ui/modal/modalPublish/view.jsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ui/modal/modalPublish/view.jsx b/src/ui/modal/modalPublish/view.jsx index b98c56bba..271a3fbce 100644 --- a/src/ui/modal/modalPublish/view.jsx +++ b/src/ui/modal/modalPublish/view.jsx @@ -13,11 +13,8 @@ type Props = { class ModalPublishSuccess extends React.PureComponent { render() { 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 (