doOpenModal => doNotify
This commit is contained in:
parent
63183f58cd
commit
25c6ef54e1
41 changed files with 130 additions and 123 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
|||
/static/daemon/lbrynet*
|
||||
/static/locales
|
||||
yarn-error.log
|
||||
package-lock.json
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"find-process": "^1.1.0",
|
||||
"formik": "^0.10.4",
|
||||
"keytar": "^4.2.1",
|
||||
"lbry-redux": "lbryio/lbry-redux",
|
||||
"lbry-redux": "file:../lbry-redux",
|
||||
"localforage": "^1.7.1",
|
||||
"mixpanel-browser": "^2.17.1",
|
||||
"moment": "^2.22.0",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import {
|
||||
makeSelectCostInfoForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
makeSelectClaimIsMine,
|
||||
doNotify,
|
||||
} from 'lbry-redux';
|
||||
import FileActions from './view';
|
||||
|
||||
|
@ -15,7 +15,7 @@ const select = (state, props) => ({
|
|||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(FileActions);
|
||||
|
|
|
@ -12,7 +12,7 @@ type FileInfo = {
|
|||
|
||||
type Props = {
|
||||
uri: string,
|
||||
openModal: (string, any) => void,
|
||||
openModal: ({ id: string }, { uri: string }) => void,
|
||||
claimIsMine: boolean,
|
||||
fileInfo: FileInfo,
|
||||
vertical?: boolean, // should the buttons be stacked vertically?
|
||||
|
@ -33,7 +33,7 @@ class FileActions extends React.PureComponent<Props> {
|
|||
className="btn--file-actions"
|
||||
icon={icons.TRASH}
|
||||
description={__('Delete')}
|
||||
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE, { uri })}
|
||||
onClick={() => openModal({ id: modals.CONFIRM_FILE_REMOVE }, { uri })}
|
||||
/>
|
||||
)}
|
||||
{!claimIsMine && (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import SubscribeButton from './view';
|
||||
|
||||
|
@ -11,5 +11,5 @@ const select = (state, props) => ({
|
|||
export default connect(select, {
|
||||
doChannelSubscribe,
|
||||
doChannelUnsubscribe,
|
||||
doOpenModal,
|
||||
doNotify,
|
||||
})(SubscribeButton);
|
||||
|
|
|
@ -16,7 +16,7 @@ type Props = {
|
|||
subscriptions: Array<Subscription>,
|
||||
doChannelSubscribe: ({ channelName: string, uri: string }) => void,
|
||||
doChannelUnsubscribe: SubscribtionArgs => void,
|
||||
doOpenModal: string => void,
|
||||
doNotify: ({ id: string }) => void,
|
||||
};
|
||||
|
||||
export default (props: Props) => {
|
||||
|
@ -26,7 +26,7 @@ export default (props: Props) => {
|
|||
subscriptions,
|
||||
doChannelSubscribe,
|
||||
doChannelUnsubscribe,
|
||||
doOpenModal,
|
||||
doNotify,
|
||||
} = props;
|
||||
|
||||
const isSubscribed =
|
||||
|
@ -42,7 +42,7 @@ export default (props: Props) => {
|
|||
label={subscriptionLabel}
|
||||
onClick={() => {
|
||||
if (!subscriptions.length) {
|
||||
doOpenModal(modals.FIRST_SUBSCRIPTION);
|
||||
doNotify({ id: modals.FIRST_SUBSCRIPTION });
|
||||
}
|
||||
subscriptionHandler({
|
||||
channelName,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { selectClaimedRewardsByTransactionId } from 'redux/selectors/rewards';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import { selectAllMyClaimsByOutpoint } from 'lbry-redux';
|
||||
import TransactionList from './view';
|
||||
|
||||
|
@ -12,7 +12,7 @@ const select = state => ({
|
|||
|
||||
const perform = dispatch => ({
|
||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(TransactionList);
|
||||
|
|
|
@ -23,7 +23,7 @@ type Props = {
|
|||
slim?: boolean,
|
||||
transactions: Array<Transaction>,
|
||||
rewards: {},
|
||||
openModal: (string, any) => void,
|
||||
openModal: ({ id: string }, { nout: number, txid: string }) => void,
|
||||
myClaims: any,
|
||||
};
|
||||
|
||||
|
@ -65,7 +65,7 @@ class TransactionList extends React.PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
revokeClaim(txid: string, nout: number) {
|
||||
this.props.openModal(modals.CONFIRM_CLAIM_REVOKE, { txid, nout });
|
||||
this.props.openModal({ id: modals.CONFIRM_CLAIM_REVOKE }, { txid, nout });
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
} from 'redux/selectors/user';
|
||||
import UserVerify from './view';
|
||||
import { selectCurrentModal } from 'redux/selectors/app';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import { PHONE_COLLECTION } from 'constants/modal_types';
|
||||
|
||||
const select = (state, props) => {
|
||||
|
@ -26,7 +26,7 @@ const select = (state, props) => {
|
|||
const perform = dispatch => ({
|
||||
navigate: uri => dispatch(doNavigate(uri)),
|
||||
verifyUserIdentity: token => dispatch(doUserIdentityVerify(token)),
|
||||
verifyPhone: () => dispatch(doOpenModal(PHONE_COLLECTION)),
|
||||
verifyPhone: () => dispatch(doNotify({ id: PHONE_COLLECTION })),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(UserVerify);
|
||||
|
|
|
@ -5,9 +5,9 @@ import {
|
|||
selectSearchState as selectSearch,
|
||||
selectWunderBarAddress,
|
||||
doUpdateSearchQuery,
|
||||
doNotify,
|
||||
} from 'lbry-redux';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import Wunderbar from './view';
|
||||
|
||||
const select = state => {
|
||||
|
@ -27,7 +27,7 @@ const select = state => {
|
|||
const perform = dispatch => ({
|
||||
onSearch: query => {
|
||||
dispatch(doUpdateSearchQuery(query));
|
||||
dispatch(doOpenModal(MODALS.SEARCH));
|
||||
dispatch(doNotify({ id: MODALS.SEARCH }));
|
||||
},
|
||||
onSubmit: (uri, extraParams) => dispatch(doNavigate('/show', { uri, ...extraParams })),
|
||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doLoadVideo, doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doCloseModal, makeSelectMetadataForUri } from 'lbry-redux';
|
||||
import { doHideNotification, makeSelectMetadataForUri } from 'lbry-redux';
|
||||
import ModalAffirmPurchase from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
|
@ -10,9 +10,9 @@ const select = (state, props) => ({
|
|||
const perform = dispatch => ({
|
||||
cancelPurchase: () => {
|
||||
dispatch(doSetPlayingUri(null));
|
||||
dispatch(doCloseModal());
|
||||
dispatch(doHideNotification());
|
||||
},
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
loadVideo: uri => dispatch(doLoadVideo(uri)),
|
||||
});
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'lbry-redux';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import ModalAuthFailure from './view';
|
||||
|
||||
const select = state => ({});
|
||||
|
||||
const perform = dispatch => ({
|
||||
close: () => dispatch(doCloseModal()),
|
||||
close: () => dispatch(doHideNotification()),
|
||||
});
|
||||
|
||||
export default connect(null, null)(ModalAuthFailure);
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { doCloseModal, doAutoUpdateDeclined } from 'redux/actions/app';
|
||||
import { doAutoUpdateDeclined } from 'redux/actions/app';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import ModalAutoUpdateConfirm from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
|
||||
});
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { doCloseModal, doAutoUpdateDeclined } from 'redux/actions/app';
|
||||
import { doAutoUpdateDeclined } from 'redux/actions/app';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import ModalAutoUpdateDownloaded from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
|||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectUserIsRewardApproved } from 'redux/selectors/user';
|
||||
import { selectBalance, doCloseModal } from 'lbry-redux';
|
||||
import { selectBalance, doHideNotification } from 'lbry-redux';
|
||||
import { selectUnclaimedRewardValue } from 'redux/selectors/rewards';
|
||||
import * as settings from 'constants/settings';
|
||||
import ModalCreditIntro from './view';
|
||||
|
@ -17,11 +17,11 @@ const perform = dispatch => () => ({
|
|||
addBalance: () => {
|
||||
dispatch(doSetClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED, true));
|
||||
dispatch(doNavigate('/getcredits'));
|
||||
dispatch(doCloseModal());
|
||||
dispatch(doHideNotification());
|
||||
},
|
||||
closeModal: () => {
|
||||
dispatch(doSetClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED, true));
|
||||
dispatch(doCloseModal());
|
||||
dispatch(doHideNotification());
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as settings from 'constants/settings';
|
||||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'redux/actions/app';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectEmailToVerify, selectUser } from 'redux/selectors/user';
|
||||
import ModalEmailCollection from './view';
|
||||
|
@ -13,7 +13,7 @@ const select = state => ({
|
|||
const perform = dispatch => () => ({
|
||||
closeModal: () => {
|
||||
dispatch(doSetClientSetting(settings.EMAIL_COLLECTION_ACKNOWLEDGED, true));
|
||||
dispatch(doCloseModal());
|
||||
dispatch(doHideNotification());
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'lbry-redux';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import ModalError from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
});
|
||||
|
||||
export default connect(null, perform)(ModalError);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal, makeSelectMetadataForUri } from 'lbry-redux';
|
||||
import { doHideNotification, makeSelectMetadataForUri } from 'lbry-redux';
|
||||
import ModalFileTimeout from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
|
@ -7,7 +7,7 @@ const select = (state, props) => ({
|
|||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ModalFileTimeout);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import rewards from 'rewards';
|
||||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'lbry-redux';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import { makeSelectRewardByType } from 'redux/selectors/rewards';
|
||||
import ModalFirstReward from './view';
|
||||
|
||||
|
@ -13,7 +13,7 @@ const select = state => {
|
|||
};
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ModalFirstReward);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'redux/actions/app';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import ModalFirstSubscription from './view';
|
||||
|
||||
const perform = dispatch => () => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
navigate: path => dispatch(doNavigate(path)),
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import * as settings from 'constants/settings';
|
||||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'redux/actions/app';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { selectPhoneToVerify, selectUser } from 'redux/selectors/user';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
|
@ -14,7 +14,7 @@ const select = state => ({
|
|||
|
||||
const perform = dispatch => () => ({
|
||||
closeModal: () => {
|
||||
dispatch(doCloseModal());
|
||||
dispatch(doHideNotification());
|
||||
dispatch(doNavigate('/rewards'));
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'redux/actions/app';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import ModalSendTip from './view';
|
||||
import { doClearPublish } from 'redux/actions/publish';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
clearPublish: () => dispatch(doClearPublish()),
|
||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doDeleteFileAndGoBack } from 'redux/actions/file';
|
||||
import {
|
||||
doCloseModal,
|
||||
doHideNotification,
|
||||
makeSelectTitleForUri,
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectFileInfoForUri,
|
||||
|
@ -15,7 +15,7 @@ const select = (state, props) => ({
|
|||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
deleteFile: (fileInfo, deleteFromComputer, abandonClaim) => {
|
||||
dispatch(doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim));
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal, doAbandonClaim, selectTransactionItems } from 'lbry-redux';
|
||||
import { doHideNotification, doAbandonClaim, selectTransactionItems } from 'lbry-redux';
|
||||
import ModalRevokeClaim from './view';
|
||||
|
||||
const select = state => ({
|
||||
|
@ -7,7 +7,7 @@ const select = state => ({
|
|||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||
});
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'lbry-redux';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import { doAuthNavigate } from 'redux/actions/navigation';
|
||||
import ModalRewardApprovalRequired from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
doAuth: () => {
|
||||
dispatch(doCloseModal());
|
||||
dispatch(doHideNotification());
|
||||
dispatch(doAuthNavigate());
|
||||
},
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
});
|
||||
|
||||
export default connect(null, perform)(ModalRewardApprovalRequired);
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
import { connect } from 'react-redux';
|
||||
import * as settings from 'constants/settings';
|
||||
import { selectCurrentModal, selectModalProps, selectModalsAllowed } from 'redux/selectors/app';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { selectCostForCurrentPageUri, selectBalance, selectCurrentPage } from 'lbry-redux';
|
||||
import {
|
||||
doNotify,
|
||||
selectCostForCurrentPageUri,
|
||||
selectBalance,
|
||||
selectCurrentPage,
|
||||
selectNotification,
|
||||
selectNotificationProps,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { selectUser, selectUserIsVerificationCandidate } from 'redux/selectors/user';
|
||||
|
||||
|
@ -22,10 +28,12 @@ const select = state => ({
|
|||
isWelcomeAcknowledged: makeSelectClientSetting(settings.NEW_USER_ACKNOWLEDGED)(state),
|
||||
user: selectUser(state),
|
||||
modalsAllowed: selectModalsAllowed(state),
|
||||
notification: selectNotification(state),
|
||||
notificationProps: selectNotificationProps(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
openModal: modal => dispatch(doOpenModal(modal)),
|
||||
openModal: notification => dispatch(doNotify(notification)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ModalRouter);
|
||||
|
|
|
@ -57,7 +57,7 @@ class ModalRouter extends React.PureComponent {
|
|||
transitionModal &&
|
||||
(transitionModal != this.state.lastTransitionModal || page != this.state.lastTransitionPage)
|
||||
) {
|
||||
openModal(transitionModal);
|
||||
openModal({ id: transitionModal });
|
||||
this.setState({
|
||||
lastTransitionModal: transitionModal,
|
||||
lastTransitionPage: page,
|
||||
|
@ -102,51 +102,54 @@ class ModalRouter extends React.PureComponent {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { modal, modalsAllowed, modalProps } = this.props;
|
||||
const { notification, notificationProps } = this.props;
|
||||
|
||||
switch (modal) {
|
||||
if (!notification) {
|
||||
return null;
|
||||
}
|
||||
switch (notification.id) {
|
||||
case modals.UPGRADE:
|
||||
return <ModalUpgrade {...modalProps} />;
|
||||
return <ModalUpgrade {...notificationProps} />;
|
||||
case modals.DOWNLOADING:
|
||||
return <ModalDownloading {...modalProps} />;
|
||||
return <ModalDownloading {...notificationProps} />;
|
||||
case modals.AUTO_UPDATE_DOWNLOADED:
|
||||
return <ModalAutoUpdateDownloaded {...modalProps} />;
|
||||
return <ModalAutoUpdateDownloaded {...notificationProps} />;
|
||||
case modals.AUTO_UPDATE_CONFIRM:
|
||||
return <ModalAutoUpdateConfirm {...modalProps} />;
|
||||
return <ModalAutoUpdateConfirm {...notificationProps} />;
|
||||
case modals.ERROR:
|
||||
return <ModalError {...modalProps} />;
|
||||
return <ModalError {...notificationProps} />;
|
||||
case modals.FILE_TIMEOUT:
|
||||
return <ModalFileTimeout {...modalProps} />;
|
||||
return <ModalFileTimeout {...notificationProps} />;
|
||||
case modals.INSUFFICIENT_CREDITS:
|
||||
return <ModalCreditIntro {...modalProps} />;
|
||||
return <ModalCreditIntro {...notificationProps} />;
|
||||
case modals.WELCOME:
|
||||
return <ModalWelcome {...modalProps} />;
|
||||
return <ModalWelcome {...notificationProps} />;
|
||||
case modals.FIRST_REWARD:
|
||||
return <ModalFirstReward {...modalProps} />;
|
||||
return <ModalFirstReward {...notificationProps} />;
|
||||
case modals.AUTHENTICATION_FAILURE:
|
||||
return <ModalAuthFailure {...modalProps} />;
|
||||
return <ModalAuthFailure {...notificationProps} />;
|
||||
case modals.TRANSACTION_FAILED:
|
||||
return <ModalTransactionFailed {...modalProps} />;
|
||||
return <ModalTransactionFailed {...notificationProps} />;
|
||||
case modals.REWARD_APPROVAL_REQUIRED:
|
||||
return <ModalRewardApprovalRequired {...modalProps} />;
|
||||
return <ModalRewardApprovalRequired {...notificationProps} />;
|
||||
case modals.CONFIRM_FILE_REMOVE:
|
||||
return <ModalRemoveFile {...modalProps} />;
|
||||
return <ModalRemoveFile {...notificationProps} />;
|
||||
case modals.AFFIRM_PURCHASE:
|
||||
return <ModalAffirmPurchase {...modalProps} />;
|
||||
return <ModalAffirmPurchase {...notificationProps} />;
|
||||
case modals.CONFIRM_CLAIM_REVOKE:
|
||||
return <ModalRevokeClaim {...modalProps} />;
|
||||
return <ModalRevokeClaim {...notificationProps} />;
|
||||
case modals.PHONE_COLLECTION:
|
||||
return <ModalPhoneCollection {...modalProps} />;
|
||||
return <ModalPhoneCollection {...notificationProps} />;
|
||||
case modals.EMAIL_COLLECTION:
|
||||
return <ModalEmailCollection {...modalProps} />;
|
||||
return <ModalEmailCollection {...notificationProps} />;
|
||||
case modals.FIRST_SUBSCRIPTION:
|
||||
return <ModalFirstSubscription {...modalProps} />;
|
||||
return <ModalFirstSubscription {...notificationProps} />;
|
||||
case modals.SEND_TIP:
|
||||
return <ModalSendTip {...modalProps} />;
|
||||
return <ModalSendTip {...notificationProps} />;
|
||||
case modals.PUBLISH:
|
||||
return <ModalPublish {...modalProps} />;
|
||||
return <ModalPublish {...notificationProps} />;
|
||||
case modals.SEARCH:
|
||||
return <ModalSearch {...modalProps} />;
|
||||
return <ModalSearch {...notificationProps} />;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'redux/actions/app';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import ModalSearch from './view';
|
||||
import { doClearPublish } from 'redux/actions/publish';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
clearPublish: () => dispatch(doClearPublish()),
|
||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||
});
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'redux/actions/app';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import ModalSendTip from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
});
|
||||
|
||||
export default connect(null, perform)(ModalSendTip);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'lbry-redux';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import ModalTransactionFailed from './view';
|
||||
|
||||
const select = state => ({});
|
||||
|
||||
const perform = dispatch => ({
|
||||
closeModal: () => dispatch(doCloseModal()),
|
||||
closeModal: () => dispatch(doHideNotification()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ModalTransactionFailed);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import * as settings from 'constants/settings';
|
||||
import { connect } from 'react-redux';
|
||||
import { doCloseModal } from 'lbry-redux';
|
||||
import { doHideNotification } from 'lbry-redux';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import ModalWelcome from './view';
|
||||
|
||||
const perform = dispatch => () => ({
|
||||
closeModal: () => {
|
||||
dispatch(doSetClientSetting(settings.NEW_USER_ACKNOWLEDGED, true));
|
||||
dispatch(doCloseModal());
|
||||
dispatch(doHideNotification());
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ import {
|
|||
makeSelectFetchingChannelClaims,
|
||||
makeSelectCurrentParam,
|
||||
selectCurrentParams,
|
||||
doNotify,
|
||||
} from 'lbry-redux';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { makeSelectTotalPagesForChannel } from 'redux/selectors/content';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import ChannelPage from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
|
@ -25,7 +25,7 @@ const perform = dispatch => ({
|
|||
fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)),
|
||||
fetchClaimCount: uri => dispatch(doFetchClaimCountByChannel(uri)),
|
||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ChannelPage);
|
||||
|
|
|
@ -11,11 +11,11 @@ import {
|
|||
makeSelectClaimForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
makeSelectMetadataForUri,
|
||||
doNotify,
|
||||
} from 'lbry-redux';
|
||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import { selectMediaPaused } from 'redux/selectors/media';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import { doPrepareEdit } from 'redux/actions/publish';
|
||||
import FilePage from './view';
|
||||
|
||||
|
@ -38,7 +38,7 @@ const perform = dispatch => ({
|
|||
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
checkSubscription: subscription => dispatch(doCheckSubscription(subscription)),
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
||||
prepareEdit: (publishData, uri) => dispatch(doPrepareEdit(publishData, uri)),
|
||||
});
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ type Props = {
|
|||
claimIsMine: boolean,
|
||||
costInfo: ?{},
|
||||
navigate: (string, ?{}) => void,
|
||||
openModal: (string, any) => void,
|
||||
openModal: ({ id: string }, { uri: string }) => void,
|
||||
fetchFileInfo: string => void,
|
||||
fetchCostInfo: string => void,
|
||||
prepareEdit: ({}) => void,
|
||||
|
@ -171,7 +171,7 @@ class FilePage extends React.Component<Props> {
|
|||
button="alt"
|
||||
iconRight="Send"
|
||||
label={__('Enjoy this? Send a tip')}
|
||||
onClick={() => openModal(modals.SEND_TIP, { uri })}
|
||||
onClick={() => openModal({ id: modals.SEND_TIP }, { uri })}
|
||||
/>
|
||||
<SubscribeButton uri={subscriptionUri} channelName={channelName} />
|
||||
</React.Fragment>
|
||||
|
|
|
@ -29,22 +29,6 @@ const Fs = remote.require('fs');
|
|||
|
||||
const CHECK_UPGRADE_INTERVAL = 10 * 60 * 1000;
|
||||
|
||||
export function doOpenModal(modal, modalProps = {}) {
|
||||
return {
|
||||
type: ACTIONS.OPEN_MODAL,
|
||||
data: {
|
||||
modal,
|
||||
modalProps,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function doCloseModal() {
|
||||
return {
|
||||
type: ACTIONS.CLOSE_MODAL,
|
||||
};
|
||||
}
|
||||
|
||||
export function doUpdateDownloadProgress(percent) {
|
||||
return {
|
||||
type: ACTIONS.UPGRADE_DOWNLOAD_PROGRESSED,
|
||||
|
|
|
@ -2,7 +2,8 @@ import * as MODALS from 'constants/modal_types';
|
|||
import * as NOTIFICATION_TYPES from 'constants/notification_types';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import Lbryio from 'lbryio';
|
||||
import { doAlertError, doOpenModal } from 'redux/actions/app';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import { doAlertError } from 'redux/actions/app';
|
||||
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import {
|
||||
|
@ -259,7 +260,7 @@ export function doLoadVideo(uri) {
|
|||
data: { uri },
|
||||
});
|
||||
|
||||
dispatch(doOpenModal(MODALS.FILE_TIMEOUT, { uri }));
|
||||
dispatch(doNotify({ id: MODALS.FILE_TIMEOUT }, { uri }));
|
||||
} else {
|
||||
dispatch(doDownloadFile(uri, streamInfo));
|
||||
}
|
||||
|
@ -289,7 +290,7 @@ export function doPurchaseUri(uri, specificCostInfo) {
|
|||
|
||||
function attemptPlay(cost, instantPurchaseMax = null) {
|
||||
if (cost > 0 && (!instantPurchaseMax || cost > instantPurchaseMax)) {
|
||||
dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri }));
|
||||
dispatch(doNotify({ id: MODALS.AFFIRM_PURCHASE }, { uri }));
|
||||
} else {
|
||||
dispatch(doLoadVideo(uri));
|
||||
}
|
||||
|
@ -317,7 +318,7 @@ export function doPurchaseUri(uri, specificCostInfo) {
|
|||
|
||||
if (cost > balance) {
|
||||
dispatch(doSetPlayingUri(null));
|
||||
dispatch(doOpenModal(MODALS.INSUFFICIENT_CREDITS));
|
||||
dispatch(doNotify({ id: MODALS.INSUFFICIENT_CREDITS }));
|
||||
Promise.resolve();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import {
|
|||
selectMyClaimsOutpoints,
|
||||
selectFileInfosByOutpoint,
|
||||
selectTotalDownloadProgress,
|
||||
doHideNotification,
|
||||
} from 'lbry-redux';
|
||||
import { doCloseModal } from 'redux/actions/app';
|
||||
import { doHistoryBack } from 'redux/actions/navigation';
|
||||
import setProgressBar from 'util/setProgressBar';
|
||||
|
||||
|
@ -65,7 +65,7 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
|
|||
export function doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim) {
|
||||
return dispatch => {
|
||||
const actions = [];
|
||||
actions.push(doCloseModal());
|
||||
actions.push(doHideNotification());
|
||||
actions.push(doHistoryBack());
|
||||
actions.push(doDeleteFile(fileInfo, deleteFromComputer, abandonClaim));
|
||||
dispatch(batchActions(...actions));
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
// @flow
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import { ACTIONS, Lbry, selectMyClaimsWithoutChannels } from 'lbry-redux';
|
||||
import { ACTIONS, Lbry, selectMyClaimsWithoutChannels, doNotify } from 'lbry-redux';
|
||||
import { selectPendingPublishes } from 'redux/selectors/publish';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import type {
|
||||
UpdatePublishFormData,
|
||||
UpdatePublishFormAction,
|
||||
|
@ -27,7 +26,14 @@ export const doUpdatePublishForm = (publishFormValue: UpdatePublishFormData) =>
|
|||
});
|
||||
|
||||
export const doPrepareEdit = (claim: any, uri: string) => (dispatch: Dispatch) => {
|
||||
const { name, amount, channel_name: channelName, value: { stream: { metadata } } } = claim;
|
||||
const {
|
||||
name,
|
||||
amount,
|
||||
channel_name: channelName,
|
||||
value: {
|
||||
stream: { metadata },
|
||||
},
|
||||
} = claim;
|
||||
const {
|
||||
author,
|
||||
description,
|
||||
|
@ -139,12 +145,12 @@ export const doPublish = (params: PublishParams) => (dispatch: Dispatch, getStat
|
|||
type: ACTIONS.PUBLISH_SUCCESS,
|
||||
data: { pendingPublish: { ...publishPayload, isEdit } },
|
||||
});
|
||||
dispatch(doOpenModal(MODALS.PUBLISH, { uri }));
|
||||
dispatch(doNotify({ id: MODALS.PUBLISH }, { uri }));
|
||||
};
|
||||
|
||||
const failure = error => {
|
||||
dispatch({ type: ACTIONS.PUBLISH_FAIL });
|
||||
dispatch(doOpenModal(MODALS.ERROR, { error: error.message }));
|
||||
dispatch(doNotify({ id: MODALS.ERROR }, { error: error.message }));
|
||||
};
|
||||
|
||||
return Lbry.publish(publishPayload).then(success, failure);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import * as ACTIONS from 'constants/action_types';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import Lbryio from 'lbryio';
|
||||
import { doOpenModal, doShowSnackBar } from 'redux/actions/app';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import { doShowSnackBar } from 'redux/actions/app';
|
||||
import { doClaimRewardType, doRewardList } from 'redux/actions/rewards';
|
||||
import {
|
||||
selectEmailToVerify,
|
||||
|
@ -52,7 +53,7 @@ export function doAuthenticate() {
|
|||
dispatch(doFetchInviteStatus());
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch(doOpenModal(MODALS.AUTHENTICATION_FAILURE));
|
||||
dispatch(doNotify({ id: MODALS.AUTHENTICATION_FAILURE }));
|
||||
dispatch({
|
||||
type: ACTIONS.AUTHENTICATION_FAILURE,
|
||||
data: { error },
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
fileInfoReducer,
|
||||
searchReducer,
|
||||
walletReducer,
|
||||
notificationsReducer,
|
||||
} from 'lbry-redux';
|
||||
import navigationReducer from 'redux/reducers/navigation';
|
||||
import rewardsReducer from 'redux/reducers/rewards';
|
||||
|
@ -69,6 +70,7 @@ const reducers = combineReducers({
|
|||
subscriptions: subscriptionsReducer,
|
||||
media: mediaReducer,
|
||||
publish: publishReducer,
|
||||
notifications: notificationsReducer,
|
||||
});
|
||||
|
||||
const bulkThunk = createBulkThunkMiddleware();
|
||||
|
|
|
@ -5588,9 +5588,8 @@ lazy-val@^1.0.3:
|
|||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.3.tgz#bb97b200ef00801d94c317e29dc6ed39e31c5edc"
|
||||
|
||||
lbry-redux@lbryio/lbry-redux:
|
||||
"lbry-redux@file:../lbry-redux":
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/800083dc244191e5f2385ba8df11b85ca5fec8eb"
|
||||
dependencies:
|
||||
amplitude-js "^4.0.0"
|
||||
bluebird "^3.5.1"
|
||||
|
|
Loading…
Add table
Reference in a new issue