diff --git a/ui/component/fileDescription/index.js b/ui/component/fileDescription/index.js index d8a119c37..5d8cff218 100644 --- a/ui/component/fileDescription/index.js +++ b/ui/component/fileDescription/index.js @@ -7,7 +7,6 @@ import { } from 'redux/selectors/claims'; import { makeSelectPendingAmountByUri } from 'redux/selectors/wallet'; import { doOpenModal } from 'redux/actions/app'; -import { selectUser } from 'redux/selectors/user'; import FileDescription from './view'; const select = (state, props) => { @@ -17,7 +16,6 @@ const select = (state, props) => { claim, claimIsMine: selectClaimIsMine(state, claim), metadata: makeSelectMetadataForUri(props.uri)(state), - user: selectUser(state), pendingAmount: makeSelectPendingAmountByUri(props.uri)(state), tags: makeSelectTagsForUri(props.uri)(state), }; diff --git a/ui/component/fileDescription/view.jsx b/ui/component/fileDescription/view.jsx index 9d20526c7..ae8abb160 100644 --- a/ui/component/fileDescription/view.jsx +++ b/ui/component/fileDescription/view.jsx @@ -15,7 +15,6 @@ type Props = { uri: string, claim: StreamClaim, metadata: StreamMetadata, - user: ?any, tags: any, pendingAmount: number, doOpenModal: (id: string, {}) => void, diff --git a/ui/component/fileValues/index.js b/ui/component/fileValues/index.js index a3994d7c3..eb633a91f 100644 --- a/ui/component/fileValues/index.js +++ b/ui/component/fileValues/index.js @@ -7,7 +7,6 @@ import { } from 'redux/selectors/claims'; import { makeSelectPendingAmountByUri } from 'redux/selectors/wallet'; import { makeSelectFileInfoForUri } from 'redux/selectors/file_info'; -import { selectUser } from 'redux/selectors/user'; import { doOpenModal } from 'redux/actions/app'; import FileValues from './view'; @@ -20,7 +19,6 @@ const select = (state, props) => { contentType: makeSelectContentTypeForUri(props.uri)(state), fileInfo: makeSelectFileInfoForUri(props.uri)(state), metadata: makeSelectMetadataForUri(props.uri)(state), - user: selectUser(state), pendingAmount: makeSelectPendingAmountByUri(props.uri)(state), claimIsMine: selectClaimIsMine(state, claim), }; diff --git a/ui/component/fileValues/view.jsx b/ui/component/fileValues/view.jsx index f425fc169..f230b5b80 100644 --- a/ui/component/fileValues/view.jsx +++ b/ui/component/fileValues/view.jsx @@ -15,7 +15,6 @@ type Props = { metadata: StreamMetadata, openFolder: (string) => void, contentType: string, - user: ?any, pendingAmount: string, openModal: (id: string, { uri: string }) => void, claimIsMine: boolean, diff --git a/ui/component/inviteList/index.js b/ui/component/inviteList/index.js deleted file mode 100644 index 253a8c266..000000000 --- a/ui/component/inviteList/index.js +++ /dev/null @@ -1,14 +0,0 @@ -import { connect } from 'react-redux'; -import { selectReferralReward } from 'redux/selectors/rewards'; -import { selectUserInvitees, selectUserInviteStatusIsPending } from 'redux/selectors/user'; -import InviteList from './view'; - -const select = state => ({ - invitees: selectUserInvitees(state), - isPending: selectUserInviteStatusIsPending(state), - referralReward: selectReferralReward(state), -}); - -const perform = () => ({}); - -export default connect(select, perform)(InviteList); diff --git a/ui/component/inviteList/view.jsx b/ui/component/inviteList/view.jsx deleted file mode 100644 index fecfa3599..000000000 --- a/ui/component/inviteList/view.jsx +++ /dev/null @@ -1,99 +0,0 @@ -// @flow -import React from 'react'; -import RewardLink from 'component/rewardLink'; -import Icon from 'component/common/icon'; -import * as ICONS from 'constants/icons'; -import Card from 'component/common/card'; -import LbcMessage from 'component/common/lbc-message'; - -type Props = { - invitees: ?Array<{ - email: string, - invite_accepted: boolean, - invite_reward_claimed: boolean, - invite_reward_claimable: boolean, - }>, - referralReward: ?Reward, -}; - -class InviteList extends React.PureComponent { - render() { - const { invitees, referralReward } = this.props; - - if (!invitees || !invitees.length) { - return null; - } - - let rewardAmount = 0; - let rewardHelp = __( - "Woah, you have a lot of friends! You've claimed the maximum amount of invite rewards. Email %email% if you'd like to be whitelisted for more invites.", - { email: 'hello@lbry.com' } - ); - - if (referralReward) { - rewardAmount = referralReward.reward_amount; - rewardHelp = referralReward.reward_description; - } - const showClaimable = invitees.some(invite => invite.invite_reward_claimable && !invite.invite_reward_claimed); - - return ( - {__('Invite History')}} - subtitle={ -
- {rewardHelp} -
- } - titleActions={ - referralReward && - showClaimable && ( -
- -
- ) - } - isBodyList - body={ -
- - - - - - - - - - {invitees.map(invitee => ( - - - - - - ))} - -
{__('Invitee Email')}{__('Invite Status')}{__('Reward')}
{invitee.email} - {invitee.invite_accepted ? __('Accepted') : __('Not Accepted')} - - {invitee.invite_reward_claimed && ( - - {__('Claimed')} - - - )} - - {!invitee.invite_reward_claimed && - (invitee.invite_reward_claimable ? {__('Claimable')} : __('Unclaimable'))} -
-
- } - /> - ); - } -} - -export default InviteList; diff --git a/ui/component/inviteNew/index.js b/ui/component/inviteNew/index.js deleted file mode 100644 index c7cbc0ada..000000000 --- a/ui/component/inviteNew/index.js +++ /dev/null @@ -1,29 +0,0 @@ -import { connect } from 'react-redux'; -import { - selectUserInvitesRemaining, - selectUserInviteNewIsPending, - selectUserInviteNewErrorMessage, - selectUserInviteReferralLink, - selectUserInviteReferralCode, -} from 'redux/selectors/user'; -// import { doUserInviteNew } from 'redux/actions/user'; -import { selectMyChannelClaims, selectFetchingMyChannels } from 'redux/selectors/claims'; -import { doFetchChannelListMine } from 'redux/actions/claims'; -import InviteNew from './view'; - -const select = (state) => ({ - errorMessage: selectUserInviteNewErrorMessage(state), - invitesRemaining: selectUserInvitesRemaining(state), - referralLink: selectUserInviteReferralLink(state), - referralCode: selectUserInviteReferralCode(state), - isPending: selectUserInviteNewIsPending(state), - channels: selectMyChannelClaims(state), - fetchingChannels: selectFetchingMyChannels(state), -}); - -const perform = (dispatch) => ({ - // inviteNew: (email) => dispatch(doUserInviteNew(email)), - fetchChannelListMine: () => dispatch(doFetchChannelListMine()), -}); - -export default connect(select, perform)(InviteNew); diff --git a/ui/component/inviteNew/view.jsx b/ui/component/inviteNew/view.jsx deleted file mode 100644 index 00944d830..000000000 --- a/ui/component/inviteNew/view.jsx +++ /dev/null @@ -1,154 +0,0 @@ -// @flow -import { URL, SITE_NAME } from 'config'; -import React, { useEffect, useState } from 'react'; -import Button from 'component/button'; -import { Form, FormField } from 'component/common/form'; -import CopyableText from 'component/copyableText'; -import Card from 'component/common/card'; -import analytics from 'analytics'; -import I18nMessage from 'component/i18nMessage'; -import LbcSymbol from 'component/common/lbc-symbol'; - -type Props = { - errorMessage: ?string, - inviteNew: (string) => void, - isPending: boolean, - referralLink: string, - referralCode: string, - channels: ?Array, -}; - -function InviteNew(props: Props) { - const { inviteNew, errorMessage, isPending, referralCode = '', channels } = props; - - // Email - const [email, setEmail] = useState(''); - function handleSubmit() { - inviteNew(email); - } - - function handleEmailChanged(event: any) { - setEmail(event.target.value); - } - - // Referral link - const [referralSource, setReferralSource] = useState(referralCode); - - const handleReferralChange = React.useCallback( - (code) => { - setReferralSource(code); - // TODO: keep track of this in an array? - const matchingChannel = channels && channels.find((ch) => ch.name === code); - if (matchingChannel) { - analytics.apiLogPublish(matchingChannel); - } - }, - [setReferralSource] - ); - - const topChannel = - channels && - channels.reduce((top, channel) => { - const topClaimCount = (top && top.meta && top.meta.claims_in_channel) || 0; - const currentClaimCount = (channel && channel.meta && channel.meta.claims_in_channel) || 0; - return topClaimCount >= currentClaimCount ? top : channel; - }); - const referralString = - channels && channels.length && referralSource !== referralCode - ? lookupUrlByClaimName(referralSource, channels) - : referralSource; - - const referral = `${URL}/$/invite/${referralString.replace('#', ':')}`; - - useEffect(() => { - // set default channel - if (topChannel) { - handleReferralChange(topChannel.name); - } - }, [topChannel, handleReferralChange]); - - function lookupUrlByClaimName(name, channels) { - const claim = channels.find((channel) => channel.name === name); - return claim && claim.canonical_url ? claim.canonical_url.replace('lbry://', '') : name; - } - - return ( -
-
- }}> - Earn %lbc% for inviting subscribers, followers, fans, friends, etc. to join and follow you on %SITE_NAME%. - You can use invites just like affiliate links. - - } - actions={ - - - {channels && channels.length > 0 && ( - handleReferralChange(e.target.value)} - > - {channels.map((channel) => ( - - ))} - - - )} - - } - /> -
-
- }}> - Invite someone you know by email and earn %lbc% when they join %SITE_NAME%. - - } - actions={ - -
- - } - onChange={(event) => { - handleEmailChanged(event); - }} - /> -

