patch column cards

This commit is contained in:
zeppi 2021-08-20 12:50:55 -04:00 committed by jessopb
parent 68697baaf4
commit 1785009fa1
2 changed files with 205 additions and 190 deletions

View file

@ -11,7 +11,7 @@ import LbcSymbol from 'component/common/lbc-symbol';
type Props = { type Props = {
errorMessage: ?string, errorMessage: ?string,
inviteNew: string => void, inviteNew: (string) => void,
isPending: boolean, isPending: boolean,
referralLink: string, referralLink: string,
referralCode: string, referralCode: string,
@ -35,10 +35,10 @@ function InviteNew(props: Props) {
const [referralSource, setReferralSource] = useState(referralCode); const [referralSource, setReferralSource] = useState(referralCode);
const handleReferralChange = React.useCallback( const handleReferralChange = React.useCallback(
code => { (code) => {
setReferralSource(code); setReferralSource(code);
// TODO: keep track of this in an array? // TODO: keep track of this in an array?
const matchingChannel = channels && channels.find(ch => ch.name === code); const matchingChannel = channels && channels.find((ch) => ch.name === code);
if (matchingChannel) { if (matchingChannel) {
analytics.apiLogPublish(matchingChannel); analytics.apiLogPublish(matchingChannel);
} }
@ -68,12 +68,13 @@ function InviteNew(props: Props) {
}, [topChannel, handleReferralChange]); }, [topChannel, handleReferralChange]);
function lookupUrlByClaimName(name, channels) { function lookupUrlByClaimName(name, channels) {
const claim = channels.find(channel => channel.name === name); const claim = channels.find((channel) => channel.name === name);
return claim && claim.canonical_url ? claim.canonical_url.replace('lbry://', '') : name; return claim && claim.canonical_url ? claim.canonical_url.replace('lbry://', '') : name;
} }
return ( return (
<div className={'columns'}> <div className={'columns'}>
<div className="column">
<Card <Card
title={__('Invites')} title={__('Invites')}
subtitle={ subtitle={
@ -90,9 +91,9 @@ function InviteNew(props: Props) {
type="select" type="select"
label={__('Customize link')} label={__('Customize link')}
value={referralSource} value={referralSource}
onChange={e => handleReferralChange(e.target.value)} onChange={(e) => handleReferralChange(e.target.value)}
> >
{channels.map(channel => ( {channels.map((channel) => (
<option key={channel.claim_id} value={channel.name}> <option key={channel.claim_id} value={channel.name}>
{channel.name} {channel.name}
</option> </option>
@ -103,7 +104,8 @@ function InviteNew(props: Props) {
</React.Fragment> </React.Fragment>
} }
/> />
</div>
<div className="column">
<Card <Card
title={__('Invite by email')} title={__('Invite by email')}
subtitle={ subtitle={
@ -124,7 +126,7 @@ function InviteNew(props: Props) {
inputButton={ inputButton={
<Button button="secondary" type="submit" label={__('Invite')} disabled={isPending || !email} /> <Button button="secondary" type="submit" label={__('Invite')} disabled={isPending || !email} />
} }
onChange={event => { onChange={(event) => {
handleEmailChanged(event); handleEmailChanged(event);
}} }}
/> />
@ -132,7 +134,9 @@ function InviteNew(props: Props) {
<I18nMessage <I18nMessage
tokens={{ tokens={{
rewards_link: <Button button="link" navigate="/$/rewards" label={__('rewards')} />, rewards_link: <Button button="link" navigate="/$/rewards" label={__('rewards')} />,
referral_faq_link: <Button button="link" label={__('FAQ')} href="https://lbry.com/faq/referrals" />, referral_faq_link: (
<Button button="link" label={__('FAQ')} href="https://lbry.com/faq/referrals" />
),
}} }}
> >
Read our %referral_faq_link% to learn more about rewards. Read our %referral_faq_link% to learn more about rewards.
@ -143,6 +147,7 @@ function InviteNew(props: Props) {
} }
/> />
</div> </div>
</div>
); );
} }

View file

@ -65,6 +65,7 @@ const WalletBalance = (props: Props) => {
return ( return (
<div className={'columns'}> <div className={'columns'}>
<div className="column">
<Card <Card
title={<LbcSymbol postfix={formatNumberWithCommas(totalBalance)} isTitle />} title={<LbcSymbol postfix={formatNumberWithCommas(totalBalance)} isTitle />}
subtitle={ subtitle={
@ -148,14 +149,21 @@ const WalletBalance = (props: Props) => {
</p> </p>
) : ( ) : (
<p className="help--warning"> <p className="help--warning">
{__('Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.')} {__(
'Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.'
)}
<HelpLink navigate={`/$/${PAGES.BACKUP}`} /> <HelpLink navigate={`/$/${PAGES.BACKUP}`} />
</p> </p>
)} )}
{/* @endif */} {/* @endif */}
<div className="section__actions"> <div className="section__actions">
<Button button="primary" label={__('Buy')} icon={ICONS.BUY} navigate={`/$/${PAGES.BUY}`} /> <Button button="primary" label={__('Buy')} icon={ICONS.BUY} navigate={`/$/${PAGES.BUY}`} />
<Button button="secondary" label={__('Receive')} icon={ICONS.RECEIVE} navigate={`/$/${PAGES.RECEIVE}`} /> <Button
button="secondary"
label={__('Receive')}
icon={ICONS.RECEIVE}
navigate={`/$/${PAGES.RECEIVE}`}
/>
<Button button="secondary" label={__('Send')} icon={ICONS.SEND} navigate={`/$/${PAGES.SEND}`} /> <Button button="secondary" label={__('Send')} icon={ICONS.SEND} navigate={`/$/${PAGES.SEND}`} />
</div> </div>
{(otherCount > WALLET_CONSOLIDATE_UTXOS || consolidateIsPending || consolidatingUtxos) && ( {(otherCount > WALLET_CONSOLIDATE_UTXOS || consolidateIsPending || consolidatingUtxos) && (
@ -175,18 +183,20 @@ const WalletBalance = (props: Props) => {
help: <HelpLink href="https://lbry.com/faq/transaction-types" />, help: <HelpLink href="https://lbry.com/faq/transaction-types" />,
}} }}
> >
Your wallet has a lot of change lying around. Consolidating will speed up your transactions. This could Your wallet has a lot of change lying around. Consolidating will speed up your transactions. This
take some time. %now%%help% could take some time. %now%%help%
</I18nMessage> </I18nMessage>
</p> </p>
)} )}
</> </>
} }
/> />
</div>
<div className="column">
{/* fiat balance card */} {/* fiat balance card */}
<WalletFiatBalance /> <WalletFiatBalance />
</div> </div>
</div>
); );
}; };