Support = Boost | Tip

## Issue
Closes 5226: Figure out odysee-friendly way to re-enable supports

This essentially re-enables staking (now called "Boost") for Odysee.
This commit is contained in:
infinite-persistence 2021-03-19 14:47:29 +08:00 committed by jessopb
parent 3b960aa0a0
commit a36a8023c7
2 changed files with 35 additions and 30 deletions

View file

@ -1169,12 +1169,13 @@
"Changelog": "Changelog", "Changelog": "Changelog",
"Boost your content": "Boost your content", "Boost your content": "Boost your content",
"Boost This Video": "Boost This Video", "Boost This Video": "Boost This Video",
"Boost This Content": "Boost This Content",
"Boost": "Boost",
"Send Revocable Support": "Send Revocable Support", "Send Revocable Support": "Send Revocable Support",
"Send a %amount% Tip": "Send a %amount% Tip", "Send a %amount% Tip": "Send a %amount% Tip",
"Channel to show support as": "Channel to show support as", "Channel to show support as": "Channel to show support as",
"Buy more LBRY Credits": "Buy more LBRY Credits", "Buy more LBRY Credits": "Buy more LBRY Credits",
"Support this content": "Support this content", "Support this content": "Support this content",
"Make this a tip": "Make this a tip",
"Custom support amount": "Custom support amount", "Custom support amount": "Custom support amount",
"(%lbc_balance% Credits available)": "(%lbc_balance% Credits available)", "(%lbc_balance% Credits available)": "(%lbc_balance% Credits available)",
"Loading your channels...": "Loading your channels...", "Loading your channels...": "Loading your channels...",

View file

@ -1,5 +1,4 @@
// @flow // @flow
import { SIMPLE_SITE } from 'config';
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import React from 'react'; import React from 'react';
@ -64,7 +63,7 @@ function WalletSendTip(props: Props) {
const { channelName } = parseURI(uri); const { channelName } = parseURI(uri);
const noBalance = balance === 0; const noBalance = balance === 0;
const tipAmount = useCustomTip ? customTipAmount : presetTipAmount; const tipAmount = useCustomTip ? customTipAmount : presetTipAmount;
const isSupport = claimIsMine ? true : SIMPLE_SITE ? false : !sendAsTip; const isSupport = claimIsMine || !sendAsTip;
React.useEffect(() => { React.useEffect(() => {
const regexp = RegExp(/^(\d*([.]\d{0,8})?)$/); const regexp = RegExp(/^(\d*([.]\d{0,8})?)$/);
@ -157,21 +156,37 @@ function WalletSendTip(props: Props) {
/> />
) : ( ) : (
<Card <Card
title={ title={<LbcSymbol postfix={claimIsMine ? __('Boost your content') : __('Support this content')} size={22} />}
claimIsMine
? __('Boost your content')
: isSupport
? __('Support this content')
: __('Support --[button to support a claim]--')
}
subtitle={ subtitle={
<React.Fragment> <React.Fragment>
{isSupport {!claimIsMine && (
? __( <div className="section">
'This will increase the overall bid amount for this content, which will boost its ability to be discovered while active.' <Button
) key="tip"
: __('Show this channel your appreciation by sending a donation.')}{' '} icon={ICONS.SUPPORT}
<Button label={__('Learn more')} button="link" href="https://lbry.com/faq/tipping" />. label={__('Tip')}
button="alt"
onClick={() => setSendAsTip(true)}
className={classnames('button-toggle', { 'button-toggle--active': sendAsTip })}
/>
<Button
key="boost"
icon={ICONS.TRENDING}
label={__('Boost')}
button="alt"
onClick={() => setSendAsTip(false)}
className={classnames('button-toggle', { 'button-toggle--active': !sendAsTip })}
/>
</div>
)}
<div className="section__subtitle">
{isSupport
? __(
'This will increase the overall bid amount for this content, which will boost its ability to be discovered while active.'
)
: __('Show this channel your appreciation by sending a donation.')}{' '}
<Button label={__('Learn more')} button="link" href="https://lbry.com/faq/tipping" />
</div>
</React.Fragment> </React.Fragment>
} }
actions={ actions={
@ -185,7 +200,7 @@ function WalletSendTip(props: Props) {
<div className="confirm__value"> <div className="confirm__value">
{activeChannelClaim && !incognito ? activeChannelClaim.name : __('Anonymous')} {activeChannelClaim && !incognito ? activeChannelClaim.name : __('Anonymous')}
</div> </div>
<div className="confirm__label">{__(isSupport ? 'Supporting' : 'Tipping')}</div> <div className="confirm__label">{__(isSupport ? 'Boosting' : 'Tipping')}</div>
<div className="confirm__value"> <div className="confirm__value">
<LbcSymbol postfix={tipAmount} size={22} /> <LbcSymbol postfix={tipAmount} size={22} />
</div> </div>
@ -276,28 +291,17 @@ function WalletSendTip(props: Props) {
<div className="section__actions"> <div className="section__actions">
<Button <Button
autoFocus autoFocus
icon={isSupport ? undefined : ICONS.SUPPORT} icon={isSupport ? ICONS.TRENDING : ICONS.SUPPORT}
button="primary" button="primary"
type="submit" type="submit"
disabled={fetchingChannels || isPending || tipError || !tipAmount} disabled={fetchingChannels || isPending || tipError || !tipAmount}
label={ label={
isSupport isSupport
? claimIsMine ? __('Boost This Content')
? __('Boost This Video')
: __('Send Revocable Support')
: __('Send a %amount% Tip', { amount: tipAmount ? `${tipAmount} Credit` : '' }) : __('Send a %amount% Tip', { amount: tipAmount ? `${tipAmount} Credit` : '' })
} }
/> />
{fetchingChannels && <span className="help">{__('Loading your channels...')}</span>} {fetchingChannels && <span className="help">{__('Loading your channels...')}</span>}
{!claimIsMine && !fetchingChannels && !SIMPLE_SITE && (
<FormField
name="toggle-is-support"
type="checkbox"
label={__('Make this a tip')}
checked={sendAsTip}
onChange={() => setSendAsTip(!sendAsTip)}
/>
)}
</div> </div>
<WalletSpendableBalanceHelp /> <WalletSpendableBalanceHelp />
</> </>