diff --git a/src/renderer/component/fileActions/view.jsx b/src/renderer/component/fileActions/view.jsx index 1a0c03300..94995d245 100644 --- a/src/renderer/component/fileActions/view.jsx +++ b/src/renderer/component/fileActions/view.jsx @@ -2,7 +2,7 @@ import React from 'react'; import Button from 'component/button'; import FileDownloadLink from 'component/fileDownloadLink'; -import * as modals from 'constants/modal_types'; +import { MODALS } from 'lbry-redux'; import classnames from 'classnames'; import * as icons from 'constants/icons'; @@ -33,7 +33,7 @@ class FileActions extends React.PureComponent { className="btn--file-actions" icon={icons.TRASH} description={__('Delete')} - onClick={() => openModal({ id: modals.CONFIRM_FILE_REMOVE }, { uri })} + onClick={() => openModal({ id: MODALS.CONFIRM_FILE_REMOVE }, { uri })} /> )} {!claimIsMine && ( diff --git a/src/renderer/component/splash/view.jsx b/src/renderer/component/splash/view.jsx index 1bb81518c..5985503c9 100644 --- a/src/renderer/component/splash/view.jsx +++ b/src/renderer/component/splash/view.jsx @@ -1,10 +1,9 @@ import * as React from 'react'; -import { Lbry } from 'lbry-redux'; +import { Lbry, MODALS } from 'lbry-redux'; import LoadScreen from './internal/load-screen'; import ModalIncompatibleDaemon from 'modal/modalIncompatibleDaemon'; import ModalUpgrade from 'modal/modalUpgrade'; import ModalDownloading from 'modal/modalDownloading'; -import * as modals from 'constants/modal_types'; type Props = { checkDaemonVersion: () => Promise, @@ -115,9 +114,9 @@ export class SplashScreen extends React.PureComponent { in the modals won't work. */} {isRunning && ( - {notificationId === modals.INCOMPATIBLE_DAEMON && } - {notificationId === modals.UPGRADE && } - {notificationId === modals.DOWNLOADING && } + {notificationId === MODALS.INCOMPATIBLE_DAEMON && } + {notificationId === MODALS.UPGRADE && } + {notificationId === MODALS.DOWNLOADING && } )} diff --git a/src/renderer/component/subscribeButton/view.jsx b/src/renderer/component/subscribeButton/view.jsx index fce08876f..1a341447f 100644 --- a/src/renderer/component/subscribeButton/view.jsx +++ b/src/renderer/component/subscribeButton/view.jsx @@ -1,6 +1,6 @@ // @flow import React from 'react'; -import * as modals from 'constants/modal_types'; +import { MODALS } from 'lbry-redux'; import * as icons from 'constants/icons'; import Button from 'component/button'; import type { Subscription } from 'redux/reducers/subscriptions'; @@ -42,7 +42,7 @@ export default (props: Props) => { label={subscriptionLabel} onClick={() => { if (!subscriptions.length) { - doNotify({ id: modals.FIRST_SUBSCRIPTION }); + doNotify({ id: MODALS.FIRST_SUBSCRIPTION }); } subscriptionHandler({ channelName, diff --git a/src/renderer/component/transactionList/view.jsx b/src/renderer/component/transactionList/view.jsx index 8316f1291..c0b84be33 100644 --- a/src/renderer/component/transactionList/view.jsx +++ b/src/renderer/component/transactionList/view.jsx @@ -4,7 +4,7 @@ import { FormField } from 'component/common/form'; import Button from 'component/button'; import FileExporter from 'component/common/file-exporter'; import * as icons from 'constants/icons'; -import * as modals from 'constants/modal_types'; +import { MODALS } from 'lbry-redux'; import TransactionListItem from './internal/transaction-list-item'; export type Transaction = { @@ -65,7 +65,7 @@ class TransactionList extends React.PureComponent { } revokeClaim(txid: string, nout: number) { - this.props.openModal({ id: modals.CONFIRM_CLAIM_REVOKE }, { txid, nout }); + this.props.openModal({ id: MODALS.CONFIRM_CLAIM_REVOKE }, { txid, nout }); } render() { diff --git a/src/renderer/component/userVerify/index.js b/src/renderer/component/userVerify/index.js index 3533affbd..a6ca5a554 100644 --- a/src/renderer/component/userVerify/index.js +++ b/src/renderer/component/userVerify/index.js @@ -8,8 +8,7 @@ import { selectIdentityVerifyErrorMessage, } from 'redux/selectors/user'; import UserVerify from './view'; -import { doNotify } from 'lbry-redux'; -import { PHONE_COLLECTION } from 'constants/modal_types'; +import { doNotify, MODALS } from 'lbry-redux'; const select = (state, props) => { const selectReward = makeSelectRewardByType(); @@ -24,7 +23,7 @@ const select = (state, props) => { const perform = dispatch => ({ navigate: uri => dispatch(doNavigate(uri)), verifyUserIdentity: token => dispatch(doUserIdentityVerify(token)), - verifyPhone: () => dispatch(doNotify({ id: PHONE_COLLECTION })), + verifyPhone: () => dispatch(doNotify({ id: MODALS.PHONE_COLLECTION })), }); export default connect(select, perform)(UserVerify); diff --git a/src/renderer/component/wunderbar/index.js b/src/renderer/component/wunderbar/index.js index 20d6f6b94..0d222a721 100644 --- a/src/renderer/component/wunderbar/index.js +++ b/src/renderer/component/wunderbar/index.js @@ -1,11 +1,10 @@ -import * as MODALS from 'constants/modal_types'; import { connect } from 'react-redux'; -import { normalizeURI } from 'lbry-redux'; import { selectSearchState as selectSearch, selectWunderBarAddress, doUpdateSearchQuery, doNotify, + MODALS, } from 'lbry-redux'; import { doNavigate } from 'redux/actions/navigation'; import Wunderbar from './view'; diff --git a/src/renderer/constants/modal_types.js b/src/renderer/constants/modal_types.js deleted file mode 100644 index 3d3a725a2..000000000 --- a/src/renderer/constants/modal_types.js +++ /dev/null @@ -1,22 +0,0 @@ -export const CONFIRM_FILE_REMOVE = 'confirm_file_remove'; -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 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 PUBLISH = 'publish'; -export const SEARCH = 'search'; diff --git a/src/renderer/modal/modalRouter/view.jsx b/src/renderer/modal/modalRouter/view.jsx index 0e45ea0de..e425dddf0 100644 --- a/src/renderer/modal/modalRouter/view.jsx +++ b/src/renderer/modal/modalRouter/view.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import { MODALS } from 'lbry-redux'; import ModalError from 'modal/modalError'; import ModalAuthFailure from 'modal/modalAuthFailure'; import ModalDownloading from 'modal/modalDownloading'; @@ -20,7 +21,6 @@ import ModalFirstSubscription from 'modal/modalFirstSubscription'; import ModalSendTip from '../modalSendTip'; import ModalPublish from '../modalPublish'; import ModalSearch from '../modalSearch'; -import * as modals from 'constants/modal_types'; class ModalRouter extends React.PureComponent { constructor(props) { @@ -68,7 +68,7 @@ class ModalRouter extends React.PureComponent { checkShowWelcome(props) { const { isWelcomeAcknowledged, user } = props; if (!isWelcomeAcknowledged && user && !user.is_reward_approved && !user.is_identity_verified) { - return modals.WELCOME; + return MODALS.WELCOME; } } @@ -80,7 +80,7 @@ class ModalRouter extends React.PureComponent { user && !user.has_verified_email ) { - return modals.EMAIL_COLLECTION; + return MODALS.EMAIL_COLLECTION; } } @@ -92,7 +92,7 @@ class ModalRouter extends React.PureComponent { !isCreditIntroAcknowledged && (['send', 'publish'].includes(page) || this.isPaidShowPage(props)) ) { - return modals.INSUFFICIENT_CREDITS; + return MODALS.INSUFFICIENT_CREDITS; } } @@ -113,47 +113,47 @@ class ModalRouter extends React.PureComponent { } switch (notification.id) { - case modals.UPGRADE: + case MODALS.UPGRADE: return ; - case modals.DOWNLOADING: + case MODALS.DOWNLOADING: return ; - case modals.AUTO_UPDATE_DOWNLOADED: + case MODALS.AUTO_UPDATE_DOWNLOADED: return ; - case modals.AUTO_UPDATE_CONFIRM: + case MODALS.AUTO_UPDATE_CONFIRM: return ; - case modals.ERROR: + case MODALS.ERROR: return ; - case modals.FILE_TIMEOUT: + case MODALS.FILE_TIMEOUT: return ; - case modals.INSUFFICIENT_CREDITS: + case MODALS.INSUFFICIENT_CREDITS: return ; - case modals.WELCOME: + case MODALS.WELCOME: return ; - case modals.FIRST_REWARD: + case MODALS.FIRST_REWARD: return ; - case modals.AUTHENTICATION_FAILURE: + case MODALS.AUTHENTICATION_FAILURE: return ; - case modals.TRANSACTION_FAILED: + case MODALS.TRANSACTION_FAILED: return ; - case modals.REWARD_APPROVAL_REQUIRED: + case MODALS.REWARD_APPROVAL_REQUIRED: return ; - case modals.CONFIRM_FILE_REMOVE: + case MODALS.CONFIRM_FILE_REMOVE: return ; - case modals.AFFIRM_PURCHASE: + case MODALS.AFFIRM_PURCHASE: return ; - case modals.CONFIRM_CLAIM_REVOKE: + case MODALS.CONFIRM_CLAIM_REVOKE: return ; - case modals.PHONE_COLLECTION: + case MODALS.PHONE_COLLECTION: return ; - case modals.EMAIL_COLLECTION: + case MODALS.EMAIL_COLLECTION: return ; - case modals.FIRST_SUBSCRIPTION: + case MODALS.FIRST_SUBSCRIPTION: return ; - case modals.SEND_TIP: + case MODALS.SEND_TIP: return ; - case modals.PUBLISH: + case MODALS.PUBLISH: return ; - case modals.SEARCH: + case MODALS.SEARCH: return ; default: return null; diff --git a/src/renderer/page/file/view.jsx b/src/renderer/page/file/view.jsx index 201d03956..5cbbad39b 100644 --- a/src/renderer/page/file/view.jsx +++ b/src/renderer/page/file/view.jsx @@ -1,6 +1,6 @@ // @flow import * as React from 'react'; -import { Lbry, buildURI, normalizeURI } from 'lbry-redux'; +import { Lbry, buildURI, normalizeURI, MODALS } from 'lbry-redux'; import Video from 'component/video'; import Thumbnail from 'component/common/thumbnail'; import FilePrice from 'component/filePrice'; @@ -14,7 +14,6 @@ import Button from 'component/button'; import SubscribeButton from 'component/subscribeButton'; import Page from 'component/page'; import player from 'render-media'; -import * as modals from 'constants/modal_types'; type Props = { claim: { @@ -171,7 +170,7 @@ class FilePage extends React.Component { button="alt" iconRight="Send" label={__('Enjoy this? Send a tip')} - onClick={() => openModal({ id: modals.SEND_TIP }, { uri })} + onClick={() => openModal({ id: MODALS.SEND_TIP }, { uri })} /> diff --git a/src/renderer/redux/actions/app.js b/src/renderer/redux/actions/app.js index 24e742123..3d6167639 100644 --- a/src/renderer/redux/actions/app.js +++ b/src/renderer/redux/actions/app.js @@ -1,7 +1,6 @@ import { execSync } from 'child_process'; import isDev from 'electron-is-dev'; import path from 'path'; -import * as MODALS from 'constants/modal_types'; import { ipcRenderer, remote } from 'electron'; import { ACTIONS, @@ -10,6 +9,7 @@ import { doFetchFileInfosAndPublishedClaims, doNotify, selectNotification, + MODALS, } from 'lbry-redux'; import Native from 'native'; import { doFetchRewardedContent } from 'redux/actions/content'; diff --git a/src/renderer/redux/actions/content.js b/src/renderer/redux/actions/content.js index cbdbc8496..1ae851565 100644 --- a/src/renderer/redux/actions/content.js +++ b/src/renderer/redux/actions/content.js @@ -1,8 +1,6 @@ -import * as MODALS from 'constants/modal_types'; import * as NOTIFICATION_TYPES from 'constants/notification_types'; import { ipcRenderer } from 'electron'; import Lbryio from 'lbryio'; -import { doNotify } from 'lbry-redux'; import { doAlertError } from 'redux/actions/app'; import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards'; import { doNavigate } from 'redux/actions/navigation'; @@ -27,6 +25,8 @@ import { selectDownloadingByOutpoint, selectTotalDownloadProgress, selectBalance, + MODALS, + doNotify, } from 'lbry-redux'; import { makeSelectClientSetting } from 'redux/selectors/settings'; import setBadge from 'util/setBadge'; diff --git a/src/renderer/redux/actions/publish.js b/src/renderer/redux/actions/publish.js index 1c1a79923..2981299fc 100644 --- a/src/renderer/redux/actions/publish.js +++ b/src/renderer/redux/actions/publish.js @@ -1,6 +1,5 @@ // @flow -import * as MODALS from 'constants/modal_types'; -import { ACTIONS, Lbry, selectMyClaimsWithoutChannels, doNotify } from 'lbry-redux'; +import { ACTIONS, Lbry, selectMyClaimsWithoutChannels, doNotify, MODALS } from 'lbry-redux'; import { selectPendingPublishes } from 'redux/selectors/publish'; import type { UpdatePublishFormData, diff --git a/src/renderer/redux/actions/rewards.js b/src/renderer/redux/actions/rewards.js index 3349a536b..f51b410f2 100644 --- a/src/renderer/redux/actions/rewards.js +++ b/src/renderer/redux/actions/rewards.js @@ -1,5 +1,5 @@ import * as ACTIONS from 'constants/action_types'; -import * as MODALS from 'constants/modal_types'; +import { MODALS } from 'lbry-redux'; import Lbryio from 'lbryio'; import { selectUnclaimedRewardsByType } from 'redux/selectors/rewards'; import { selectUserIsRewardApproved } from 'redux/selectors/user'; diff --git a/src/renderer/redux/actions/user.js b/src/renderer/redux/actions/user.js index 730e0f3b2..8fc5bcb39 100644 --- a/src/renderer/redux/actions/user.js +++ b/src/renderer/redux/actions/user.js @@ -1,7 +1,6 @@ import * as ACTIONS from 'constants/action_types'; -import * as MODALS from 'constants/modal_types'; import Lbryio from 'lbryio'; -import { doNotify } from 'lbry-redux'; +import { doNotify, MODALS } from 'lbry-redux'; import { doClaimRewardType, doRewardList } from 'redux/actions/rewards'; import { selectEmailToVerify, diff --git a/src/renderer/redux/reducers/app.js b/src/renderer/redux/reducers/app.js index ab66a40f8..2cdedcc7c 100644 --- a/src/renderer/redux/reducers/app.js +++ b/src/renderer/redux/reducers/app.js @@ -1,7 +1,7 @@ // @flow import * as ACTIONS from 'constants/action_types'; -import * as MODALS from 'constants/modal_types'; +import { MODALS } from 'lbry-redux'; import { remote } from 'electron';