General bug fixes #1353
52 changed files with 26888 additions and 213 deletions
26722
package-lock.json
generated
Normal file
26722
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doShowSnackBar } from 'redux/actions/app';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import Address from './view';
|
||||
|
||||
export default connect(null, {
|
||||
doShowSnackBar,
|
||||
doNotify,
|
||||
})(Address);
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as icons from 'constants/icons';
|
|||
|
||||
type Props = {
|
||||
address: string,
|
||||
doShowSnackBar: ({ message: string }) => void,
|
||||
doNotify: ({ message: string, displayType: Array<string> }) => void,
|
||||
};
|
||||
|
||||
export default class Address extends React.PureComponent<Props> {
|
||||
|
@ -20,7 +20,7 @@ export default class Address extends React.PureComponent<Props> {
|
|||
input: ?HTMLInputElement;
|
||||
|
||||
render() {
|
||||
const { address, doShowSnackBar } = this.props;
|
||||
const { address, doNotify } = this.props;
|
||||
|
||||
return (
|
||||
<FormRow verticallyCentered padded stretch>
|
||||
|
@ -43,7 +43,10 @@ export default class Address extends React.PureComponent<Props> {
|
|||
icon={icons.CLIPBOARD}
|
||||
onClick={() => {
|
||||
clipboard.writeText(address);
|
||||
doShowSnackBar({ message: __('Address copied') });
|
||||
doNotify({
|
||||
message: __('Address copied'),
|
||||
displayType: ['snackbar']
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</FormRow>
|
||||
|
|
|
@ -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 && (
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
clearShapeShift,
|
||||
getActiveShift,
|
||||
} from 'redux/actions/shape_shift';
|
||||
import { doShowSnackBar, selectReceiveAddress } from 'lbry-redux';
|
||||
import { selectReceiveAddress } from 'lbry-redux';
|
||||
import { selectShapeShift } from 'redux/selectors/shape_shift';
|
||||
import ShapeShift from './view';
|
||||
|
||||
|
@ -21,5 +21,4 @@ export default connect(select, {
|
|||
createShapeShift,
|
||||
clearShapeShift,
|
||||
getActiveShift,
|
||||
doShowSnackBar,
|
||||
})(ShapeShift);
|
||||
|
|
|
@ -14,7 +14,6 @@ type Props = {
|
|||
createShapeShift: Dispatch,
|
||||
clearShapeShift: Dispatch,
|
||||
getActiveShift: Dispatch,
|
||||
doShowSnackBar: Dispatch,
|
||||
shapeShiftInit: Dispatch,
|
||||
receiveAddress: string,
|
||||
};
|
||||
|
@ -37,7 +36,6 @@ class ShapeShift extends React.PureComponent<Props> {
|
|||
shapeShift,
|
||||
clearShapeShift,
|
||||
getActiveShift,
|
||||
doShowSnackBar,
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
|
@ -107,7 +105,6 @@ class ShapeShift extends React.PureComponent<Props> {
|
|||
shiftOrderId={shiftOrderId}
|
||||
shiftState={shiftState}
|
||||
clearShapeShift={clearShapeShift}
|
||||
doShowSnackBar={doShowSnackBar}
|
||||
originCoinDepositMax={originCoinDepositMax}
|
||||
originCoinDepositMin={originCoinDepositMin}
|
||||
originCoinDepositFee={originCoinDepositFee}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doRemoveSnackBarSnack } from 'redux/actions/app';
|
||||
import { selectSnackBarSnacks } from 'redux/selectors/app';
|
||||
import { selectSnack, doHideNotification } from 'lbry-redux';
|
||||
import SnackBar from './view';
|
||||
|
||||
const perform = dispatch => ({
|
||||
removeSnack: () => dispatch(doRemoveSnackBarSnack()),
|
||||
removeSnack: () => dispatch(doHideNotification()),
|
||||
});
|
||||
|
||||
const select = state => ({
|
||||
snacks: selectSnackBarSnacks(state),
|
||||
snack: selectSnack(state),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(SnackBar);
|
||||
|
|
|
@ -4,7 +4,7 @@ import Button from 'component/button';
|
|||
|
||||
type Props = {
|
||||
removeSnack: any => void,
|
||||
snacks: {
|
||||
snack: ?{
|
||||
linkTarget: ?string,
|
||||
linkText: ?string,
|
||||
message: string,
|
||||
|
@ -20,14 +20,13 @@ class SnackBar extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { snacks, removeSnack } = this.props;
|
||||
const { snack, removeSnack } = this.props;
|
||||
|
||||
if (!snacks.length) {
|
||||
if (!snack) {
|
||||
this.hideTimeout = null; // should be unmounting anyway, but be safe?
|
||||
return null;
|
||||
}
|
||||
|
||||
const snack = snacks[0];
|
||||
const { message, linkText, linkTarget } = snack;
|
||||
|
||||
if (this.hideTimeout === null) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -13,7 +13,12 @@ type Props = {
|
|||
|
||||
class WalletAddress extends React.PureComponent<Props> {
|
||||
componentWillMount() {
|
||||
this.props.checkAddressIsMine(this.props.receiveAddress);
|
||||
const { checkAddressIsMine, receiveAddress, getNewAddress } = this.props;
|
||||
if (!receiveAddress) {
|
||||
getNewAddress();
|
||||
} else {
|
||||
checkAddressIsMine(receiveAddress);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -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,7 +1,3 @@
|
|||
export const OPEN_MODAL = 'OPEN_MODAL';
|
||||
export const CLOSE_MODAL = 'CLOSE_MODAL';
|
||||
export const SHOW_SNACKBAR = 'SHOW_SNACKBAR';
|
||||
export const REMOVE_SNACKBAR_SNACK = 'REMOVE_SNACKBAR_SNACK';
|
||||
export const WINDOW_FOCUSED = 'WINDOW_FOCUSED';
|
||||
export const DAEMON_READY = 'DAEMON_READY';
|
||||
export const DAEMON_VERSION_MATCH = 'DAEMON_VERSION_MATCH';
|
||||
|
|
|
@ -10,9 +10,9 @@ import { Provider } from 'react-redux';
|
|||
import {
|
||||
doConditionalAuthNavigate,
|
||||
doDaemonReady,
|
||||
doShowSnackBar,
|
||||
doAutoUpdate,
|
||||
} from 'redux/actions/app';
|
||||
import { doNotify } from 'lbry-redux';
|
||||
import { doNavigate } from 'redux/actions/navigation';
|
||||
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
|
||||
import { doUserEmailVerify } from 'redux/actions/user';
|
||||
|
@ -38,7 +38,10 @@ ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
|
|||
app.store.dispatch(doConditionalAuthNavigate(newSession));
|
||||
app.store.dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
|
||||
} else {
|
||||
app.store.dispatch(doShowSnackBar({ message: 'Invalid Verification URI' }));
|
||||
app.store.dispatch(doNotify({
|
||||
message: 'Invalid Verification URI',
|
||||
displayType: ['snackbar']
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
app.store.dispatch(doNavigate('/show', { uri }));
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { FormRow } from 'component/common/form';
|
||||
import { Lbry } from 'lbry-redux';
|
||||
import { doShowSnackBar } from 'redux/actions/app';
|
||||
import { Lbry, doNotify } from 'lbry-redux';
|
||||
|
||||
class ReportPage extends React.Component {
|
||||
constructor(props) {
|
||||
|
@ -32,7 +31,8 @@ class ReportPage extends React.Component {
|
|||
});
|
||||
|
||||
// Display global notice
|
||||
const action = doShowSnackBar({
|
||||
const action = doNotify({
|
||||
displayType: ['snackbar'],
|
||||
message: __('Message received! Thanks for helping.'),
|
||||
isError: false,
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
@ -100,7 +84,7 @@ export function doDownloadUpgrade() {
|
|||
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
||||
});
|
||||
dispatch({
|
||||
type: ACTIONS.OPEN_MODAL,
|
||||
type: ACTIONS.CREATE_NOTIFICATION,
|
||||
data: {
|
||||
modal: MODALS.DOWNLOADING,
|
||||
},
|
||||
|
@ -127,14 +111,14 @@ export function doDownloadUpgradeRequested() {
|
|||
if (autoUpdateDeclined) {
|
||||
// The user declined an update before, so show the "confirm" dialog
|
||||
dispatch({
|
||||
type: ACTIONS.OPEN_MODAL,
|
||||
type: ACTIONS.CREATE_NOTIFICATION,
|
||||
data: { modal: MODALS.AUTO_UPDATE_CONFIRM },
|
||||
});
|
||||
} else {
|
||||
// The user was never shown the original update dialog (e.g. because they were
|
||||
// watching a video). So show the inital "update downloaded" dialog.
|
||||
dispatch({
|
||||
type: ACTIONS.OPEN_MODAL,
|
||||
type: ACTIONS.CREATE_NOTIFICATION,
|
||||
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
|
||||
});
|
||||
}
|
||||
|
@ -152,7 +136,7 @@ export function doAutoUpdate() {
|
|||
});
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.OPEN_MODAL,
|
||||
type: ACTIONS.CREATE_NOTIFICATION,
|
||||
data: { modal: MODALS.AUTO_UPDATE_DOWNLOADED },
|
||||
});
|
||||
};
|
||||
|
@ -223,7 +207,7 @@ export function doCheckUpgradeAvailable() {
|
|||
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
||||
) {
|
||||
dispatch({
|
||||
type: ACTIONS.OPEN_MODAL,
|
||||
type: ACTIONS.CREATE_NOTIFICATION,
|
||||
data: {
|
||||
modal: MODALS.UPGRADE,
|
||||
},
|
||||
|
@ -273,7 +257,7 @@ export function doCheckDaemonVersion() {
|
|||
export function doAlertError(errorList) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.OPEN_MODAL,
|
||||
type: ACTIONS.CREATE_NOTIFICATION,
|
||||
data: {
|
||||
modal: MODALS.ERROR,
|
||||
modalProps: { error: errorList },
|
||||
|
@ -300,12 +284,6 @@ export function doDaemonReady() {
|
|||
};
|
||||
}
|
||||
|
||||
export function doRemoveSnackBarSnack() {
|
||||
return {
|
||||
type: ACTIONS.REMOVE_SNACKBAR_SNACK,
|
||||
};
|
||||
}
|
||||
|
||||
export function doClearCache() {
|
||||
return () => {
|
||||
window.cacheStore.purge();
|
||||
|
|
|
@ -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,7 @@
|
|||
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 { doClaimRewardType, doRewardList } from 'redux/actions/rewards';
|
||||
import {
|
||||
selectEmailToVerify,
|
||||
|
@ -52,7 +52,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 },
|
||||
|
@ -292,7 +292,8 @@ export function doUserInviteNew(email) {
|
|||
});
|
||||
|
||||
dispatch(
|
||||
doShowSnackBar({
|
||||
doNotify({
|
||||
displayType: ['snackbar'],
|
||||
message: __('Invite sent to %s', email),
|
||||
})
|
||||
);
|
||||
|
|
|
@ -155,59 +155,11 @@ reducers[ACTIONS.CHECK_UPGRADE_SUBSCRIBE] = (state, action) =>
|
|||
checkUpgradeTimer: action.data.checkUpgradeTimer,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.OPEN_MODAL] = (state, action) => {
|
||||
if (!state.modalsAllowed) {
|
||||
return state;
|
||||
}
|
||||
return Object.assign({}, state, {
|
||||
modal: action.data.modal,
|
||||
modalProps: action.data.modalProps || {},
|
||||
});
|
||||
};
|
||||
reducers[ACTIONS.CLOSE_MODAL] = state =>
|
||||
Object.assign({}, state, {
|
||||
modal: undefined,
|
||||
modalProps: {},
|
||||
});
|
||||
|
||||
reducers[ACTIONS.UPGRADE_DOWNLOAD_PROGRESSED] = (state, action) =>
|
||||
Object.assign({}, state, {
|
||||
downloadProgress: action.data.percent,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.SHOW_SNACKBAR] = (state, action) => {
|
||||
const { message, linkText, linkTarget, isError } = action.data;
|
||||
const snackBar = Object.assign({}, state.snackBar);
|
||||
const snacks = Object.assign([], snackBar.snacks);
|
||||
snacks.push({
|
||||
message,
|
||||
linkText,
|
||||
linkTarget,
|
||||
isError,
|
||||
});
|
||||
const newSnackBar = Object.assign({}, snackBar, {
|
||||
snacks,
|
||||
});
|
||||
|
||||
return Object.assign({}, state, {
|
||||
snackBar: newSnackBar,
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.REMOVE_SNACKBAR_SNACK] = state => {
|
||||
const snackBar = Object.assign({}, state.snackBar);
|
||||
const snacks = Object.assign([], snackBar.snacks);
|
||||
snacks.shift();
|
||||
|
||||
const newSnackBar = Object.assign({}, snackBar, {
|
||||
snacks,
|
||||
});
|
||||
|
||||
return Object.assign({}, state, {
|
||||
snackBar: newSnackBar,
|
||||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.DOWNLOADING_COMPLETED] = state => {
|
||||
const { badgeNumber } = state;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Lbry, doShowSnackBar } from 'lbry-redux';
|
||||
import { Lbry, doNotify } from 'lbry-redux';
|
||||
import Lbryio from 'lbryio';
|
||||
|
||||
function rewardMessage(type, amount) {
|
||||
|
@ -51,7 +51,7 @@ rewards.claimReward = type => {
|
|||
const message = rewardMessage(type, reward.reward_amount);
|
||||
|
||||
// Display global notice
|
||||
const action = doShowSnackBar({
|
||||
const action = doNotify({
|
||||
message,
|
||||
linkText: __('Show All'),
|
||||
linkTarget: '/rewards',
|
||||
|
|
|
@ -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…
Reference in a new issue