Move modals types constants to lbry-redux repository. #1438

Merged
dan1d merged 1 commit from move-modal-types into master 2018-05-08 06:56:01 +02:00
15 changed files with 47 additions and 75 deletions

View file

@ -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<Props> {
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 && (

View file

@ -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<any>,
@ -115,9 +114,9 @@ export class SplashScreen extends React.PureComponent<Props, State> {
in the modals won't work. */}
{isRunning && (
<React.Fragment>
{notificationId === modals.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
{notificationId === modals.UPGRADE && <ModalUpgrade />}
{notificationId === modals.DOWNLOADING && <ModalDownloading />}
{notificationId === MODALS.INCOMPATIBLE_DAEMON && <ModalIncompatibleDaemon />}
{notificationId === MODALS.UPGRADE && <ModalUpgrade />}
{notificationId === MODALS.DOWNLOADING && <ModalDownloading />}
</React.Fragment>
)}
</React.Fragment>

View file

@ -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,

View file

@ -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<Props, State> {
}
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() {

View file

@ -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);

View file

@ -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';

View file

@ -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';

View file

@ -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 <ModalUpgrade {...notificationProps} />;
case modals.DOWNLOADING:
case MODALS.DOWNLOADING:
return <ModalDownloading {...notificationProps} />;
case modals.AUTO_UPDATE_DOWNLOADED:
case MODALS.AUTO_UPDATE_DOWNLOADED:
return <ModalAutoUpdateDownloaded {...notificationProps} />;
case modals.AUTO_UPDATE_CONFIRM:
case MODALS.AUTO_UPDATE_CONFIRM:
return <ModalAutoUpdateConfirm {...notificationProps} />;
case modals.ERROR:
case MODALS.ERROR:
return <ModalError {...notificationProps} />;
case modals.FILE_TIMEOUT:
case MODALS.FILE_TIMEOUT:
return <ModalFileTimeout {...notificationProps} />;
case modals.INSUFFICIENT_CREDITS:
case MODALS.INSUFFICIENT_CREDITS:
return <ModalCreditIntro {...notificationProps} />;
case modals.WELCOME:
case MODALS.WELCOME:
return <ModalWelcome {...notificationProps} />;
case modals.FIRST_REWARD:
case MODALS.FIRST_REWARD:
return <ModalFirstReward {...notificationProps} />;
case modals.AUTHENTICATION_FAILURE:
case MODALS.AUTHENTICATION_FAILURE:
return <ModalAuthFailure {...notificationProps} />;
case modals.TRANSACTION_FAILED:
case MODALS.TRANSACTION_FAILED:
return <ModalTransactionFailed {...notificationProps} />;
case modals.REWARD_APPROVAL_REQUIRED:
case MODALS.REWARD_APPROVAL_REQUIRED:
return <ModalRewardApprovalRequired {...notificationProps} />;
case modals.CONFIRM_FILE_REMOVE:
case MODALS.CONFIRM_FILE_REMOVE:
return <ModalRemoveFile {...notificationProps} />;
case modals.AFFIRM_PURCHASE:
case MODALS.AFFIRM_PURCHASE:
return <ModalAffirmPurchase {...notificationProps} />;
case modals.CONFIRM_CLAIM_REVOKE:
case MODALS.CONFIRM_CLAIM_REVOKE:
return <ModalRevokeClaim {...notificationProps} />;
case modals.PHONE_COLLECTION:
case MODALS.PHONE_COLLECTION:
return <ModalPhoneCollection {...notificationProps} />;
case modals.EMAIL_COLLECTION:
case MODALS.EMAIL_COLLECTION:
return <ModalEmailCollection {...notificationProps} />;
case modals.FIRST_SUBSCRIPTION:
case MODALS.FIRST_SUBSCRIPTION:
return <ModalFirstSubscription {...notificationProps} />;
case modals.SEND_TIP:
case MODALS.SEND_TIP:
return <ModalSendTip {...notificationProps} />;
case modals.PUBLISH:
case MODALS.PUBLISH:
return <ModalPublish {...notificationProps} />;
case modals.SEARCH:
case MODALS.SEARCH:
return <ModalSearch {...notificationProps} />;
default:
return null;

View file

@ -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<Props> {
button="alt"
iconRight="Send"
label={__('Enjoy this? Send a tip')}
onClick={() => openModal({ id: modals.SEND_TIP }, { uri })}
onClick={() => openModal({ id: MODALS.SEND_TIP }, { uri })}
/>
<SubscribeButton uri={subscriptionUri} channelName={channelName} />
</React.Fragment>

View file

@ -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';

View file

@ -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';

View file

@ -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,

View file

@ -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';

View file

@ -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,

View file

@ -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';