feat: experimental support option

And some other small cleanups. Added trending FAQ to customize page.
This commit is contained in:
Thomas Zarebczan 2019-07-19 16:21:41 -04:00 committed by Sean Yesmunt
parent c126fa67fc
commit d08380ccc1
15 changed files with 125 additions and 20 deletions

View file

@ -41,7 +41,7 @@ class RewardSummary extends React.Component<Props> {
navigate="/$/rewards" navigate="/$/rewards"
label={hasRewards ? __('Claim Rewards') : __('View Rewards')} label={hasRewards ? __('Claim Rewards') : __('View Rewards')}
/> />
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/rewards" /> <Button button="link" label={__('Learn more')} href="https://lbry.com/faq/rewards" />.
</div> </div>
</div> </div>
</section> </section>

View file

@ -92,7 +92,10 @@ export default function TagSelect(props: Props) {
</ul> </ul>
<TagsSearch onSelect={onSelect} suggestMature={suggestMature && !hasMatureTag} /> <TagsSearch onSelect={onSelect} suggestMature={suggestMature && !hasMatureTag} />
{help !== false && ( {help !== false && (
<p className="help">{help || __("The tags you follow will change what's trending for you.")}</p> <p className="help">
{help || __("The tags you follow will change what's trending for you. ")}
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/trending" />.
</p>
)} )}
</div> </div>
</div> </div>

View file

@ -16,7 +16,7 @@ const select = (state, props) => ({
}); });
const perform = dispatch => ({ const perform = dispatch => ({
sendSupport: (amount, claimId, uri) => dispatch(doSendTip(amount, claimId, uri)), sendSupport: (amount, claimId) => dispatch(doSendTip(amount, claimId)),
}); });
export default connect( export default connect(

View file

@ -13,6 +13,7 @@ type Props = {
onCancel: () => void, onCancel: () => void,
sendTipCallback?: () => void, sendTipCallback?: () => void,
balance: number, balance: number,
isSupport: boolean,
}; };
type State = { type State = {
@ -32,11 +33,11 @@ class WalletSendTip extends React.PureComponent<Props, State> {
} }
handleSendButtonClicked() { handleSendButtonClicked() {
const { claim, uri, sendSupport, sendTipCallback } = this.props; const { claim, sendSupport, sendTipCallback } = this.props;
const { claim_id: claimId } = claim; const { claim_id: claimId } = claim;
const { tipAmount } = this.state; const { tipAmount } = this.state;
sendSupport(tipAmount, claimId, uri); sendSupport(tipAmount, claimId);
// ex: close modal // ex: close modal
if (sendTipCallback) { if (sendTipCallback) {
@ -70,7 +71,7 @@ class WalletSendTip extends React.PureComponent<Props, State> {
} }
render() { render() {
const { title, isPending, uri, onCancel, claimIsMine } = this.props; const { title, isPending, uri, onCancel, claimIsMine, isSupport } = this.props;
const { tipAmount, tipError } = this.state; const { tipAmount, tipError } = this.state;
return ( return (
@ -99,11 +100,11 @@ class WalletSendTip extends React.PureComponent<Props, State> {
} }
helper={ helper={
<p> <p>
{claimIsMine {claimIsMine || isSupport
? __('This will increase your overall bid amount for ') ? __('This will increase the overall bid amount for ')
: __('This will appear as a tip for ')} : __('This will appear as a tip for ')}
{`"${title}" which will boost its ability to be discovered while active.`}{' '} {`"${title}" which will boost its ability to be discovered while active.`}{' '}
<Button label={__('Learn more')} button="link" href="https://lbry.com/faq/tipping" /> <Button label={__('Learn more')} button="link" href="https://lbry.com/faq/tipping" />.
</p> </p>
} }
/> />

View file

@ -16,3 +16,4 @@ export const AUTOPLAY = 'autoplay';
export const RESULT_COUNT = 'resultCount'; export const RESULT_COUNT = 'resultCount';
export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled'; export const OS_NOTIFICATIONS_ENABLED = 'osNotificationsEnabled';
export const AUTO_DOWNLOAD = 'autoDownload'; export const AUTO_DOWNLOAD = 'autoDownload';
export const SUPPORT_OPTION = 'supportOption';

View file

@ -21,6 +21,8 @@ class ModalRevokeClaim extends React.PureComponent<Props> {
getButtonLabel(type: string) { getButtonLabel(type: string) {
if (type === txnTypes.TIP) { if (type === txnTypes.TIP) {
return 'Confirm Tip Unlock'; return 'Confirm Tip Unlock';
} else if (type === txnTypes.SUPPORT) {
return 'Confirm Support Revoke';
} }
return 'Confirm Claim Revoke'; return 'Confirm Claim Revoke';
} }
@ -75,8 +77,8 @@ class ModalRevokeClaim extends React.PureComponent<Props> {
return ( return (
<Modal <Modal
isOpen isOpen
title={type === txnTypes.TIP ? __('Confirm Tip Unlock') : __('Confirm Claim Revoke')} title={this.getButtonLabel(type)}
contentLabel={__('Confirm Claim Revoke')} contentLabel={this.getButtonLabel(type)}
type="confirm" type="confirm"
confirmButtonLabel={this.getButtonLabel(type)} confirmButtonLabel={this.getButtonLabel(type)}
onConfirmed={this.revokeClaim} onConfirmed={this.revokeClaim}

View file

@ -8,11 +8,12 @@ type Props = {
closeModal: () => void, closeModal: () => void,
uri: string, uri: string,
claimIsMine: boolean, claimIsMine: boolean,
isSupport: boolean,
}; };
class ModalSendTip extends React.PureComponent<Props> { class ModalSendTip extends React.PureComponent<Props> {
render() { render() {
const { closeModal, uri, claimIsMine } = this.props; const { closeModal, uri, claimIsMine, isSupport } = this.props;
return ( return (
<Modal <Modal
@ -25,7 +26,13 @@ class ModalSendTip extends React.PureComponent<Props> {
</React.Fragment> </React.Fragment>
} }
> >
<SendTip uri={uri} claimIsMine={claimIsMine} onCancel={closeModal} sendTipCallback={closeModal} /> <SendTip
uri={uri}
claimIsMine={claimIsMine}
isSupport={isSupport}
onCancel={closeModal}
sendTipCallback={closeModal}
/>
</Modal> </Modal>
); );
} }

View file

@ -42,6 +42,7 @@ const select = (state, props) => ({
title: makeSelectTitleForUri(props.uri)(state), title: makeSelectTitleForUri(props.uri)(state),
thumbnail: makeSelectThumbnailForUri(props.uri)(state), thumbnail: makeSelectThumbnailForUri(props.uri)(state),
nsfw: makeSelectClaimIsNsfw(props.uri)(state), nsfw: makeSelectClaimIsNsfw(props.uri)(state),
supportOption: makeSelectClientSetting(settings.SUPPORT_OPTION)(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({

View file

@ -41,13 +41,14 @@ type Props = {
channelUri: string, channelUri: string,
viewCount: number, viewCount: number,
prepareEdit: ({}, string, {}) => void, prepareEdit: ({}, string, {}) => void,
openModal: (id: string, { uri: string }) => void, openModal: (id: string, { uri: string, claimIsMine: boolean, isSupport: boolean }) => void,
markSubscriptionRead: (string, string) => void, markSubscriptionRead: (string, string) => void,
fetchViewCount: string => void, fetchViewCount: string => void,
balance: number, balance: number,
title: string, title: string,
thumbnail: ?string, thumbnail: ?string,
nsfw: boolean, nsfw: boolean,
supportOption: boolean,
}; };
class FilePage extends React.Component<Props> { class FilePage extends React.Component<Props> {
@ -149,6 +150,7 @@ class FilePage extends React.Component<Props> {
title, title,
thumbnail, thumbnail,
nsfw, nsfw,
supportOption,
} = this.props; } = this.props;
// File info // File info
@ -246,9 +248,17 @@ class FilePage extends React.Component<Props> {
<Button <Button
button="alt" button="alt"
icon={claimIsMine ? icons.SUPPORT : icons.TIP} icon={claimIsMine ? icons.SUPPORT : icons.TIP}
label={claimIsMine ? __('Add support') : __('Send a tip')} label={claimIsMine ? __('Support') : __('Tip')}
onClick={() => openModal(MODALS.SEND_TIP, { uri, claimIsMine })} onClick={() => openModal(MODALS.SEND_TIP, { uri, claimIsMine, isSupport: false })}
/> />
{!claimIsMine && supportOption && (
<Button
button="alt"
icon={icons.SUPPORT}
label={__('Support')}
onClick={() => openModal(MODALS.SEND_TIP, { uri, claimIsMine, isSupport: true })}
/>
)}
</React.Fragment> </React.Fragment>
} }
<Button <Button

View file

@ -40,7 +40,7 @@ class RewardsPage extends PureComponent<Props> {
{__( {__(
'This step is optional. You can continue to use this app without rewards, but LBC may be needed for some tasks.' 'This step is optional. You can continue to use this app without rewards, but LBC may be needed for some tasks.'
)}{' '} )}{' '}
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/rewards" /> <Button button="link" label={__('Learn more')} href="https://lbry.com/faq/rewards" />.
</p> </p>
</header> </header>

View file

@ -25,6 +25,7 @@ const select = state => ({
walletEncrypted: selectWalletIsEncrypted(state), walletEncrypted: selectWalletIsEncrypted(state),
osNotificationsEnabled: selectosNotificationsEnabled(state), osNotificationsEnabled: selectosNotificationsEnabled(state),
autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state), autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state),
supportOption: makeSelectClientSetting(settings.SUPPORT_OPTION)(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({

View file

@ -44,6 +44,7 @@ type Props = {
updateWalletStatus: () => void, updateWalletStatus: () => void,
walletEncrypted: boolean, walletEncrypted: boolean,
osNotificationsEnabled: boolean, osNotificationsEnabled: boolean,
supportOption: boolean,
}; };
type State = { type State = {
@ -150,6 +151,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
autoDownload, autoDownload,
setDaemonSetting, setDaemonSetting,
setClientSetting, setClientSetting,
supportOption,
} = this.props; } = this.props;
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0; const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
@ -276,9 +278,9 @@ class SettingsPage extends React.PureComponent<Props, State> {
name="show_nsfw" name="show_nsfw"
onChange={() => setClientSetting(SETTINGS.SHOW_NSFW, !showNsfw)} onChange={() => setClientSetting(SETTINGS.SHOW_NSFW, !showNsfw)}
checked={showNsfw} checked={showNsfw}
label={__('Show NSFW content')} label={__('Show mature content')}
helper={__( helper={__(
'NSFW content may include nudity, intense sexuality, profanity, or other adult content. By displaying NSFW content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ' 'Mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. '
)} )}
/> />
</Form> </Form>
@ -368,7 +370,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
name="encrypt_wallet" name="encrypt_wallet"
onChange={() => this.onChangeEncryptWallet()} onChange={() => this.onChangeEncryptWallet()}
checked={walletEncrypted} checked={walletEncrypted}
label={__('Encrypt my wallet with a custom password.')} label={__('Encrypt my wallet with a custom password')}
helper={ helper={
<React.Fragment> <React.Fragment>
{__('Secure your local wallet data with a custom password.')}{' '} {__('Secure your local wallet data with a custom password.')}{' '}
@ -386,6 +388,23 @@ class SettingsPage extends React.PureComponent<Props, State> {
</header> </header>
<Form className="card__content"> <Form className="card__content">
<FormField
type="setting"
name="support_option"
onChange={() => setClientSetting(SETTINGS.SUPPORT_OPTION, !supportOption)}
checked={supportOption}
label={__('Enable claim support')}
helper={
<React.Fragment>
{__('This will add a Support button along side tipping. Similar to tips, supports help ')}
<Button button="link" label={__(' discovery ')} href="https://lbry.com/faq/trending" />
{__(' but the LBC is returned to your wallet if revoked.')}
{__(' Both also help secure ')}
<Button button="link" label={__('vanity names')} href="https://lbry.com/faq/naming" />.
</React.Fragment>
}
/>
<FormField <FormField
type="setting" type="setting"
name="auto_download" name="auto_download"

View file

@ -24,6 +24,7 @@ const defaultState = {
[SETTINGS.THEME]: getLocalStorageSetting(SETTINGS.THEME, 'light'), [SETTINGS.THEME]: getLocalStorageSetting(SETTINGS.THEME, 'light'),
[SETTINGS.THEMES]: getLocalStorageSetting(SETTINGS.THEMES, []), [SETTINGS.THEMES]: getLocalStorageSetting(SETTINGS.THEMES, []),
[SETTINGS.AUTOMATIC_DARK_MODE_ENABLED]: getLocalStorageSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED, false), [SETTINGS.AUTOMATIC_DARK_MODE_ENABLED]: getLocalStorageSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED, false),
[SETTINGS.SUPPORT_OPTION]: getLocalStorageSetting(SETTINGS.SUPPORT_OPTION, false),
[SETTINGS.AUTOPLAY]: getLocalStorageSetting(SETTINGS.AUTOPLAY, false), [SETTINGS.AUTOPLAY]: getLocalStorageSetting(SETTINGS.AUTOPLAY, false),
[SETTINGS.RESULT_COUNT]: Number(getLocalStorageSetting(SETTINGS.RESULT_COUNT, 50)), [SETTINGS.RESULT_COUNT]: Number(getLocalStorageSetting(SETTINGS.RESULT_COUNT, 50)),
[SETTINGS.AUTO_DOWNLOAD]: getLocalStorageSetting(SETTINGS.AUTO_DOWNLOAD, true), [SETTINGS.AUTO_DOWNLOAD]: getLocalStorageSetting(SETTINGS.AUTO_DOWNLOAD, true),

View file

@ -575,8 +575,61 @@
"Confirm Claim Revoke": "Confirm Claim Revoke", "Confirm Claim Revoke": "Confirm Claim Revoke",
"Are you sure you want to remove this support?": "Are you sure you want to remove this support?", "Are you sure you want to remove this support?": "Are you sure you want to remove this support?",
"These credits are permanently yours and can be removed at any time. Removing this support will reduce the claim's discoverability and return the LBC to your spendable balance.": "These credits are permanently yours and can be removed at any time. Removing this support will reduce the claim's discoverability and return the LBC to your spendable balance.", "These credits are permanently yours and can be removed at any time. Removing this support will reduce the claim's discoverability and return the LBC to your spendable balance.": "These credits are permanently yours and can be removed at any time. Removing this support will reduce the claim's discoverability and return the LBC to your spendable balance.",
<<<<<<< HEAD
"Invalid character %s in name: %s.": "Invalid character %s in name: %s.", "Invalid character %s in name: %s.": "Invalid character %s in name: %s.",
"The better your tags are, the easier it will be for people to discover your channel.": "The better your tags are, the easier it will be for people to discover your channel.", "The better your tags are, the easier it will be for people to discover your channel.": "The better your tags are, the easier it will be for people to discover your channel.",
"Thumbnail (300 x 300)": "Thumbnail (300 x 300)", "Thumbnail (300 x 300)": "Thumbnail (300 x 300)",
"Cover (1000 x 160)": "Cover (1000 x 160)" "Cover (1000 x 160)": "Cover (1000 x 160)"
=======
"Enable option to support claims.": "Enable option to support claims.",
"Similar to tipping, but a deposit is held in your own wallet. Still affects trending and top calculations, as well as ": "Similar to tipping, but a deposit is held in your own wallet. Still affects trending and top calculations, as well as ",
"vanity names": "vanity names",
"Can be undone at any time via the transactions page.": "Can be undone at any time via the transactions page.",
"Learn more about discovery and trending": "Learn more about discovery and trending",
"Similar to tipping, but a deposit is held in your own wallet. Still affects discovery (trending and top calculations) and ": "Similar to tipping, but a deposit is held in your own wallet. Still affects discovery (trending and top calculations) and ",
"hello": "hello",
"Show mature content": "Show mature content",
"mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ": "mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ",
" Can be undone at any time via the transactions page.": " Can be undone at any time via the transactions page.",
" Can be undone at any time via the transactions page. ": " Can be undone at any time via the transactions page. ",
"Similar to tipping, but a deposit is held in your own wallet. Still affects ": "Similar to tipping, but a deposit is held in your own wallet. Still affects ",
" discovery (trending and top calculations)": " discovery (trending and top calculations)",
" and ": " and ",
" discovery via trending and top calculations)": " discovery via trending and top calculations)",
" as well as ": " as well as ",
" discovery via trending and top calculations": " discovery via trending and top calculations",
"This will appear as a tip for ": "This will appear as a tip for ",
"This will increase the overall bid amount for ": "This will increase the overall bid amount for ",
"Similar to tipping, except the LBC remains yours and can be withdrawn at any time. Still affects ": "Similar to tipping, except the LBC remains yours and can be withdrawn at any time. Still affects ",
"The tags you follow will change what's trending for you. ": "The tags you follow will change what's trending for you. ",
"Are you sure want to revoke this claim?": "Are you sure want to revoke this claim?",
"This will prevent others from resolving and accessing the content you published. It will return the LBC to your spendable balance, less a small transaction fee.": "This will prevent others from resolving and accessing the content you published. It will return the LBC to your spendable balance, less a small transaction fee.",
"Enable claim support.": "Enable claim support.",
"Similar to tipping, except the LBC remains yours and can be withdrawn at any time. Supports influence ": "Similar to tipping, except the LBC remains yours and can be withdrawn at any time. Supports influence ",
"Encrypt my wallet with a custom password": "Encrypt my wallet with a custom password",
"Enable claim support": "Enable claim support",
"Similar to tipping, supports help": "Similar to tipping, supports help",
" discovery, trending and top calculations": " discovery, trending and top calculations",
"but the LBC remains yours and can be withdrawn at any time. ": "but the LBC remains yours and can be withdrawn at any time. ",
" Both also help secure ": " Both also help secure ",
"Similar to tipping, supports help ": "Similar to tipping, supports help ",
" discovery, trending and top calculations ": " discovery, trending and top calculations ",
"Mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ": "Mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ",
" but the LBC remains yours and can be withdrawn at any time. ": " but the LBC remains yours and can be withdrawn at any time. ",
" but the LBC is returned to you when revoked.": " but the LBC is returned to you when revoked.",
" but the LBC is returned to you if revoked.": " but the LBC is returned to you if revoked.",
" but the LBC is returned to your wallet if revoked.": " but the LBC is returned to your wallet if revoked.",
" but the LBC is returned to youself if revoked.": " but the LBC is returned to youself if revoked.",
" but the LBC is returned to youself, if revoked.": " but the LBC is returned to youself, if revoked.",
" but the LBC is returned to yourself if revoked.": " but the LBC is returned to yourself if revoked.",
"This will add a Support button next to the tipping option. Similar to tipping, supports help ": "This will add a Support button next to the tipping option. Similar to tipping, supports help ",
"This will add a Support button next to the tipping option. Similar to tips, supports help ": "This will add a Support button next to the tipping option. Similar to tips, supports help ",
"This will add a Support button next to `Send a Tip`. Similar to tips, supports help ": "This will add a Support button next to `Send a Tip`. Similar to tips, supports help ",
"This will add a Support button next to \"Send a Tip\". Similar to tips, supports help ": "This will add a Support button next to \"Send a Tip\". Similar to tips, supports help ",
"This will add a Support button along side tipping. Similar to tips, supports help ": "This will add a Support button along side tipping. Similar to tips, supports help ",
"Invalid character %s in name: %s.": "Invalid character %s in name: %s.",
" discovery ": " discovery ",
"This will add a Support button along side Tips. Similar to tips, supports help ": "This will add a Support button along side Tips. Similar to tips, supports help ",
"This will add a Support button along side Tip. Similar to tips, supports help ": "This will add a Support button along side Tip. Similar to tips, supports help "
>>>>>>> feat: experimental support option
} }

View file

@ -6653,9 +6653,15 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
yargs "^13.2.2" yargs "^13.2.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
<<<<<<< HEAD
lbry-redux@lbryio/lbry-redux#5080eb3ea1f09ce03c4f50d9224feddf737628d3: lbry-redux@lbryio/lbry-redux#5080eb3ea1f09ce03c4f50d9224feddf737628d3:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/5080eb3ea1f09ce03c4f50d9224feddf737628d3" resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/5080eb3ea1f09ce03c4f50d9224feddf737628d3"
=======
lbry-redux@lbryio/lbry-redux#ee93a47f893052d6a94b6439eb09eb3fb976f90c:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/ee93a47f893052d6a94b6439eb09eb3fb976f90c"
>>>>>>> feat: experimental support option
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"