review changes
This commit is contained in:
parent
7e2c9dc2b8
commit
94cc7a2d9d
7 changed files with 176 additions and 103 deletions
|
@ -59,7 +59,7 @@ export function CommentCreate(props: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form onSubmit={handleSubmit}>
|
<Form onSubmit={handleSubmit}>
|
||||||
<ChannelSection channel={channel} onChannelChange={handleChannelChange} includeAnonymous includeNew />
|
<ChannelSection channel={channel} onChannelChange={handleChannelChange} />
|
||||||
<FormField
|
<FormField
|
||||||
disabled={channel === CHANNEL_NEW}
|
disabled={channel === CHANNEL_NEW}
|
||||||
type="textarea"
|
type="textarea"
|
||||||
|
|
|
@ -183,10 +183,10 @@ const Header = (props: Props) => {
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
||||||
{/* Commented out until new invite system is implemented */}
|
{/* Commented out until new invite system is implemented */}
|
||||||
{/* <MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.INVITE}`)}>
|
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.INVITE}`)}>
|
||||||
<Icon aria-hidden icon={ICONS.INVITE} />
|
<Icon aria-hidden icon={ICONS.INVITE} />
|
||||||
{__('Invite A Friend')}
|
{__('Invites')}
|
||||||
</MenuItem> */}
|
</MenuItem>
|
||||||
|
|
||||||
{authenticated ? (
|
{authenticated ? (
|
||||||
<MenuItem onSelect={signOut}>
|
<MenuItem onSelect={signOut}>
|
||||||
|
|
|
@ -15,7 +15,7 @@ type Props = {
|
||||||
isPending: boolean,
|
isPending: boolean,
|
||||||
referralLink: string,
|
referralLink: string,
|
||||||
referralCode: string,
|
referralCode: string,
|
||||||
channels: any,
|
channels: ?Array<ChannelClaim>,
|
||||||
resolvingUris: Array<string>,
|
resolvingUris: Array<string>,
|
||||||
resolveUris: (Array<string>) => void,
|
resolveUris: (Array<string>) => void,
|
||||||
};
|
};
|
||||||
|
@ -41,8 +41,9 @@ function InviteNew(props: Props) {
|
||||||
function handleReferralChange(code) {
|
function handleReferralChange(code) {
|
||||||
setReferralSource(code);
|
setReferralSource(code);
|
||||||
// TODO: keep track of this in an array?
|
// TODO: keep track of this in an array?
|
||||||
if (code !== referralCode) {
|
const matchingChannel = channels && channels.find(ch => ch.name === code);
|
||||||
analytics.apiLogPublish(channels.find(ch => ch.name === code));
|
if (matchingChannel) {
|
||||||
|
analytics.apiLogPublish(matchingChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,9 +56,11 @@ function InviteNew(props: Props) {
|
||||||
|
|
||||||
const topChannel =
|
const topChannel =
|
||||||
channels &&
|
channels &&
|
||||||
channels.reduce((top, channel) =>
|
channels.reduce((top, channel) => {
|
||||||
(top && top.meta && top.meta.claims_in_channel) > channel.meta.claims_in_channel ? 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 =
|
const referralString =
|
||||||
channels && channels.length && referralSource !== referralCode
|
channels && channels.length && referralSource !== referralCode
|
||||||
? lookupUrlByClaimName(referralSource, channels)
|
? lookupUrlByClaimName(referralSource, channels)
|
||||||
|
@ -67,7 +70,7 @@ function InviteNew(props: Props) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// resolve once, after we have channel list
|
// resolve once, after we have channel list
|
||||||
if (!hasResolved && !resolveStarted && channelCount) {
|
if (!hasResolved && !resolveStarted && channelCount && uris) {
|
||||||
setResolveStarted(true);
|
setResolveStarted(true);
|
||||||
resolveUris(uris.split(','));
|
resolveUris(uris.split(','));
|
||||||
}
|
}
|
||||||
|
@ -93,20 +96,13 @@ function InviteNew(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div className={'columns'}>
|
||||||
<Card
|
<Card
|
||||||
title={__('Invite a Friend')}
|
title={__('Refer by Email')}
|
||||||
subtitle={__('When your friends start using LBRY, the network gets stronger!')}
|
subtitle={__('When your friends start using LBRY, the network gets stronger!')}
|
||||||
actions={
|
actions={
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Form onSubmit={handleSubmit}>
|
<Form onSubmit={handleSubmit}>
|
||||||
<SelectChannel
|
|
||||||
channel={referralSource}
|
|
||||||
onChannelChange={channel => handleReferralChange(channel)}
|
|
||||||
label={'Code or Channel'}
|
|
||||||
injected={[referralCode]}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<CopyableText label={__('Or share this link with your friends')} copyable={referral} />
|
|
||||||
<FormField
|
<FormField
|
||||||
type="text"
|
type="text"
|
||||||
label="Email"
|
label="Email"
|
||||||
|
@ -134,6 +130,37 @@ function InviteNew(props: Props) {
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<Card
|
||||||
|
title={__('Referral Codes')}
|
||||||
|
subtitle={__('Users!')}
|
||||||
|
actions={
|
||||||
|
<React.Fragment>
|
||||||
|
<Form onSubmit={handleSubmit}>
|
||||||
|
<SelectChannel
|
||||||
|
channel={referralSource}
|
||||||
|
onChannelChange={channel => handleReferralChange(channel)}
|
||||||
|
label={'Code or Channel'}
|
||||||
|
hideNew
|
||||||
|
hideAnon
|
||||||
|
injected={[referralCode]}
|
||||||
|
/>
|
||||||
|
<CopyableText label={__('Or share this link with your friends')} copyable={referral} />
|
||||||
|
<p className="help">
|
||||||
|
<I18nMessage
|
||||||
|
tokens={{
|
||||||
|
rewards_link: <Button button="link" navigate="/$/rewards" label={__('rewards')} />,
|
||||||
|
referral_faq_link: <Button button="link" label={__('FAQ')} href="https://lbry.com/faq/referrals" />,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Earn %rewards_link% for inviting your friends. Read our %referral_faq_link% to learn more about
|
||||||
|
referrals.
|
||||||
|
</I18nMessage>
|
||||||
|
</p>
|
||||||
|
</Form>
|
||||||
|
</React.Fragment>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,19 +71,23 @@ function Invited(props: Props) {
|
||||||
if (referrerSetError === ERRORS.ALREADY_CLAIMED) {
|
if (referrerSetError === ERRORS.ALREADY_CLAIMED) {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={__(`Welcome!`)}
|
title={__(`Whoa`)}
|
||||||
subtitle={referrerIsChannel ? __(`We've followed your referrer for you. Check it out!`) : __(`Congrats!`)}
|
subtitle={
|
||||||
actions={
|
referrerIsChannel
|
||||||
<>
|
? __(`You've already claimed your referrer, but we've followed this channel for you.`)
|
||||||
{referrerIsChannel && (
|
: __(`You've already claimed your referrer.`)
|
||||||
<div key={refUri} className="claim-preview--channel">
|
}
|
||||||
|
body={
|
||||||
|
referrerIsChannel && (
|
||||||
|
<div className="claim-preview--channel">
|
||||||
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
|
actions={
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
<Button button="primary" label={__('Done!')} onClick={handleDone} />
|
<Button button="primary" label={__('Done!')} onClick={handleDone} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -102,10 +106,10 @@ function Invited(props: Props) {
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
<Button
|
<Button
|
||||||
button="primary"
|
button="primary"
|
||||||
label={hasVerifiedEmail ? __('Verify') : __('Sign in')}
|
label={hasVerifiedEmail ? __('Verify') : __('Create Account')}
|
||||||
navigate={`/$/${PAGES.AUTH}?redirect=/$/${PAGES.REWARDS}`}
|
navigate={`/$/${PAGES.AUTH}?redirect=/$/${PAGES.REWARDS}`}
|
||||||
/>
|
/>
|
||||||
<Button button="primary" label={__('Explore')} onClick={handleDone} />
|
<Button button="link" label={__('Explore')} onClick={handleDone} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
@ -117,23 +121,30 @@ function Invited(props: Props) {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={__(`You're invited!`)}
|
title={__(`You're invited!`)}
|
||||||
subtitle={__(`A referral reward is waiting for you. Just complete sign-in to claim it.`)}
|
subtitle={
|
||||||
actions={
|
referrerIsChannel
|
||||||
<>
|
? __(
|
||||||
{referrerIsChannel && (
|
`Content freedom and and a present from %channel_name% are waiting for you. Create an account to claim it.`,
|
||||||
<div key={refUri} className="claim-preview--channel">
|
{ channel_name: referrer }
|
||||||
|
)
|
||||||
|
: __(`Content freedom and a present are waiting for you. Create an account to claim it.`)
|
||||||
|
}
|
||||||
|
body={
|
||||||
|
referrerIsChannel && (
|
||||||
|
<div className="claim-preview--channel">
|
||||||
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
|
actions={
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
<Button
|
<Button
|
||||||
button="primary"
|
button="primary"
|
||||||
label={hasVerifiedEmail ? __('Verify') : __('Sign in')}
|
label={hasVerifiedEmail ? __('Verify') : __('Create Account')}
|
||||||
navigate={`/$/${PAGES.AUTH}?redirect=/$/${PAGES.INVITE}/${referrer}`}
|
navigate={`/$/${PAGES.AUTH}?redirect=/$/${PAGES.INVITE}/${referrer}`}
|
||||||
/>
|
/>
|
||||||
<Button button="primary" label={__('Skip')} onClick={handleDone} />
|
<Button button="link" label={__('Skip')} onClick={handleDone} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -143,17 +154,17 @@ function Invited(props: Props) {
|
||||||
<Card
|
<Card
|
||||||
title={__(`Welcome!`)}
|
title={__(`Welcome!`)}
|
||||||
subtitle={referrerIsChannel ? __(`We've followed your referrer for you. Check it out!`) : __(`Congrats!`)}
|
subtitle={referrerIsChannel ? __(`We've followed your referrer for you. Check it out!`) : __(`Congrats!`)}
|
||||||
actions={
|
body={
|
||||||
<>
|
referrerIsChannel && (
|
||||||
{referrerIsChannel && (
|
<div className="claim-preview--channel">
|
||||||
<div key={refUri} className="claim-preview--channel">
|
|
||||||
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
<ClaimPreview key={refUri} uri={refUri} actions={''} type={'small'} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
|
actions={
|
||||||
<div className="card__actions">
|
<div className="card__actions">
|
||||||
<Button button="primary" label={__('Done!')} onClick={handleDone} />
|
<Button button="primary" label={__('Done!')} onClick={handleDone} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -165,12 +165,7 @@ function PublishForm(props: Props) {
|
||||||
<Card
|
<Card
|
||||||
actions={
|
actions={
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<SelectChannel
|
<SelectChannel channel={channel} onChannelChange={channel => updatePublishForm({ channel })} />
|
||||||
channel={channel}
|
|
||||||
onChannelChange={channel => updatePublishForm({ channel })}
|
|
||||||
includeAnonymous
|
|
||||||
includeNew
|
|
||||||
/>
|
|
||||||
<p className="help">
|
<p className="help">
|
||||||
{__('This is a username or handle that your content can be found under.')}{' '}
|
{__('This is a username or handle that your content can be found under.')}{' '}
|
||||||
{__('Ex. @Marvel, @TheBeatles, @BooksByJoe')}
|
{__('Ex. @Marvel, @TheBeatles, @BooksByJoe')}
|
||||||
|
|
|
@ -14,11 +14,12 @@ type Props = {
|
||||||
createChannel: (string, number) => Promise<any>,
|
createChannel: (string, number) => Promise<any>,
|
||||||
fetchChannelListMine: () => void,
|
fetchChannelListMine: () => void,
|
||||||
fetchingChannels: boolean,
|
fetchingChannels: boolean,
|
||||||
emailVerified: boolean,
|
hideNew: boolean,
|
||||||
includeAnonymous?: boolean,
|
hideAnon: boolean,
|
||||||
includeNew?: boolean,
|
includeNew?: boolean,
|
||||||
label?: string,
|
label?: string,
|
||||||
injected?: Array<string>,
|
injected?: Array<string>,
|
||||||
|
emailVerified: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
@ -73,9 +74,47 @@ class ChannelSection extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
||||||
const { fetchingChannels, channels = [], includeAnonymous, includeNew, label, injected = [] } = this.props;
|
const { fetchingChannels, channels = [], hideNew, hideAnon, label, injected = [] } = this.props;
|
||||||
const { addingChannel } = this.state;
|
const { addingChannel } = this.state;
|
||||||
|
|
||||||
|
if (hideNew) {
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
{fetchingChannels ? (
|
||||||
|
<BusyIndicator message="Updating channels" />
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<FormField
|
||||||
|
name="channel"
|
||||||
|
label={label || __('Channel')}
|
||||||
|
type="select"
|
||||||
|
onChange={this.handleChannelChange}
|
||||||
|
value={channel}
|
||||||
|
>
|
||||||
|
{!hideAnon && <option value={CHANNEL_ANONYMOUS}>{__('Anonymous')}</option>}
|
||||||
|
{channels &&
|
||||||
|
channels.map(({ name, claim_id: claimId }) => (
|
||||||
|
<option key={claimId} value={name}>
|
||||||
|
{name}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
{injected &&
|
||||||
|
injected.map(item => (
|
||||||
|
<option key={item} value={item}>
|
||||||
|
{item}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</FormField>
|
||||||
|
{addingChannel && (
|
||||||
|
<div className="section">
|
||||||
|
<ChannelCreate onSuccess={this.handleChangeToNewChannel} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{fetchingChannels ? (
|
{fetchingChannels ? (
|
||||||
|
@ -90,7 +129,7 @@ class ChannelSection extends React.PureComponent<Props, State> {
|
||||||
onChange={this.handleChannelChange}
|
onChange={this.handleChannelChange}
|
||||||
value={channel}
|
value={channel}
|
||||||
>
|
>
|
||||||
{includeAnonymous && <option value={CHANNEL_ANONYMOUS}>{__('Anonymous')}</option>}
|
{!hideAnon && <option value={CHANNEL_ANONYMOUS}>{__('Anonymous')}</option>}
|
||||||
{channels &&
|
{channels &&
|
||||||
channels.map(({ name, claim_id: claimId }) => (
|
channels.map(({ name, claim_id: claimId }) => (
|
||||||
<option key={claimId} value={name}>
|
<option key={claimId} value={name}>
|
||||||
|
@ -103,7 +142,7 @@ class ChannelSection extends React.PureComponent<Props, State> {
|
||||||
{item}
|
{item}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
{includeNew && <option value={CHANNEL_NEW}>{__('New channel...')}</option>}
|
<option value={CHANNEL_NEW}>{__('New channel...')}</option>}
|
||||||
</FormField>
|
</FormField>
|
||||||
</div>
|
</div>
|
||||||
{addingChannel && (
|
{addingChannel && (
|
||||||
|
|
|
@ -3,6 +3,7 @@ import * as React from 'react';
|
||||||
import { FormField, Form } from 'component/common/form';
|
import { FormField, Form } from 'component/common/form';
|
||||||
import { Modal } from 'modal/modal';
|
import { Modal } from 'modal/modal';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import HelpLink from 'component/common/help-link';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
closeModal: () => void,
|
closeModal: () => void,
|
||||||
|
@ -49,7 +50,7 @@ class ModalSetReferrer extends React.PureComponent<Props, State> {
|
||||||
<Form onSubmit={this.handleSubmit}>
|
<Form onSubmit={this.handleSubmit}>
|
||||||
<p>
|
<p>
|
||||||
{__('Tell us who referred you and get a reward!')}
|
{__('Tell us who referred you and get a reward!')}
|
||||||
<Button button="link" href="https://lbry.com/faq/referrals" label={__('?')} />.
|
<HelpLink href="https://lbry.com/faq/referrals" />.
|
||||||
</p>
|
</p>
|
||||||
<FormField
|
<FormField
|
||||||
autoFocus
|
autoFocus
|
||||||
|
|
Loading…
Reference in a new issue