style cleanup

This commit is contained in:
Sean Yesmunt 2020-01-14 12:42:30 -05:00
parent abba90ccfd
commit 9af2dcac0b
4 changed files with 57 additions and 100 deletions

View file

@ -68,7 +68,7 @@
"@babel/register": "^7.0.0",
"@exponent/electron-cookies": "^2.0.0",
"@hot-loader/react-dom": "^16.8",
"@lbry/components": "^3.0.5",
"@lbry/components": "^3.0.6",
"@reach/menu-button": "^0.1.18",
"@reach/rect": "^0.2.1",
"@reach/tabs": "^0.1.5",

View file

@ -23,7 +23,7 @@ type Props = {
function InviteNew(props: Props) {
const { inviteNew, errorMessage, isPending, referralCode = '', channels, resolveUris, resolvingUris } = props;
const rewardAmount = 20;
// Email
const [email, setEmail] = useState('');
function handleSubmit() {
@ -94,45 +94,46 @@ function InviteNew(props: Props) {
function lookupUrlByClaimName(name, channels) {
const claim = channels.find(channel => channel.name === name);
return claim ? claim.canonical_url.replace('lbry://', '') : name;
return claim && claim.canonical_url ? claim.canonical_url.replace('lbry://', '') : name;
}
return (
<div className={'columns'}>
<Card
title={__('Invite Link')}
subtitle={__('Share this link with friends (or enemies) and get %reward_amount% LBC when they join lbry.tv', { reward_amount: rewardAmount })}
subtitle={__('Share this link with friends (or enemies) and get %reward_amount% LBC when they join lbry.tv', {
reward_amount: rewardAmount,
})}
actions={
<React.Fragment>
<Form onSubmit={handleSubmit}>
<CopyableText label={__('Your invite link')} copyable={referral} />
<SelectChannel
channel={referralSource}
onChannelChange={channel => handleReferralChange(channel)}
label={'Customize link'}
hideNew
hideAnon
injected={[referralCode]}
/>
<CopyableText label={__('Your invite link')} copyable={referral} />
<SelectChannel
channel={referralSource}
onChannelChange={channel => handleReferralChange(channel)}
label={'Customize link'}
hideAnon
injected={[referralCode]}
/>
<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.
</I18nMessage>
</p>
</Form>
<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.
</I18nMessage>
</p>
</React.Fragment>
}
/>
<Card
title={__('Invite by Email')}
subtitle={__('Invite someone you know by email and earn %reward_amount% LBC when they join lbry.tv.', { reward_amount: rewardAmount })}
subtitle={__('Invite someone you know by email and earn %reward_amount% LBC when they join lbry.tv.', {
reward_amount: rewardAmount,
})}
actions={
<React.Fragment>
<Form onSubmit={handleSubmit}>
@ -162,7 +163,7 @@ function InviteNew(props: Props) {
</React.Fragment>
}
/>
</div>
</div>
);
}

View file

@ -14,7 +14,6 @@ type Props = {
createChannel: (string, number) => Promise<any>,
fetchChannelListMine: () => void,
fetchingChannels: boolean,
hideNew: boolean,
hideAnon: boolean,
includeNew?: boolean,
label?: string,
@ -74,82 +73,39 @@ class ChannelSection extends React.PureComponent<Props, State> {
render() {
const channel = this.state.addingChannel ? 'new' : this.props.channel;
const { fetchingChannels, channels = [], hideNew, hideAnon, label, injected = [] } = this.props;
const { fetchingChannels, channels = [], hideAnon, label, injected = [] } = this.props;
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 (
<Fragment>
{fetchingChannels ? (
<BusyIndicator message="Updating channels" />
) : (
<Fragment>
<div className="section">
<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>
))}
<option value={CHANNEL_NEW}>{__('New channel...')}</option>}
</FormField>
</div>
{addingChannel && (
<div className="section">
<ChannelCreate onSuccess={this.handleChangeToNewChannel} />
</div>
)}
<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>
))}
<option value={CHANNEL_NEW}>{__('New channel...')}</option>}
</FormField>
{addingChannel && <ChannelCreate onSuccess={this.handleChangeToNewChannel} />}
</Fragment>
)}
</Fragment>

View file

@ -1026,10 +1026,10 @@
prop-types "^15.6.2"
scheduler "^0.15.0"
"@lbry/components@^3.0.5":
version "3.0.5"
resolved "https://registry.yarnpkg.com/@lbry/components/-/components-3.0.5.tgz#4ab6cf8f97113e4c2c90fb6a840801c9da11923f"
integrity sha512-u0J5MY3JvGxPjusVQVtoWKUbTAokC6wy+zafq/qJdnCUtjJbEG57jx7sx6KSfdoCz7jqmr2bivAbzMx+oP2mzA==
"@lbry/components@^3.0.6":
version "3.0.6"
resolved "https://registry.yarnpkg.com/@lbry/components/-/components-3.0.6.tgz#e8040cd3025562eefaf80bb19a41a89637bb25cb"
integrity sha512-SJc0nJogFpIAIv+L75Rfw0BeQRBfDNqpH04ZbJUqQlFwk2yE73KdC1LSYoj8+S4j+quO8ELBqOm9OWqylL4sEg==
"@mapbox/hast-util-table-cell-style@^0.1.3":
version "0.1.3"