move modals to app and use doToast/doError
This commit is contained in:
parent
1359e7873b
commit
24100fac06
72 changed files with 313 additions and 267 deletions
package.json
src/renderer
component
address
app
copyableText
externalLink
fileActions
rewardTile
router
selectThumbnail
snackBar
socialShare
splash
subscribeButton
transactionList
userVerify
walletSend
wunderbar
constants
index.jsmodal
modalAffirmPurchase
modalAuthFailure
modalAutoUpdateConfirm
modalAutoUpdateDownloaded
modalConfirmThumbnailUpload
modalConfirmTransaction
modalCreditIntro
modalDownloading
modalEmailCollection
modalError
modalFileTimeout
modalFirstReward
modalFirstSubscription
modalOpenExternalLink
modalPhoneCollection
modalPublish
modalRemoveFile
modalRevokeClaim
modalRewardApprovalRequired
modalRewardCode
modalRouter
modalSendTip
modalSocialShare
modalTransactionFailed
modalUpgrade
modalWalletDecrypt
modalWalletEncrypt
modalWalletUnlock
modalWelcome
page
redux
scss/component
|
@ -134,7 +134,7 @@
|
||||||
"yarn": "^1.3"
|
"yarn": "^1.3"
|
||||||
},
|
},
|
||||||
"lbrySettings": {
|
"lbrySettings": {
|
||||||
"lbrynetDaemonVersion": "0.30.0",
|
"lbrynetDaemonVersion": "0.30.1rc1",
|
||||||
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
"lbrynetDaemonUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vDAEMONVER/lbrynet-OSNAME.zip",
|
||||||
"lbrynetDaemonDir": "static/daemon",
|
"lbrynetDaemonDir": "static/daemon",
|
||||||
"lbrynetDaemonFileName": "lbrynet"
|
"lbrynetDaemonFileName": "lbrynet"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import Address from './view';
|
import Address from './view';
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
doNotify,
|
doToast,
|
||||||
}
|
}
|
||||||
)(Address);
|
)(Address);
|
||||||
|
|
|
@ -11,8 +11,7 @@ https://github.com/lbryio/lbry-desktop/issues/1945
|
||||||
*/
|
*/
|
||||||
type Props = {
|
type Props = {
|
||||||
address: string,
|
address: string,
|
||||||
noSnackbar: boolean,
|
doToast: ({ message: string }) => void,
|
||||||
doNotify: ({ message: string, displayType: Array<string> }) => void,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class Address extends React.PureComponent<Props> {
|
export default class Address extends React.PureComponent<Props> {
|
||||||
|
@ -25,7 +24,7 @@ export default class Address extends React.PureComponent<Props> {
|
||||||
input: ?HTMLInputElement;
|
input: ?HTMLInputElement;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { address, doNotify, noSnackbar } = this.props;
|
const { address, doToast } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormRow verticallyCentered padded stretch>
|
<FormRow verticallyCentered padded stretch>
|
||||||
|
@ -48,12 +47,9 @@ export default class Address extends React.PureComponent<Props> {
|
||||||
icon={icons.CLIPBOARD}
|
icon={icons.CLIPBOARD}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
clipboard.writeText(address);
|
clipboard.writeText(address);
|
||||||
if (!noSnackbar) {
|
doToast({
|
||||||
doNotify({
|
message: __('Address copied'),
|
||||||
message: __('Address copied'),
|
});
|
||||||
displayType: ['snackbar'],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectPageTitle, selectHistoryIndex, selectActiveHistoryEntry } from 'lbry-redux';
|
import { selectPageTitle, selectHistoryIndex, selectActiveHistoryEntry, doError } from 'lbry-redux';
|
||||||
import { doRecordScroll } from 'redux/actions/navigation';
|
import { doRecordScroll } from 'redux/actions/navigation';
|
||||||
import { selectUser } from 'lbryinc';
|
import { selectUser } from 'lbryinc';
|
||||||
import { doAlertError } from 'redux/actions/app';
|
|
||||||
import { selectThemePath } from 'redux/selectors/settings';
|
import { selectThemePath } from 'redux/selectors/settings';
|
||||||
import App from './view';
|
import App from './view';
|
||||||
|
|
||||||
|
@ -15,7 +14,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
alertError: errorList => dispatch(doAlertError(errorList)),
|
alertError: errorList => dispatch(doError(errorList)),
|
||||||
recordScroll: scrollPosition => dispatch(doRecordScroll(scrollPosition)),
|
recordScroll: scrollPosition => dispatch(doRecordScroll(scrollPosition)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doToast } from 'lbry-redux';
|
||||||
import CopyableText from './view';
|
import CopyableText from './view';
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
null,
|
null,
|
||||||
{
|
{
|
||||||
doNotify,
|
doToast,
|
||||||
}
|
}
|
||||||
)(CopyableText);
|
)(CopyableText);
|
||||||
|
|
|
@ -4,15 +4,10 @@ import { clipboard } from 'electron';
|
||||||
import { FormRow } from 'component/common/form';
|
import { FormRow } from 'component/common/form';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import * as icons from 'constants/icons';
|
import * as icons from 'constants/icons';
|
||||||
/*
|
|
||||||
noSnackbar added due to issue 1945
|
|
||||||
https://github.com/lbryio/lbry-desktop/issues/1945
|
|
||||||
"Snackbars and modals can't be displayed at the same time"
|
|
||||||
*/
|
|
||||||
type Props = {
|
type Props = {
|
||||||
copyable: string,
|
copyable: string,
|
||||||
noSnackbar: boolean,
|
doToast: ({ message: string }) => void,
|
||||||
doNotify: ({ message: string, displayType: Array<string> }) => void,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class CopyableText extends React.PureComponent<Props> {
|
export default class CopyableText extends React.PureComponent<Props> {
|
||||||
|
@ -25,7 +20,7 @@ export default class CopyableText extends React.PureComponent<Props> {
|
||||||
input: ?HTMLInputElement;
|
input: ?HTMLInputElement;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { copyable, doNotify, noSnackbar } = this.props;
|
const { copyable, doToast, noSnackbar } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormRow verticallyCentered padded stretch>
|
<FormRow verticallyCentered padded stretch>
|
||||||
|
@ -49,12 +44,9 @@ export default class CopyableText extends React.PureComponent<Props> {
|
||||||
icon={icons.CLIPBOARD}
|
icon={icons.CLIPBOARD}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
clipboard.writeText(copyable);
|
clipboard.writeText(copyable);
|
||||||
if (!noSnackbar) {
|
doToast({
|
||||||
doNotify({
|
message: __('Text copied'),
|
||||||
message: __('Text copied'),
|
});
|
||||||
displayType: ['snackbar'],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</FormRow>
|
</FormRow>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import ExternalLink from './view';
|
import ExternalLink from './view';
|
||||||
|
|
||||||
const select = () => ({});
|
const select = () => ({});
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(ExternalLink);
|
export default connect(select, perform)(ExternalLink);
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
|
import * as ICONS from 'constants/icons';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { MODALS, isURIValid } from 'lbry-redux';
|
import { isURIValid } from 'lbry-redux';
|
||||||
import * as icons from 'constants/icons';
|
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -9,7 +10,7 @@ type Props = {
|
||||||
title?: string,
|
title?: string,
|
||||||
children: React.Node,
|
children: React.Node,
|
||||||
navigate: (string, ?{}) => void,
|
navigate: (string, ?{}) => void,
|
||||||
openModal: ({ id: string }, { uri: string }) => void,
|
openModal: (id: string, { uri: string }) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExternalLink extends React.PureComponent<Props> {
|
class ExternalLink extends React.PureComponent<Props> {
|
||||||
|
@ -33,11 +34,11 @@ class ExternalLink extends React.PureComponent<Props> {
|
||||||
element = (
|
element = (
|
||||||
<Button
|
<Button
|
||||||
button="link"
|
button="link"
|
||||||
iconRight={icons.EXTERNAL_LINK}
|
iconRight={ICONS.EXTERNAL_LINK}
|
||||||
title={title || href}
|
title={title || href}
|
||||||
label={children}
|
label={children}
|
||||||
className="btn--external-link"
|
className="btn--external-link"
|
||||||
onClick={() => openModal({ id: MODALS.CONFIRM_EXTERNAL_LINK }, { uri: href })}
|
onClick={() => openModal(MODALS.CONFIRM_EXTERNAL_LINK, { uri: href })}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {
|
||||||
makeSelectCostInfoForUri,
|
makeSelectCostInfoForUri,
|
||||||
makeSelectFileInfoForUri,
|
makeSelectFileInfoForUri,
|
||||||
makeSelectClaimIsMine,
|
makeSelectClaimIsMine,
|
||||||
doNotify,
|
doOpenModal,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import FileActions from './view';
|
import FileActions from './view';
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ const select = (state, props) => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(FileActions);
|
export default connect(select, perform)(FileActions);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
|
import * as ICONS from 'constants/icons';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import { MODALS } from 'lbry-redux';
|
|
||||||
import * as icons from 'constants/icons';
|
|
||||||
import Tooltip from 'component/common/tooltip';
|
import Tooltip from 'component/common/tooltip';
|
||||||
|
|
||||||
type FileInfo = {
|
type FileInfo = {
|
||||||
|
@ -12,7 +12,7 @@ type FileInfo = {
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
claimId: string,
|
claimId: string,
|
||||||
openModal: ({ id: string }, { uri: string }) => void,
|
openModal: (id: string, { uri: string }) => void,
|
||||||
claimIsMine: boolean,
|
claimIsMine: boolean,
|
||||||
fileInfo: FileInfo,
|
fileInfo: FileInfo,
|
||||||
};
|
};
|
||||||
|
@ -28,9 +28,9 @@ class FileActions extends React.PureComponent<Props> {
|
||||||
<Tooltip onComponent body={__('Delete this file')}>
|
<Tooltip onComponent body={__('Delete this file')}>
|
||||||
<Button
|
<Button
|
||||||
button="alt"
|
button="alt"
|
||||||
icon={icons.TRASH}
|
icon={ICONS.TRASH}
|
||||||
description={__('Delete')}
|
description={__('Delete')}
|
||||||
onClick={() => openModal({ id: MODALS.CONFIRM_FILE_REMOVE }, { uri })}
|
onClick={() => openModal(MODALS.CONFIRM_FILE_REMOVE, { uri })}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
@ -38,7 +38,7 @@ class FileActions extends React.PureComponent<Props> {
|
||||||
<Tooltip onComponent body={__('Report content')}>
|
<Tooltip onComponent body={__('Report content')}>
|
||||||
<Button
|
<Button
|
||||||
button="alt"
|
button="alt"
|
||||||
icon={icons.REPORT}
|
icon={ICONS.REPORT}
|
||||||
href={`https://lbry.io/dmca?claim_id=${claimId}`}
|
href={`https://lbry.io/dmca?claim_id=${claimId}`}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { MODALS, doNotify } from 'lbry-redux';
|
import { doOpenModal } from 'lbry-redux';
|
||||||
import RewardTile from './view';
|
import RewardTile from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
openRewardCodeModal: () => dispatch(doNotify({ id: MODALS.REWARD_GENERATED_CODE })),
|
openRewardCodeModal: () => dispatch(doOpenModal(MODALS.REWARD_GENERATED_CODE)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectCurrentPage, selectCurrentParams, doNotify } from 'lbry-redux';
|
import { selectCurrentPage, selectCurrentParams } from 'lbry-redux';
|
||||||
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import Router from './view';
|
import Router from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -7,4 +8,4 @@ const select = state => ({
|
||||||
currentPage: selectCurrentPage(state),
|
currentPage: selectCurrentPage(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, { doNotify })(Router);
|
export default connect(select, { doOpenModal })(Router);
|
||||||
|
|
|
@ -23,9 +23,8 @@ import UserHistoryPage from 'page/userHistory';
|
||||||
const route = (props, page, routesMap) => {
|
const route = (props, page, routesMap) => {
|
||||||
const component = routesMap[page];
|
const component = routesMap[page];
|
||||||
if (!component) {
|
if (!component) {
|
||||||
props.doNotify({
|
props.doToast({
|
||||||
message: __('Invalid page requested'),
|
message: __('Invalid page requested'),
|
||||||
displayType: ['snackbar'],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return component || routesMap.discover;
|
return component || routesMap.discover;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import SelectThumbnail from './view';
|
import SelectThumbnail from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { THUMBNAIL_STATUSES, MODALS } from 'lbry-redux';
|
import * as MODALS from 'constants/modal_types';
|
||||||
|
import { THUMBNAIL_STATUSES } from 'lbry-redux';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FormField } from 'component/common/form';
|
import { FormField } from 'component/common/form';
|
||||||
import FileSelector from 'component/common/file-selector';
|
import FileSelector from 'component/common/file-selector';
|
||||||
|
@ -118,7 +119,7 @@ class SelectThumbnail extends React.PureComponent<Props, State> {
|
||||||
currentPath={thumbnailPath}
|
currentPath={thumbnailPath}
|
||||||
fileLabel={__('Choose Thumbnail')}
|
fileLabel={__('Choose Thumbnail')}
|
||||||
filters={filters}
|
filters={filters}
|
||||||
onFileChosen={path => openModal({ id: MODALS.CONFIRM_THUMBNAIL_UPLOAD }, { path })}
|
onFileChosen={path => openModal(MODALS.CONFIRM_THUMBNAIL_UPLOAD, { path })}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{status === THUMBNAIL_STATUSES.COMPLETE && (
|
{status === THUMBNAIL_STATUSES.COMPLETE && (
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectSnack, doHideNotification } from 'lbry-redux';
|
import { selectToast, doDismissToast } from 'lbry-redux';
|
||||||
import SnackBar from './view';
|
import SnackBar from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
removeSnack: () => dispatch(doHideNotification()),
|
removeSnack: () => dispatch(doDismissToast()),
|
||||||
});
|
});
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
snack: selectSnack(state),
|
snack: selectToast(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(SnackBar);
|
export default connect(select, perform)(SnackBar);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import classnames from 'classnames';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
removeSnack: any => void,
|
removeSnack: any => void,
|
||||||
|
@ -27,7 +28,7 @@ class SnackBar extends React.PureComponent<Props> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { message, linkText, linkTarget } = snack;
|
const { message, linkText, linkTarget, isError } = snack;
|
||||||
|
|
||||||
if (this.hideTimeout === null) {
|
if (this.hideTimeout === null) {
|
||||||
this.hideTimeout = setTimeout(() => {
|
this.hideTimeout = setTimeout(() => {
|
||||||
|
@ -37,7 +38,9 @@ class SnackBar extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="snack-bar">
|
<div className={classnames("snack-bar", {
|
||||||
|
"snack-bar--error": isError
|
||||||
|
})}>
|
||||||
<div className="snack-bar__message">
|
<div className="snack-bar__message">
|
||||||
<div>ⓘ</div>
|
<div>ⓘ</div>
|
||||||
<div>{message}</div>
|
<div>{message}</div>
|
||||||
|
|
|
@ -46,7 +46,7 @@ class SocialShare extends React.PureComponent<Props> {
|
||||||
{speechShareable && (
|
{speechShareable && (
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
<label className="card__subtitle">{__('Web link')}</label>
|
<label className="card__subtitle">{__('Web link')}</label>
|
||||||
<CopyableText copyable={speechURL} noSnackbar />
|
<CopyableText copyable={speechURL} />
|
||||||
<div className="card__actions card__actions--center">
|
<div className="card__actions card__actions--center">
|
||||||
<ToolTip onComponent body={__('Facebook')}>
|
<ToolTip onComponent body={__('Facebook')}>
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectDaemonVersionMatched } from 'redux/selectors/app';
|
import { selectDaemonVersionMatched, selectModal } from 'redux/selectors/app';
|
||||||
import { selectNotification } from 'lbry-redux';
|
|
||||||
import { doCheckDaemonVersion, doNotifyUnlockWallet } from 'redux/actions/app';
|
import { doCheckDaemonVersion, doNotifyUnlockWallet } from 'redux/actions/app';
|
||||||
import SplashScreen from './view';
|
import SplashScreen from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
notification: selectNotification(state),
|
modal: selectModal(state),
|
||||||
daemonVersionMatched: selectDaemonVersionMatched(state),
|
daemonVersionMatched: selectDaemonVersionMatched(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Lbry, MODALS } from 'lbry-redux';
|
import * as MODALS from 'constants/modal_types';
|
||||||
|
import { Lbry } from 'lbry-redux';
|
||||||
import ModalWalletUnlock from 'modal/modalWalletUnlock';
|
import ModalWalletUnlock from 'modal/modalWalletUnlock';
|
||||||
import ModalIncompatibleDaemon from 'modal/modalIncompatibleDaemon';
|
import ModalIncompatibleDaemon from 'modal/modalIncompatibleDaemon';
|
||||||
import ModalUpgrade from 'modal/modalUpgrade';
|
import ModalUpgrade from 'modal/modalUpgrade';
|
||||||
|
@ -13,7 +14,7 @@ type Props = {
|
||||||
daemonVersionMatched: boolean,
|
daemonVersionMatched: boolean,
|
||||||
onReadyToLaunch: () => void,
|
onReadyToLaunch: () => void,
|
||||||
authenticate: () => void,
|
authenticate: () => void,
|
||||||
notification: ?{
|
modal: ?{
|
||||||
id: string,
|
id: string,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -125,12 +126,11 @@ export class SplashScreen extends React.PureComponent<Props, State> {
|
||||||
hasRecordedUser: boolean;
|
hasRecordedUser: boolean;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { notification } = this.props;
|
const { modal } = this.props;
|
||||||
const { message, details, isRunning } = this.state;
|
const { message, details, isRunning } = this.state;
|
||||||
|
|
||||||
const notificationId = notification && notification.id;
|
const modalId = modal && modal.id;
|
||||||
|
|
||||||
// {notificationId === MODALS.WALLET_UNLOCK && <ModalWalletUnlock />}
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<LoadScreen message={message} details={details} />
|
<LoadScreen message={message} details={details} />
|
||||||
|
@ -139,10 +139,10 @@ export class SplashScreen extends React.PureComponent<Props, State> {
|
||||||
in the modals won't work. */}
|
in the modals won't work. */}
|
||||||
{isRunning && (
|
{isRunning && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{notificationId === MODALS.WALLET_UNLOCK && <ModalWalletUnlock />}
|
{modalId === MODALS.WALLET_UNLOCK && <ModalWalletUnlock />}
|
||||||
{notificationId === MODALS.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
|
{modalId === MODALS.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
|
||||||
{notificationId === MODALS.UPGRADE && <ModalUpgrade />}
|
{modalId === MODALS.UPGRADE && <ModalUpgrade />}
|
||||||
{notificationId === MODALS.DOWNLOADING && <ModalDownloading />}
|
{modalId === MODALS.DOWNLOADING && <ModalDownloading />}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
||||||
import { doNotify } from 'lbry-redux';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { selectSubscriptions, makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
import { selectSubscriptions, makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||||
import SubscribeButton from './view';
|
import SubscribeButton from './view';
|
||||||
|
|
||||||
|
@ -14,6 +14,6 @@ export default connect(
|
||||||
{
|
{
|
||||||
doChannelSubscribe,
|
doChannelSubscribe,
|
||||||
doChannelUnsubscribe,
|
doChannelUnsubscribe,
|
||||||
doNotify,
|
doOpenModal,
|
||||||
}
|
}
|
||||||
)(SubscribeButton);
|
)(SubscribeButton);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
|
import * as ICONS from 'constants/icons';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { MODALS } from 'lbry-redux';
|
|
||||||
import * as icons from 'constants/icons';
|
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
|
||||||
type SubscribtionArgs = {
|
type SubscribtionArgs = {
|
||||||
|
@ -16,7 +16,7 @@ type Props = {
|
||||||
subscriptions: Array<string>,
|
subscriptions: Array<string>,
|
||||||
doChannelSubscribe: ({ channelName: string, uri: string }) => void,
|
doChannelSubscribe: ({ channelName: string, uri: string }) => void,
|
||||||
doChannelUnsubscribe: SubscribtionArgs => void,
|
doChannelUnsubscribe: SubscribtionArgs => void,
|
||||||
doNotify: ({ id: string }) => void,
|
doOpenModal: ({ id: string }) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (props: Props) => {
|
export default (props: Props) => {
|
||||||
|
@ -25,7 +25,7 @@ export default (props: Props) => {
|
||||||
uri,
|
uri,
|
||||||
doChannelSubscribe,
|
doChannelSubscribe,
|
||||||
doChannelUnsubscribe,
|
doChannelUnsubscribe,
|
||||||
doNotify,
|
doOpenModal,
|
||||||
subscriptions,
|
subscriptions,
|
||||||
isSubscribed,
|
isSubscribed,
|
||||||
} = props;
|
} = props;
|
||||||
|
@ -36,14 +36,14 @@ export default (props: Props) => {
|
||||||
return channelName && uri ? (
|
return channelName && uri ? (
|
||||||
<Button
|
<Button
|
||||||
iconColor="red"
|
iconColor="red"
|
||||||
icon={isSubscribed ? undefined : icons.HEART}
|
icon={isSubscribed ? undefined : ICONS.HEART}
|
||||||
button="alt"
|
button="alt"
|
||||||
label={subscriptionLabel}
|
label={subscriptionLabel}
|
||||||
onClick={e => {
|
onClick={e => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
if (!subscriptions.length) {
|
if (!subscriptions.length) {
|
||||||
doNotify({ id: MODALS.FIRST_SUBSCRIPTION });
|
doOpenModal(MODALS.FIRST_SUBSCRIPTION);
|
||||||
}
|
}
|
||||||
subscriptionHandler({
|
subscriptionHandler({
|
||||||
channelName,
|
channelName,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectClaimedRewardsByTransactionId } from 'lbryinc';
|
import { selectClaimedRewardsByTransactionId } from 'lbryinc';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import {
|
import {
|
||||||
selectAllMyClaimsByOutpoint,
|
selectAllMyClaimsByOutpoint,
|
||||||
doNotify,
|
|
||||||
selectTransactionListFilter,
|
selectTransactionListFilter,
|
||||||
doSetTransactionListFilter,
|
doSetTransactionListFilter,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
@ -17,7 +17,7 @@ const select = state => ({
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||||
setTransactionFilter: filterSetting => dispatch(doSetTransactionListFilter(filterSetting)),
|
setTransactionFilter: filterSetting => dispatch(doSetTransactionListFilter(filterSetting)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
import * as ICONS from 'constants/icons';
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FormField } from 'component/common/form';
|
import { FormField } from 'component/common/form';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import FileExporter from 'component/common/file-exporter';
|
import FileExporter from 'component/common/file-exporter';
|
||||||
import * as icons from 'constants/icons';
|
import { TRANSACTIONS } from 'lbry-redux';
|
||||||
import { MODALS, TRANSACTIONS } from 'lbry-redux';
|
|
||||||
import TransactionListItem from './internal/transaction-list-item';
|
import TransactionListItem from './internal/transaction-list-item';
|
||||||
|
|
||||||
export type Transaction = {
|
export type Transaction = {
|
||||||
|
@ -61,7 +62,7 @@ class TransactionList extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
revokeClaim(txid: string, nout: number) {
|
revokeClaim(txid: string, nout: number) {
|
||||||
this.props.openModal({ id: MODALS.CONFIRM_CLAIM_REVOKE }, { txid, nout });
|
this.props.openModal(MODALS.CONFIRM_CLAIM_REVOKE, { txid, nout });
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -100,7 +101,7 @@ class TransactionList extends React.PureComponent<Props> {
|
||||||
postfix={
|
postfix={
|
||||||
<Button
|
<Button
|
||||||
button="link"
|
button="link"
|
||||||
icon={icons.HELP}
|
icon={ICONS.HELP}
|
||||||
href="https://lbry.io/faq/transaction-types"
|
href="https://lbry.io/faq/transaction-types"
|
||||||
title={__('Help')}
|
title={__('Help')}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doNotify, MODALS } from 'lbry-redux';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import {
|
import {
|
||||||
doUserIdentityVerify,
|
doUserIdentityVerify,
|
||||||
|
@ -23,7 +24,7 @@ const select = state => {
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
navigate: uri => dispatch(doNavigate(uri)),
|
navigate: uri => dispatch(doNavigate(uri)),
|
||||||
verifyUserIdentity: token => dispatch(doUserIdentityVerify(token)),
|
verifyUserIdentity: token => dispatch(doUserIdentityVerify(token)),
|
||||||
verifyPhone: () => dispatch(doNotify({ id: MODALS.PHONE_COLLECTION })),
|
verifyPhone: () => dispatch(doOpenModal(MODALS.PHONE_COLLECTION)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectBalance, doNotify } from 'lbry-redux';
|
import { selectBalance } from 'lbry-redux';
|
||||||
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import WalletSend from './view';
|
import WalletSend from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||||
});
|
});
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { MODALS } from 'lbry-redux';
|
import * as MODALS from 'constants/modal_types';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import { Form, FormRow, FormField } from 'component/common/form';
|
import { Form, FormRow, FormField } from 'component/common/form';
|
||||||
import { Formik } from 'formik';
|
import { Formik } from 'formik';
|
||||||
|
@ -27,9 +27,8 @@ class WalletSend extends React.PureComponent<Props> {
|
||||||
const { openModal } = this.props;
|
const { openModal } = this.props;
|
||||||
const { address, amount } = values;
|
const { address, amount } = values;
|
||||||
if (amount && address) {
|
if (amount && address) {
|
||||||
const notificationId = { id: MODALS.CONFIRM_TRANSACTION };
|
|
||||||
const modalProps = { address, amount };
|
const modalProps = { address, amount };
|
||||||
openModal(notificationId, modalProps);
|
openModal(MODALS.CONFIRM_TRANSACTION, modalProps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
doFocusSearchInput,
|
doFocusSearchInput,
|
||||||
doBlurSearchInput,
|
doBlurSearchInput,
|
||||||
doSearch,
|
doSearch,
|
||||||
doNotify,
|
doToast,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import * as settings from 'constants/settings';
|
import * as settings from 'constants/settings';
|
||||||
|
@ -39,7 +39,7 @@ const perform = dispatch => ({
|
||||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||||
doFocus: () => dispatch(doFocusSearchInput()),
|
doFocus: () => dispatch(doFocusSearchInput()),
|
||||||
doBlur: () => dispatch(doBlurSearchInput()),
|
doBlur: () => dispatch(doBlurSearchInput()),
|
||||||
doShowSnackBar: (modal, props) => dispatch(doNotify(modal, props)),
|
doShowSnackBar: (props) => dispatch(doToast(props)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -107,7 +107,6 @@ class WunderBar extends React.PureComponent<Props> {
|
||||||
} else {
|
} else {
|
||||||
this.props.doShowSnackBar({
|
this.props.doShowSnackBar({
|
||||||
message: __('Invalid LBRY URL entered. Only A-Z, a-z, and - allowed.'),
|
message: __('Invalid LBRY URL entered. Only A-Z, a-z, and - allowed.'),
|
||||||
displayType: ['snackbar'],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ export const DAEMON_READY = 'DAEMON_READY';
|
||||||
export const DAEMON_VERSION_MATCH = 'DAEMON_VERSION_MATCH';
|
export const DAEMON_VERSION_MATCH = 'DAEMON_VERSION_MATCH';
|
||||||
export const DAEMON_VERSION_MISMATCH = 'DAEMON_VERSION_MISMATCH';
|
export const DAEMON_VERSION_MISMATCH = 'DAEMON_VERSION_MISMATCH';
|
||||||
export const VOLUME_CHANGED = 'VOLUME_CHANGED';
|
export const VOLUME_CHANGED = 'VOLUME_CHANGED';
|
||||||
|
export const SHOW_MODAL = 'SHOW_MODAL';
|
||||||
|
export const HIDE_MODAL = 'HIDE_MODAL';
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
export const CHANGE_AFTER_AUTH_PATH = 'CHANGE_AFTER_AUTH_PATH';
|
export const CHANGE_AFTER_AUTH_PATH = 'CHANGE_AFTER_AUTH_PATH';
|
||||||
|
|
30
src/renderer/constants/modal_types.js
Normal file
30
src/renderer/constants/modal_types.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
export const CONFIRM_FILE_REMOVE = 'confirm_file_remove';
|
||||||
|
export const CONFIRM_EXTERNAL_LINK = 'confirm_external_link';
|
||||||
|
export const INCOMPATIBLE_DAEMON = 'incompatible_daemon';
|
||||||
|
export const FILE_TIMEOUT = 'file_timeout';
|
||||||
|
export const DOWNLOADING = 'downloading';
|
||||||
|
export const AUTO_UPDATE_DOWNLOADED = 'auto_update_downloaded';
|
||||||
|
export const AUTO_UPDATE_CONFIRM = 'auto_update_confirm';
|
||||||
|
export const ERROR = 'error';
|
||||||
|
export const INSUFFICIENT_CREDITS = 'insufficient_credits';
|
||||||
|
export const UPGRADE = 'upgrade';
|
||||||
|
export const WELCOME = 'welcome';
|
||||||
|
export const EMAIL_COLLECTION = 'email_collection';
|
||||||
|
export const PHONE_COLLECTION = 'phone_collection';
|
||||||
|
export const FIRST_REWARD = 'first_reward';
|
||||||
|
export const AUTHENTICATION_FAILURE = 'auth_failure';
|
||||||
|
export const TRANSACTION_FAILED = 'transaction_failed';
|
||||||
|
export const REWARD_APPROVAL_REQUIRED = 'reward_approval_required';
|
||||||
|
export const REWARD_GENERATED_CODE = 'reward_generated_code';
|
||||||
|
export const AFFIRM_PURCHASE = 'affirm_purchase';
|
||||||
|
export const CONFIRM_CLAIM_REVOKE = 'confirm_claim_revoke';
|
||||||
|
export const FIRST_SUBSCRIPTION = 'firstSubscription';
|
||||||
|
export const SEND_TIP = 'send_tip';
|
||||||
|
export const SOCIAL_SHARE = 'social_share';
|
||||||
|
export const PUBLISH = 'publish';
|
||||||
|
export const SEARCH = 'search';
|
||||||
|
export const CONFIRM_TRANSACTION = 'confirm_transaction';
|
||||||
|
export const CONFIRM_THUMBNAIL_UPLOAD = 'confirm_thumbnail_upload';
|
||||||
|
export const WALLET_ENCRYPT = 'wallet_encrypt';
|
||||||
|
export const WALLET_DECRYPT = 'wallet_decrypt';
|
||||||
|
export const WALLET_UNLOCK = 'wallet_unlock';
|
|
@ -10,7 +10,7 @@ import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { doConditionalAuthNavigate, doDaemonReady, doAutoUpdate } from 'redux/actions/app';
|
import { doConditionalAuthNavigate, doDaemonReady, doAutoUpdate } from 'redux/actions/app';
|
||||||
import { doNotify, doBlackListedOutpointsSubscribe, isURIValid } from 'lbry-redux';
|
import { doToast, doBlackListedOutpointsSubscribe, isURIValid } from 'lbry-redux';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
|
import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings';
|
||||||
import { doUserEmailVerify, doAuthenticate, Lbryio } from 'lbryinc';
|
import { doUserEmailVerify, doAuthenticate, Lbryio } from 'lbryinc';
|
||||||
|
@ -74,9 +74,8 @@ ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
|
||||||
app.store.dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
|
app.store.dispatch(doUserEmailVerify(verification.token, verification.recaptcha));
|
||||||
} else {
|
} else {
|
||||||
app.store.dispatch(
|
app.store.dispatch(
|
||||||
doNotify({
|
doToast({
|
||||||
message: 'Invalid Verification URI',
|
message: 'Invalid Verification URI',
|
||||||
displayType: ['snackbar'],
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -87,9 +86,8 @@ ipcRenderer.on('open-uri-requested', (event, uri, newSession) => {
|
||||||
app.store.dispatch(doNavigate('/show', { uri }));
|
app.store.dispatch(doNavigate('/show', { uri }));
|
||||||
} else {
|
} else {
|
||||||
app.store.dispatch(
|
app.store.dispatch(
|
||||||
doNotify({
|
doToast({
|
||||||
message: __('Invalid LBRY URL requested'),
|
message: __('Invalid LBRY URL requested'),
|
||||||
displayType: ['snackbar'],
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doLoadVideo, doSetPlayingUri } from 'redux/actions/content';
|
import { doLoadVideo, doSetPlayingUri } from 'redux/actions/content';
|
||||||
import { doHideNotification, makeSelectMetadataForUri } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
|
import { makeSelectMetadataForUri } from 'lbry-redux';
|
||||||
import ModalAffirmPurchase from './view';
|
import ModalAffirmPurchase from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -10,9 +11,9 @@ const select = (state, props) => ({
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
cancelPurchase: () => {
|
cancelPurchase: () => {
|
||||||
dispatch(doSetPlayingUri(null));
|
dispatch(doSetPlayingUri(null));
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
},
|
},
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
loadVideo: uri => dispatch(doLoadVideo(uri)),
|
loadVideo: uri => dispatch(doLoadVideo(uri)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalAuthFailure from './view';
|
import ModalAuthFailure from './view';
|
||||||
|
|
||||||
const select = () => ({});
|
const select = () => ({});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
close: () => dispatch(doHideNotification()),
|
close: () => dispatch(doHideModal()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doAutoUpdateDeclined } from 'redux/actions/app';
|
import { doAutoUpdateDeclined, doHideModal } from 'redux/actions/app';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
|
||||||
import ModalAutoUpdateConfirm from './view';
|
import ModalAutoUpdateConfirm from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
|
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doAutoUpdateDeclined } from 'redux/actions/app';
|
import { doAutoUpdateDeclined, doHideModal } from 'redux/actions/app';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
|
||||||
import ModalAutoUpdateDownloaded from './view';
|
import ModalAutoUpdateDownloaded from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
|
declineAutoUpdate: () => dispatch(doAutoUpdateDeclined()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import { doUploadThumbnail, doUpdatePublishForm } from 'redux/actions/publish';
|
import { doUploadThumbnail, doUpdatePublishForm } from 'redux/actions/publish';
|
||||||
import { selectPublishFormValues } from 'redux/selectors/publish';
|
import { selectPublishFormValues } from 'redux/selectors/publish';
|
||||||
import ModalConfirmThumbnailUpload from './view';
|
import ModalConfirmThumbnailUpload from './view';
|
||||||
|
@ -10,7 +10,7 @@ const select = state => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
upload: (path, nsfw = false) => dispatch(doUploadThumbnail(path, nsfw)),
|
upload: (path, nsfw = false) => dispatch(doUploadThumbnail(path, nsfw)),
|
||||||
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification, doSendDraftTransaction } from 'lbry-redux';
|
import { doSendDraftTransaction } from 'lbry-redux';
|
||||||
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalConfirmTransaction from './view';
|
import ModalConfirmTransaction from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
sendToAddress: (address, amount) => dispatch(doSendDraftTransaction(address, amount)),
|
sendToAddress: (address, amount) => dispatch(doSendDraftTransaction(address, amount)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { connect } from 'react-redux';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import { doSetClientSetting } from 'redux/actions/settings';
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
import { selectUserIsRewardApproved, selectUnclaimedRewardValue } from 'lbryinc';
|
import { selectUserIsRewardApproved, selectUnclaimedRewardValue } from 'lbryinc';
|
||||||
import { selectBalance, doHideNotification } from 'lbry-redux';
|
import { selectBalance } from 'lbry-redux';
|
||||||
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import * as settings from 'constants/settings';
|
import * as settings from 'constants/settings';
|
||||||
import ModalCreditIntro from './view';
|
import ModalCreditIntro from './view';
|
||||||
|
|
||||||
|
@ -16,11 +17,11 @@ const perform = dispatch => () => ({
|
||||||
addBalance: () => {
|
addBalance: () => {
|
||||||
dispatch(doSetClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED, true));
|
dispatch(doSetClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED, true));
|
||||||
dispatch(doNavigate('/getcredits'));
|
dispatch(doNavigate('/getcredits'));
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
},
|
},
|
||||||
closeModal: () => {
|
closeModal: () => {
|
||||||
dispatch(doSetClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED, true));
|
dispatch(doSetClientSetting(settings.CREDIT_REQUIRED_ACKNOWLEDGED, true));
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doStartUpgrade, doCancelUpgrade } from 'redux/actions/app';
|
import { doStartUpgrade, doCancelUpgrade, doHideModal } from 'redux/actions/app';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
|
||||||
import {
|
import {
|
||||||
selectDownloadProgress,
|
selectDownloadProgress,
|
||||||
selectDownloadComplete,
|
selectDownloadComplete,
|
||||||
|
@ -17,7 +16,7 @@ const select = state => ({
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
startUpgrade: () => dispatch(doStartUpgrade()),
|
startUpgrade: () => dispatch(doStartUpgrade()),
|
||||||
cancelUpgrade: () => {
|
cancelUpgrade: () => {
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
dispatch(doCancelUpgrade());
|
dispatch(doCancelUpgrade());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as settings from 'constants/settings';
|
import * as settings from 'constants/settings';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import { doSetClientSetting } from 'redux/actions/settings';
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
import { selectEmailToVerify, selectUser } from 'lbryinc';
|
import { selectEmailToVerify, selectUser } from 'lbryinc';
|
||||||
import ModalEmailCollection from './view';
|
import ModalEmailCollection from './view';
|
||||||
|
@ -13,7 +13,7 @@ const select = state => ({
|
||||||
const perform = dispatch => () => ({
|
const perform = dispatch => () => ({
|
||||||
closeModal: () => {
|
closeModal: () => {
|
||||||
dispatch(doSetClientSetting(settings.EMAIL_COLLECTION_ACKNOWLEDGED, true));
|
dispatch(doSetClientSetting(settings.EMAIL_COLLECTION_ACKNOWLEDGED, true));
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doDismissError } from 'lbry-redux';
|
||||||
import ModalError from './view';
|
import ModalError from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doDismissError()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, perform)(ModalError);
|
export default connect(null, perform)(ModalError);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification, makeSelectMetadataForUri } from 'lbry-redux';
|
import { makeSelectMetadataForUri } from 'lbry-redux';
|
||||||
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalFileTimeout from './view';
|
import ModalFileTimeout from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -7,7 +8,7 @@ const select = (state, props) => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(ModalFileTimeout);
|
export default connect(select, perform)(ModalFileTimeout);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { rewards, makeSelectRewardByType } from 'lbryinc';
|
import { rewards, makeSelectRewardByType } from 'lbryinc';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalFirstReward from './view';
|
import ModalFirstReward from './view';
|
||||||
|
|
||||||
const select = state => {
|
const select = state => {
|
||||||
|
@ -12,7 +12,7 @@ const select = state => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import ModalFirstSubscription from './view';
|
import ModalFirstSubscription from './view';
|
||||||
|
|
||||||
const perform = dispatch => () => ({
|
const perform = dispatch => () => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
navigate: path => dispatch(doNavigate(path)),
|
navigate: path => dispatch(doNavigate(path)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalOpenExternalLink from './view';
|
import ModalOpenExternalLink from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, perform)(ModalOpenExternalLink);
|
export default connect(null, perform)(ModalOpenExternalLink);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import { selectPhoneToVerify, selectUser } from 'lbryinc';
|
import { selectPhoneToVerify, selectUser } from 'lbryinc';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import ModalPhoneCollection from './view';
|
import ModalPhoneCollection from './view';
|
||||||
|
@ -11,7 +11,7 @@ const select = state => ({
|
||||||
|
|
||||||
const perform = dispatch => () => ({
|
const perform = dispatch => () => ({
|
||||||
closeModal: () => {
|
closeModal: () => {
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
dispatch(doNavigate('/rewards'));
|
dispatch(doNavigate('/rewards'));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalSendTip from './view';
|
import ModalSendTip from './view';
|
||||||
import { doClearPublish } from 'redux/actions/publish';
|
import { doClearPublish } from 'redux/actions/publish';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
clearPublish: () => dispatch(doClearPublish()),
|
clearPublish: () => dispatch(doClearPublish()),
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doDeleteFileAndGoBack } from 'redux/actions/file';
|
import { doDeleteFileAndGoBack } from 'redux/actions/file';
|
||||||
import {
|
import {
|
||||||
doHideNotification,
|
|
||||||
makeSelectTitleForUri,
|
makeSelectTitleForUri,
|
||||||
makeSelectClaimIsMine,
|
makeSelectClaimIsMine,
|
||||||
makeSelectFileInfoForUri,
|
makeSelectFileInfoForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalRemoveFile from './view';
|
import ModalRemoveFile from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -15,7 +15,7 @@ const select = (state, props) => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
deleteFile: (fileInfo, deleteFromComputer, abandonClaim) => {
|
deleteFile: (fileInfo, deleteFromComputer, abandonClaim) => {
|
||||||
dispatch(doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim));
|
dispatch(doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim));
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification, doAbandonClaim, selectTransactionItems } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
|
import { doAbandonClaim, selectTransactionItems } from 'lbry-redux';
|
||||||
import ModalRevokeClaim from './view';
|
import ModalRevokeClaim from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -7,7 +8,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import { doAuthNavigate } from 'redux/actions/navigation';
|
import { doAuthNavigate } from 'redux/actions/navigation';
|
||||||
import ModalRewardApprovalRequired from './view';
|
import ModalRewardApprovalRequired from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
doAuth: () => {
|
doAuth: () => {
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
dispatch(doAuthNavigate());
|
dispatch(doAuthNavigate());
|
||||||
},
|
},
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, perform)(ModalRewardApprovalRequired);
|
export default connect(null, perform)(ModalRewardApprovalRequired);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import {
|
import {
|
||||||
makeSelectClaimRewardError,
|
makeSelectClaimRewardError,
|
||||||
doClaimRewardType,
|
doClaimRewardType,
|
||||||
|
@ -17,7 +17,7 @@ const select = (state): {} => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
submitRewardCode: (code: string) =>
|
submitRewardCode: (code: string) =>
|
||||||
dispatch(doClaimRewardType(REWARD_TYPES.TYPE_REWARD_CODE, { params: { code } })),
|
dispatch(doClaimRewardType(REWARD_TYPES.TYPE_REWARD_CODE, { params: { code } })),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import * as settings from 'constants/settings';
|
import * as settings from 'constants/settings';
|
||||||
import {
|
import {
|
||||||
doNotify,
|
|
||||||
selectCostForCurrentPageUri,
|
selectCostForCurrentPageUri,
|
||||||
selectBalance,
|
selectBalance,
|
||||||
selectCurrentPage,
|
selectCurrentPage,
|
||||||
selectNotification,
|
selectError,
|
||||||
selectNotificationProps,
|
doToast
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import { selectUser, selectUserIsVerificationCandidate } from 'lbryinc';
|
import { selectUser, selectUserIsVerificationCandidate } from 'lbryinc';
|
||||||
|
import { selectModal } from 'redux/selectors/app';
|
||||||
|
|
||||||
import ModalRouter from './view';
|
import ModalRouter from './view';
|
||||||
|
|
||||||
|
@ -24,12 +24,12 @@ const select = state => ({
|
||||||
),
|
),
|
||||||
isWelcomeAcknowledged: makeSelectClientSetting(settings.NEW_USER_ACKNOWLEDGED)(state),
|
isWelcomeAcknowledged: makeSelectClientSetting(settings.NEW_USER_ACKNOWLEDGED)(state),
|
||||||
user: selectUser(state),
|
user: selectUser(state),
|
||||||
notification: selectNotification(state),
|
modal: selectModal(state),
|
||||||
notificationProps: selectNotificationProps(state),
|
error: selectError(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
openModal: notification => dispatch(doNotify(notification)),
|
showToast: props => dispatch(doToast(props)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { MODALS } from 'lbry-redux';
|
import * as MODALS from 'constants/modal_types';
|
||||||
import ModalError from 'modal/modalError';
|
import ModalError from 'modal/modalError';
|
||||||
import ModalAuthFailure from 'modal/modalAuthFailure';
|
import ModalAuthFailure from 'modal/modalAuthFailure';
|
||||||
import ModalDownloading from 'modal/modalDownloading';
|
import ModalDownloading from 'modal/modalDownloading';
|
||||||
|
@ -70,7 +70,7 @@ class ModalRouter extends React.PureComponent<Props> {
|
||||||
transitionModal &&
|
transitionModal &&
|
||||||
(transitionModal !== this.state.lastTransitionModal || page !== this.state.lastTransitionPage)
|
(transitionModal !== this.state.lastTransitionModal || page !== this.state.lastTransitionPage)
|
||||||
) {
|
) {
|
||||||
openModal({ id: transitionModal });
|
openModal(transitionModal);
|
||||||
this.setState({
|
this.setState({
|
||||||
lastTransitionModal: transitionModal,
|
lastTransitionModal: transitionModal,
|
||||||
lastTransitionPage: page,
|
lastTransitionPage: page,
|
||||||
|
@ -121,73 +121,75 @@ class ModalRouter extends React.PureComponent<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { notification, notificationProps } = this.props;
|
const { modal, error } = this.props;
|
||||||
|
|
||||||
if (!notification) {
|
if (error) {
|
||||||
|
return <ModalError {...error} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!modal) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notification.error) {
|
const { id, modalProps } = modal;
|
||||||
return <ModalError {...notification} {...notificationProps} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (notification.id) {
|
switch (id) {
|
||||||
case MODALS.UPGRADE:
|
case MODALS.UPGRADE:
|
||||||
return <ModalUpgrade {...notificationProps} />;
|
return <ModalUpgrade {...modalProps} />;
|
||||||
case MODALS.DOWNLOADING:
|
case MODALS.DOWNLOADING:
|
||||||
return <ModalDownloading {...notificationProps} />;
|
return <ModalDownloading {...modalProps} />;
|
||||||
case MODALS.AUTO_UPDATE_DOWNLOADED:
|
case MODALS.AUTO_UPDATE_DOWNLOADED:
|
||||||
return <ModalAutoUpdateDownloaded {...notificationProps} />;
|
return <ModalAutoUpdateDownloaded {...modalProps} />;
|
||||||
case MODALS.AUTO_UPDATE_CONFIRM:
|
case MODALS.AUTO_UPDATE_CONFIRM:
|
||||||
return <ModalAutoUpdateConfirm {...notificationProps} />;
|
return <ModalAutoUpdateConfirm {...modalProps} />;
|
||||||
case MODALS.ERROR:
|
case MODALS.ERROR:
|
||||||
return <ModalError {...notificationProps} />;
|
return <ModalError {...modalProps} />;
|
||||||
case MODALS.FILE_TIMEOUT:
|
case MODALS.FILE_TIMEOUT:
|
||||||
return <ModalFileTimeout {...notificationProps} />;
|
return <ModalFileTimeout {...modalProps} />;
|
||||||
case MODALS.INSUFFICIENT_CREDITS:
|
case MODALS.INSUFFICIENT_CREDITS:
|
||||||
return <ModalCreditIntro {...notificationProps} />;
|
return <ModalCreditIntro {...modalProps} />;
|
||||||
case MODALS.WELCOME:
|
case MODALS.WELCOME:
|
||||||
return <ModalWelcome {...notificationProps} />;
|
return <ModalWelcome {...modalProps} />;
|
||||||
case MODALS.FIRST_REWARD:
|
case MODALS.FIRST_REWARD:
|
||||||
return <ModalFirstReward {...notificationProps} />;
|
return <ModalFirstReward {...modalProps} />;
|
||||||
case MODALS.AUTHENTICATION_FAILURE:
|
case MODALS.AUTHENTICATION_FAILURE:
|
||||||
return <ModalAuthFailure {...notificationProps} />;
|
return <ModalAuthFailure {...modalProps} />;
|
||||||
case MODALS.TRANSACTION_FAILED:
|
case MODALS.TRANSACTION_FAILED:
|
||||||
return <ModalTransactionFailed {...notificationProps} />;
|
return <ModalTransactionFailed {...modalProps} />;
|
||||||
case MODALS.REWARD_APPROVAL_REQUIRED:
|
case MODALS.REWARD_APPROVAL_REQUIRED:
|
||||||
return <ModalRewardApprovalRequired {...notificationProps} />;
|
return <ModalRewardApprovalRequired {...modalProps} />;
|
||||||
case MODALS.CONFIRM_FILE_REMOVE:
|
case MODALS.CONFIRM_FILE_REMOVE:
|
||||||
return <ModalRemoveFile {...notificationProps} />;
|
return <ModalRemoveFile {...modalProps} />;
|
||||||
case MODALS.AFFIRM_PURCHASE:
|
case MODALS.AFFIRM_PURCHASE:
|
||||||
return <ModalAffirmPurchase {...notificationProps} />;
|
return <ModalAffirmPurchase {...modalProps} />;
|
||||||
case MODALS.CONFIRM_CLAIM_REVOKE:
|
case MODALS.CONFIRM_CLAIM_REVOKE:
|
||||||
return <ModalRevokeClaim {...notificationProps} />;
|
return <ModalRevokeClaim {...modalProps} />;
|
||||||
case MODALS.PHONE_COLLECTION:
|
case MODALS.PHONE_COLLECTION:
|
||||||
return <ModalPhoneCollection {...notificationProps} />;
|
return <ModalPhoneCollection {...modalProps} />;
|
||||||
case MODALS.EMAIL_COLLECTION:
|
case MODALS.EMAIL_COLLECTION:
|
||||||
return <ModalEmailCollection {...notificationProps} />;
|
return <ModalEmailCollection {...modalProps} />;
|
||||||
case MODALS.FIRST_SUBSCRIPTION:
|
case MODALS.FIRST_SUBSCRIPTION:
|
||||||
return <ModalFirstSubscription {...notificationProps} />;
|
return <ModalFirstSubscription {...modalProps} />;
|
||||||
case MODALS.SEND_TIP:
|
case MODALS.SEND_TIP:
|
||||||
return <ModalSendTip {...notificationProps} />;
|
return <ModalSendTip {...modalProps} />;
|
||||||
case MODALS.SOCIAL_SHARE:
|
case MODALS.SOCIAL_SHARE:
|
||||||
return <ModalSocialShare {...notificationProps} />;
|
return <ModalSocialShare {...modalProps} />;
|
||||||
case MODALS.PUBLISH:
|
case MODALS.PUBLISH:
|
||||||
return <ModalPublish {...notificationProps} />;
|
return <ModalPublish {...modalProps} />;
|
||||||
case MODALS.CONFIRM_EXTERNAL_LINK:
|
case MODALS.CONFIRM_EXTERNAL_LINK:
|
||||||
return <ModalOpenExternalLink {...notificationProps} />;
|
return <ModalOpenExternalLink {...modalProps} />;
|
||||||
case MODALS.CONFIRM_TRANSACTION:
|
case MODALS.CONFIRM_TRANSACTION:
|
||||||
return <ModalConfirmTransaction {...notificationProps} />;
|
return <ModalConfirmTransaction {...modalProps} />;
|
||||||
case MODALS.CONFIRM_THUMBNAIL_UPLOAD:
|
case MODALS.CONFIRM_THUMBNAIL_UPLOAD:
|
||||||
return <ModalConfirmThumbnailUpload {...notificationProps} />;
|
return <ModalConfirmThumbnailUpload {...modalProps} />;
|
||||||
case MODALS.WALLET_ENCRYPT:
|
case MODALS.WALLET_ENCRYPT:
|
||||||
return <ModalWalletEncrypt {...notificationProps} />;
|
return <ModalWalletEncrypt {...modalProps} />;
|
||||||
case MODALS.WALLET_DECRYPT:
|
case MODALS.WALLET_DECRYPT:
|
||||||
return <ModalWalletDecrypt {...notificationProps} />;
|
return <ModalWalletDecrypt {...modalProps} />;
|
||||||
case MODALS.WALLET_UNLOCK:
|
case MODALS.WALLET_UNLOCK:
|
||||||
return <ModalWalletUnlock {...notificationProps} />;
|
return <ModalWalletUnlock {...modalProps} />;
|
||||||
case MODALS.REWARD_GENERATED_CODE:
|
case MODALS.REWARD_GENERATED_CODE:
|
||||||
return <ModalRewardCode {...notificationProps} />;
|
return <ModalRewardCode {...modalProps} />;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalSendTip from './view';
|
import ModalSendTip from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(null, perform)(ModalSendTip);
|
export default connect(null, perform)(ModalSendTip);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalSocialShare from './view';
|
import ModalSocialShare from './view';
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalTransactionFailed from './view';
|
import ModalTransactionFailed from './view';
|
||||||
|
|
||||||
const select = () => ({});
|
const select = () => ({});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doDownloadUpgrade, doSkipUpgrade, doHideModal } from 'redux/actions/app';
|
||||||
import { doDownloadUpgrade, doSkipUpgrade } from 'redux/actions/app';
|
|
||||||
import ModalUpgrade from './view';
|
import ModalUpgrade from './view';
|
||||||
|
|
||||||
const select = () => ({});
|
const select = () => ({});
|
||||||
|
@ -8,7 +7,7 @@ const select = () => ({});
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
downloadUpgrade: () => dispatch(doDownloadUpgrade()),
|
downloadUpgrade: () => dispatch(doDownloadUpgrade()),
|
||||||
skipUpgrade: () => {
|
skipUpgrade: () => {
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
dispatch(doSkipUpgrade());
|
dispatch(doSkipUpgrade());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
doHideNotification,
|
|
||||||
doWalletStatus,
|
doWalletStatus,
|
||||||
doWalletDecrypt,
|
doWalletDecrypt,
|
||||||
selectWalletDecryptSucceeded,
|
selectWalletDecryptSucceeded,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalWalletDecrypt from './view';
|
import ModalWalletDecrypt from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -12,7 +12,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
decryptWallet: password => dispatch(doWalletDecrypt(password)),
|
decryptWallet: password => dispatch(doWalletDecrypt(password)),
|
||||||
updateWalletStatus: () => dispatch(doWalletStatus()),
|
updateWalletStatus: () => dispatch(doWalletStatus()),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
doHideNotification,
|
|
||||||
doWalletStatus,
|
doWalletStatus,
|
||||||
doWalletEncrypt,
|
doWalletEncrypt,
|
||||||
selectWalletEncryptPending,
|
selectWalletEncryptPending,
|
||||||
selectWalletEncryptSucceeded,
|
selectWalletEncryptSucceeded,
|
||||||
selectWalletEncryptResult,
|
selectWalletEncryptResult,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import ModalWalletEncrypt from './view';
|
import ModalWalletEncrypt from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -15,7 +15,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
encryptWallet: password => dispatch(doWalletEncrypt(password)),
|
encryptWallet: password => dispatch(doWalletEncrypt(password)),
|
||||||
updateWalletStatus: () => dispatch(doWalletStatus()),
|
updateWalletStatus: () => dispatch(doWalletStatus()),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
doHideNotification,
|
|
||||||
doWalletUnlock,
|
doWalletUnlock,
|
||||||
selectWalletUnlockPending,
|
selectWalletUnlockPending,
|
||||||
selectWalletUnlockSucceeded,
|
selectWalletUnlockSucceeded,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { doQuit } from 'redux/actions/app';
|
import { doQuit, doHideModal } from 'redux/actions/app';
|
||||||
import ModalWalletUnlock from './view';
|
import ModalWalletUnlock from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -13,7 +12,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
closeModal: () => dispatch(doHideNotification()),
|
closeModal: () => dispatch(doHideModal()),
|
||||||
quit: () => dispatch(doQuit()),
|
quit: () => dispatch(doQuit()),
|
||||||
unlockWallet: password => dispatch(doWalletUnlock(password)),
|
unlockWallet: password => dispatch(doWalletUnlock(password)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import * as settings from 'constants/settings';
|
import * as settings from 'constants/settings';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doHideNotification } from 'lbry-redux';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import { doSetClientSetting } from 'redux/actions/settings';
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
import ModalWelcome from './view';
|
import ModalWelcome from './view';
|
||||||
|
|
||||||
const perform = dispatch => () => ({
|
const perform = dispatch => () => ({
|
||||||
closeModal: () => {
|
closeModal: () => {
|
||||||
dispatch(doSetClientSetting(settings.NEW_USER_ACKNOWLEDGED, true));
|
dispatch(doSetClientSetting(settings.NEW_USER_ACKNOWLEDGED, true));
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,12 @@ import {
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectContentTypeForUri,
|
makeSelectContentTypeForUri,
|
||||||
makeSelectMetadataForUri,
|
makeSelectMetadataForUri,
|
||||||
doNotify,
|
|
||||||
makeSelectChannelForClaimUri,
|
makeSelectChannelForClaimUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectShowNsfw, makeSelectClientSetting } from 'redux/selectors/settings';
|
import { selectShowNsfw, makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||||
import { doPrepareEdit } from 'redux/actions/publish';
|
import { doPrepareEdit } from 'redux/actions/publish';
|
||||||
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import FilePage from './view';
|
import FilePage from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -41,7 +41,7 @@ const perform = dispatch => ({
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||||
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
||||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||||
openModal: (modal, props) => dispatch(doNotify(modal, props)),
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||||
prepareEdit: (publishData, uri) => dispatch(doPrepareEdit(publishData, uri)),
|
prepareEdit: (publishData, uri) => dispatch(doPrepareEdit(publishData, uri)),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
setViewed: uri => dispatch(doSetContentHistoryItem(uri)),
|
setViewed: uri => dispatch(doSetContentHistoryItem(uri)),
|
||||||
|
|
|
@ -3,7 +3,8 @@ import type { Claim, Metadata } from 'types/claim';
|
||||||
import type { FileInfo } from 'types/file_info';
|
import type { FileInfo } from 'types/file_info';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as settings from 'constants/settings';
|
import * as settings from 'constants/settings';
|
||||||
import { buildURI, normalizeURI, MODALS } from 'lbry-redux';
|
import * as MODALS from 'constants/modal_types';
|
||||||
|
import { buildURI, normalizeURI } from 'lbry-redux';
|
||||||
import FileViewer from 'component/fileViewer';
|
import FileViewer from 'component/fileViewer';
|
||||||
import Thumbnail from 'component/common/thumbnail';
|
import Thumbnail from 'component/common/thumbnail';
|
||||||
import FilePrice from 'component/filePrice';
|
import FilePrice from 'component/filePrice';
|
||||||
|
@ -42,7 +43,7 @@ type Props = {
|
||||||
channelUri: string,
|
channelUri: string,
|
||||||
prepareEdit: ({}, string) => void,
|
prepareEdit: ({}, string) => void,
|
||||||
navigate: (string, ?{}) => void,
|
navigate: (string, ?{}) => void,
|
||||||
openModal: ({ id: string }, { uri: string }) => void,
|
openModal: (id: string, { uri: string }) => void,
|
||||||
setClientSetting: (string, string | boolean | number) => void,
|
setClientSetting: (string, string | boolean | number) => void,
|
||||||
markSubscriptionRead: (string, string) => void,
|
markSubscriptionRead: (string, string) => void,
|
||||||
};
|
};
|
||||||
|
@ -214,14 +215,14 @@ class FilePage extends React.Component<Props> {
|
||||||
button="alt"
|
button="alt"
|
||||||
icon={icons.GIFT}
|
icon={icons.GIFT}
|
||||||
label={__('Send a tip')}
|
label={__('Send a tip')}
|
||||||
onClick={() => openModal({ id: MODALS.SEND_TIP }, { uri })}
|
onClick={() => openModal(MODALS.SEND_TIP, { uri })}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
button="alt"
|
button="alt"
|
||||||
icon={icons.GLOBE}
|
icon={icons.GLOBE}
|
||||||
label={__('Share')}
|
label={__('Share')}
|
||||||
onClick={() => openModal({ id: MODALS.SOCIAL_SHARE }, { uri, speechShareable })}
|
onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, speechShareable })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import { FormRow, FormField } from 'component/common/form';
|
import { FormRow, FormField } from 'component/common/form';
|
||||||
import { Lbry, doNotify } from 'lbry-redux';
|
import { Lbry, doToast } from 'lbry-redux';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
|
|
||||||
class ReportPage extends React.Component {
|
class ReportPage extends React.Component {
|
||||||
|
@ -32,7 +32,7 @@ class ReportPage extends React.Component {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Display global notice
|
// Display global notice
|
||||||
const action = doNotify({
|
const action = doToast({
|
||||||
displayType: ['snackbar'],
|
displayType: ['snackbar'],
|
||||||
message: __('Message received! Thanks for helping.'),
|
message: __('Message received! Thanks for helping.'),
|
||||||
isError: false,
|
isError: false,
|
||||||
|
|
|
@ -2,15 +2,13 @@ import { execSync } from 'child_process';
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { ipcRenderer, remote } from 'electron';
|
import { ipcRenderer, remote } from 'electron';
|
||||||
|
import * as ACTIONS from 'constants/action_types';
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
import {
|
import {
|
||||||
ACTIONS,
|
|
||||||
Lbry,
|
Lbry,
|
||||||
doBalanceSubscribe,
|
doBalanceSubscribe,
|
||||||
doFetchFileInfosAndPublishedClaims,
|
doFetchFileInfosAndPublishedClaims,
|
||||||
doNotify,
|
|
||||||
selectNotification,
|
selectNotification,
|
||||||
MODALS,
|
|
||||||
doHideNotification,
|
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import Native from 'native';
|
import Native from 'native';
|
||||||
import { doFetchDaemonSettings } from 'redux/actions/settings';
|
import { doFetchDaemonSettings } from 'redux/actions/settings';
|
||||||
|
@ -89,11 +87,9 @@ export function doDownloadUpgrade() {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
type: ACTIONS.UPGRADE_DOWNLOAD_STARTED,
|
||||||
});
|
});
|
||||||
dispatch(doHideNotification());
|
dispatch(doHideModal());
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.DOWNLOADING)
|
||||||
id: MODALS.DOWNLOADING,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -114,17 +110,13 @@ export function doDownloadUpgradeRequested() {
|
||||||
if (autoUpdateDeclined) {
|
if (autoUpdateDeclined) {
|
||||||
// The user declined an update before, so show the "confirm" dialog
|
// The user declined an update before, so show the "confirm" dialog
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.AUTO_UPDATE_CONFIRM)
|
||||||
id: MODALS.AUTO_UPDATE_CONFIRM,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// The user was never shown the original update dialog (e.g. because they were
|
// The user was never shown the original update dialog (e.g. because they were
|
||||||
// watching a video). So show the inital "update downloaded" dialog.
|
// watching a video). So show the inital "update downloaded" dialog.
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.AUTO_UPDATE_DOWNLOADED)
|
||||||
id: MODALS.AUTO_UPDATE_DOWNLOADED,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -154,9 +146,7 @@ export function doAutoUpdate() {
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.AUTO_UPDATE_DOWNLOADED)
|
||||||
id: MODALS.AUTO_UPDATE_DOWNLOADED,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatch(doClearUpgradeTimer());
|
dispatch(doClearUpgradeTimer());
|
||||||
|
@ -230,9 +220,7 @@ export function doCheckUpgradeAvailable() {
|
||||||
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
(!selectIsUpgradeSkipped(state) || remoteVersion !== selectRemoteVersion(state))
|
||||||
) {
|
) {
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.UPGRADE)
|
||||||
id: MODALS.UPGRADE,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -279,9 +267,7 @@ export function doCheckDaemonVersion() {
|
||||||
});
|
});
|
||||||
|
|
||||||
return dispatch(
|
return dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.INCOMPATIBLE_DAEMON)
|
||||||
id: MODALS.INCOMPATIBLE_DAEMON,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -290,9 +276,7 @@ export function doCheckDaemonVersion() {
|
||||||
export function doNotifyEncryptWallet() {
|
export function doNotifyEncryptWallet() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.WALLET_ENCRYPT)
|
||||||
id: MODALS.WALLET_ENCRYPT,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -300,9 +284,7 @@ export function doNotifyEncryptWallet() {
|
||||||
export function doNotifyDecryptWallet() {
|
export function doNotifyDecryptWallet() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.WALLET_DECRYPT)
|
||||||
id: MODALS.WALLET_DECRYPT,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -310,9 +292,7 @@ export function doNotifyDecryptWallet() {
|
||||||
export function doNotifyUnlockWallet() {
|
export function doNotifyUnlockWallet() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doOpenModal(MODALS.WALLET_UNLOCK)
|
||||||
id: MODALS.WALLET_UNLOCK,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -320,10 +300,7 @@ export function doNotifyUnlockWallet() {
|
||||||
export function doAlertError(errorList) {
|
export function doAlertError(errorList) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(
|
dispatch(
|
||||||
doNotify({
|
doError(errorList)
|
||||||
id: MODALS.ERROR,
|
|
||||||
error: errorList,
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -397,3 +374,19 @@ export function doConditionalAuthNavigate(newSession) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function doOpenModal(id, modalProps = {}) {
|
||||||
|
return {
|
||||||
|
type: ACTIONS.SHOW_MODAL,
|
||||||
|
data: {
|
||||||
|
id,
|
||||||
|
modalProps,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function doHideModal() {
|
||||||
|
return {
|
||||||
|
type: ACTIONS.HIDE_MODAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as NOTIFICATION_TYPES from 'constants/subscriptions';
|
import * as NOTIFICATION_TYPES from 'constants/subscriptions';
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { doAlertError } from 'redux/actions/app';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import { setSubscriptionLatest, doUpdateUnreadSubscriptions } from 'redux/actions/subscriptions';
|
import { setSubscriptionLatest, doUpdateUnreadSubscriptions } from 'redux/actions/subscriptions';
|
||||||
import { makeSelectUnreadByChannel } from 'redux/selectors/subscriptions';
|
import { makeSelectUnreadByChannel } from 'redux/selectors/subscriptions';
|
||||||
|
@ -19,10 +20,9 @@ import {
|
||||||
selectDownloadingByOutpoint,
|
selectDownloadingByOutpoint,
|
||||||
selectTotalDownloadProgress,
|
selectTotalDownloadProgress,
|
||||||
selectBalance,
|
selectBalance,
|
||||||
MODALS,
|
|
||||||
doNotify,
|
|
||||||
makeSelectChannelForClaimUri,
|
makeSelectChannelForClaimUri,
|
||||||
parseURI,
|
parseURI,
|
||||||
|
doError,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { makeSelectClientSetting, selectosNotificationsEnabled } from 'redux/selectors/settings';
|
import { makeSelectClientSetting, selectosNotificationsEnabled } from 'redux/selectors/settings';
|
||||||
import setBadge from 'util/setBadge';
|
import setBadge from 'util/setBadge';
|
||||||
|
@ -180,10 +180,10 @@ function handleLoadVideoError(uri, errorType = '') {
|
||||||
});
|
});
|
||||||
dispatch(doSetPlayingUri(null));
|
dispatch(doSetPlayingUri(null));
|
||||||
if (errorType === 'timeout') {
|
if (errorType === 'timeout') {
|
||||||
doNotify({ id: MODALS.FILE_TIMEOUT }, { uri });
|
doOpenModal(MODALS.FILE_TIMEOUT, { uri });
|
||||||
} else {
|
} else {
|
||||||
dispatch(
|
dispatch(
|
||||||
doAlertError(
|
doError(
|
||||||
`Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`
|
`Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -236,7 +236,7 @@ export function doPurchaseUri(uri, specificCostInfo, shouldRecordViewEvent) {
|
||||||
|
|
||||||
function attemptPlay(cost, instantPurchaseMax = null) {
|
function attemptPlay(cost, instantPurchaseMax = null) {
|
||||||
if (cost > 0 && (!instantPurchaseMax || cost > instantPurchaseMax)) {
|
if (cost > 0 && (!instantPurchaseMax || cost > instantPurchaseMax)) {
|
||||||
dispatch(doNotify({ id: MODALS.AFFIRM_PURCHASE }, { uri }));
|
dispatch(doOpenModal(MODALS.AFFIRM_PURCHASE, { uri }));
|
||||||
} else {
|
} else {
|
||||||
dispatch(doLoadVideo(uri, shouldRecordViewEvent));
|
dispatch(doLoadVideo(uri, shouldRecordViewEvent));
|
||||||
}
|
}
|
||||||
|
@ -264,7 +264,7 @@ export function doPurchaseUri(uri, specificCostInfo, shouldRecordViewEvent) {
|
||||||
|
|
||||||
if (cost > balance) {
|
if (cost > balance) {
|
||||||
dispatch(doSetPlayingUri(null));
|
dispatch(doSetPlayingUri(null));
|
||||||
dispatch(doNotify({ id: MODALS.INSUFFICIENT_CREDITS }));
|
dispatch(doOpenModal(MODALS.INSUFFICIENT_CREDITS));
|
||||||
Promise.resolve();
|
Promise.resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import {
|
||||||
selectMyClaimsOutpoints,
|
selectMyClaimsOutpoints,
|
||||||
selectFileInfosByOutpoint,
|
selectFileInfosByOutpoint,
|
||||||
selectTotalDownloadProgress,
|
selectTotalDownloadProgress,
|
||||||
doHideNotification,
|
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import { doHistoryBack } from 'redux/actions/navigation';
|
import { doHistoryBack } from 'redux/actions/navigation';
|
||||||
import setProgressBar from 'util/setProgressBar';
|
import setProgressBar from 'util/setProgressBar';
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
|
||||||
export function doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim) {
|
export function doDeleteFileAndGoBack(fileInfo, deleteFromComputer, abandonClaim) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
const actions = [];
|
const actions = [];
|
||||||
actions.push(doHideNotification());
|
actions.push(doHideModal());
|
||||||
actions.push(doHistoryBack());
|
actions.push(doHistoryBack());
|
||||||
actions.push(doDeleteFile(fileInfo, deleteFromComputer, abandonClaim));
|
actions.push(doDeleteFile(fileInfo, deleteFromComputer, abandonClaim));
|
||||||
dispatch(batchActions(...actions));
|
dispatch(batchActions(...actions));
|
||||||
|
|
|
@ -6,17 +6,17 @@ import type {
|
||||||
UpdatePublishFormAction,
|
UpdatePublishFormAction,
|
||||||
PublishParams,
|
PublishParams,
|
||||||
} from 'redux/reducers/publish';
|
} from 'redux/reducers/publish';
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
import {
|
import {
|
||||||
ACTIONS,
|
ACTIONS,
|
||||||
Lbry,
|
Lbry,
|
||||||
doNotify,
|
|
||||||
MODALS,
|
|
||||||
selectMyChannelClaims,
|
selectMyChannelClaims,
|
||||||
THUMBNAIL_STATUSES,
|
THUMBNAIL_STATUSES,
|
||||||
batchActions,
|
batchActions,
|
||||||
creditsToString,
|
creditsToString,
|
||||||
selectPendingById,
|
selectPendingById,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
import { selectosNotificationsEnabled } from 'redux/selectors/settings';
|
import { selectosNotificationsEnabled } from 'redux/selectors/settings';
|
||||||
import { doNavigate } from 'redux/actions/navigation';
|
import { doNavigate } from 'redux/actions/navigation';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
@ -97,7 +97,7 @@ export const doUploadThumbnail = (filePath: string, nsfw: boolean) => (
|
||||||
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
type: ACTIONS.UPDATE_PUBLISH_FORM,
|
||||||
data: { uploadThumbnailStatus: THUMBNAIL_STATUSES.API_DOWN },
|
data: { uploadThumbnailStatus: THUMBNAIL_STATUSES.API_DOWN },
|
||||||
},
|
},
|
||||||
dispatch(doNotify({ id: MODALS.ERROR, error }))
|
dispatch(doOpenModal({ id: MODALS.ERROR, error }))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -266,12 +266,12 @@ export const doPublish = (params: PublishParams) => (
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.PUBLISH_SUCCESS,
|
type: ACTIONS.PUBLISH_SUCCESS,
|
||||||
});
|
});
|
||||||
dispatch(doNotify({ id: MODALS.PUBLISH }, { uri }));
|
dispatch(doOpenModal(MODALS.PUBLISH, { uri }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const failure = error => {
|
const failure = error => {
|
||||||
dispatch({ type: ACTIONS.PUBLISH_FAIL });
|
dispatch({ type: ACTIONS.PUBLISH_FAIL });
|
||||||
dispatch(doNotify({ id: MODALS.ERROR, error: error.message }));
|
dispatch(doError(error.message));
|
||||||
};
|
};
|
||||||
|
|
||||||
return Lbry.publish(publishPayload).then(success, failure);
|
return Lbry.publish(publishPayload).then(success, failure);
|
||||||
|
|
|
@ -189,6 +189,18 @@ reducers[ACTIONS.CLEAR_UPGRADE_TIMER] = state =>
|
||||||
checkUpgradeTimer: undefined,
|
checkUpgradeTimer: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.SHOW_MODAL] = (state, action) =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
modal: action.data.id,
|
||||||
|
modalProps: action.data.modalProps,
|
||||||
|
});
|
||||||
|
|
||||||
|
reducers[ACTIONS.HIDE_MODAL] = (state, action) =>
|
||||||
|
Object.assign({}, state, {
|
||||||
|
modal: null,
|
||||||
|
modalProps: null,
|
||||||
|
});
|
||||||
|
|
||||||
export default function reducer(state: AppState = defaultState, action: any) {
|
export default function reducer(state: AppState = defaultState, action: any) {
|
||||||
const handler = reducers[action.type];
|
const handler = reducers[action.type];
|
||||||
if (handler) return handler(state, action);
|
if (handler) return handler(state, action);
|
||||||
|
|
|
@ -247,3 +247,14 @@ export const selectNavLinks = createSelector(
|
||||||
return navLinks;
|
return navLinks;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectModal = createSelector(selectState, state => {
|
||||||
|
if (!state.modal) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: state.modal,
|
||||||
|
modalProps: state.modalProps,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
z-index: 10000; // hack to get it over react modal
|
z-index: 10000; // hack to get it over react modal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.snack-bar--error {
|
||||||
|
background-color: $lbry-red-5;
|
||||||
|
}
|
||||||
|
|
||||||
.snack-bar__action {
|
.snack-bar__action {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
|
Loading…
Add table
Reference in a new issue