- , - referral_faq_link: ( -

-
- ); -} - -export default InviteNew; diff --git a/ui/component/invited/index.js b/ui/component/invited/index.js deleted file mode 100644 index d91178095..000000000 --- a/ui/component/invited/index.js +++ /dev/null @@ -1,30 +0,0 @@ -import { connect } from 'react-redux'; -import { withRouter } from 'react-router'; -import REWARDS from 'rewards'; -import { selectUser, selectSetReferrerPending, selectSetReferrerError } from 'redux/selectors/user'; -import { doClaimRewardType } from 'redux/actions/rewards'; -import { selectUnclaimedRewards } from 'redux/selectors/rewards'; -import { doUserSetReferrer } from 'redux/actions/user'; -import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions'; -import { doChannelSubscribe } from 'redux/actions/subscriptions'; -import Invited from './view'; - -const select = (state, props) => { - return { - user: selectUser(state), - referrerSetPending: selectSetReferrerPending(state), - referrerSetError: selectSetReferrerError(state), - rewards: selectUnclaimedRewards(state), - isSubscribed: selectIsSubscribedForUri(state, props.fullUri), - fullUri: props.fullUri, - referrer: props.referrer, - }; -}; - -const perform = (dispatch) => ({ - claimReward: () => dispatch(doClaimRewardType(REWARDS.TYPE_REFEREE)), - setReferrer: (referrer) => dispatch(doUserSetReferrer(referrer)), - channelSubscribe: (uri) => dispatch(doChannelSubscribe(uri)), -}); - -export default withRouter(connect(select, perform)(Invited)); diff --git a/ui/component/invited/view.jsx b/ui/component/invited/view.jsx deleted file mode 100644 index 9c757e855..000000000 --- a/ui/component/invited/view.jsx +++ /dev/null @@ -1,225 +0,0 @@ -// @flow -import { SITE_NAME } from 'config'; -import * as PAGES from 'constants/pages'; -import React, { useEffect } from 'react'; -import Button from 'component/button'; -import ClaimPreview from 'component/claimPreview'; -import Card from 'component/common/card'; -import { buildURI, parseURI } from 'util/lbryURI'; -import { ERRORS } from 'lbryinc'; -import REWARDS from 'rewards'; -import { formatLbryUrlForWeb } from 'util/url'; -import ChannelContent from 'component/channelContent'; -import I18nMessage from 'component/i18nMessage'; - -type Props = { - user: any, - claimReward: () => void, - setReferrer: (string) => void, - referrerSetPending: boolean, - referrerSetError: string, - channelSubscribe: (sub: Subscription) => void, - history: { push: (string) => void }, - rewards: Array, - referrer: string, - fullUri: string, - isSubscribed: boolean, -}; - -function Invited(props: Props) { - const { - user, - claimReward, - setReferrer, - referrerSetPending, - referrerSetError, - channelSubscribe, - history, - rewards, - fullUri, - referrer, - isSubscribed, - } = props; - - const refUri = referrer && 'lbry://' + referrer.replace(':', '#'); - const { - isChannel: referrerIsChannel, - claimName: referrerChannelName, - channelClaimId: referrerChannelClaimId, - } = parseURI(refUri); - const channelUri = - referrerIsChannel && - formatLbryUrlForWeb(buildURI({ channelName: referrerChannelName, channelClaimId: referrerChannelClaimId })); - const rewardsApproved = user && user.is_reward_approved; - const hasVerifiedEmail = user && user.has_verified_email; - const referredRewardAvailable = rewards && rewards.some((reward) => reward.reward_type === REWARDS.TYPE_REFEREE); - const redirect = channelUri || `/`; - - // always follow if it's a channel - useEffect(() => { - if (fullUri && !isSubscribed && fullUri) { - let channelName; - try { - const { claimName } = parseURI(fullUri); - channelName = claimName; - } catch (e) {} - if (channelName) { - channelSubscribe({ - channelName: channelName, - uri: fullUri, - }); - } - } - }, [fullUri, isSubscribed, channelSubscribe]); - - useEffect(() => { - if (!referrerSetPending && hasVerifiedEmail) { - claimReward(); - } - }, [referrerSetPending, hasVerifiedEmail, claimReward]); - - useEffect(() => { - if (referrer) { - setReferrer(referrer.replace(':', '#')); - } - }, [referrer, setReferrer]); - - function handleDone() { - history.push(redirect); - } - - if (referrerSetError === ERRORS.ALREADY_CLAIMED) { - return ( - - - - ) - } - actions={ -
-
- } - /> - ); - } - - if (referrerSetError && referredRewardAvailable) { - return ( - -

{__('Not a valid invite')}

-
-
- - } - /> - ); - } - - if (!rewardsApproved) { - const signUpButton = ( -