feat: add tip/supports to channels
fixes: https://github.com/lbryio/lbry-desktop/issues/1397
This commit is contained in:
parent
7c88760205
commit
53ce5dcb11
2 changed files with 32 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import * as settings from 'constants/settings';
|
||||||
import {
|
import {
|
||||||
makeSelectClaimIsMine,
|
makeSelectClaimIsMine,
|
||||||
makeSelectTitleForUri,
|
makeSelectTitleForUri,
|
||||||
|
@ -10,6 +11,8 @@ import {
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectBlackListedOutpoints } from 'lbryinc';
|
import { selectBlackListedOutpoints } from 'lbryinc';
|
||||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||||
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import ChannelPage from './view';
|
import ChannelPage from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
@ -22,9 +25,14 @@ const select = (state, props) => ({
|
||||||
isSubscribed: makeSelectIsSubscribed(props.uri, true)(state),
|
isSubscribed: makeSelectIsSubscribed(props.uri, true)(state),
|
||||||
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
||||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
|
supportOption: makeSelectClientSetting(settings.SUPPORT_OPTION)(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
const perform = dispatch => ({
|
||||||
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
select,
|
select,
|
||||||
null
|
perform
|
||||||
)(ChannelPage);
|
)(ChannelPage);
|
||||||
|
|
|
@ -16,6 +16,7 @@ import ChannelEdit from 'component/channelEdit';
|
||||||
import ClaimUri from 'component/claimUri';
|
import ClaimUri from 'component/claimUri';
|
||||||
import * as ICONS from 'constants/icons';
|
import * as ICONS from 'constants/icons';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
import * as MODALS from 'constants/modal_types';
|
||||||
|
|
||||||
const PAGE_VIEW_QUERY = `view`;
|
const PAGE_VIEW_QUERY = `view`;
|
||||||
const ABOUT_PAGE = `about`;
|
const ABOUT_PAGE = `about`;
|
||||||
|
@ -37,6 +38,8 @@ type Props = {
|
||||||
txid: string,
|
txid: string,
|
||||||
nout: number,
|
nout: number,
|
||||||
}>,
|
}>,
|
||||||
|
openModal: (id: string, { uri: string, claimIsMine?: boolean, isSupport?: boolean }) => void,
|
||||||
|
supportOption: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ChannelPage(props: Props) {
|
function ChannelPage(props: Props) {
|
||||||
|
@ -53,6 +56,8 @@ function ChannelPage(props: Props) {
|
||||||
isSubscribed,
|
isSubscribed,
|
||||||
channelIsBlocked,
|
channelIsBlocked,
|
||||||
blackListedOutpoints,
|
blackListedOutpoints,
|
||||||
|
openModal,
|
||||||
|
supportOption,
|
||||||
} = props;
|
} = props;
|
||||||
const { channelName } = parseURI(uri);
|
const { channelName } = parseURI(uri);
|
||||||
const { search } = location;
|
const { search } = location;
|
||||||
|
@ -127,6 +132,24 @@ function ChannelPage(props: Props) {
|
||||||
<Tab>{editing ? __('Editing Your Channel') : __('About')}</Tab>
|
<Tab>{editing ? __('Editing Your Channel') : __('About')}</Tab>
|
||||||
<div className="card__actions--inline">
|
<div className="card__actions--inline">
|
||||||
{!channelIsBlocked && !channelIsBlackListed && <ShareButton uri={uri} />}
|
{!channelIsBlocked && !channelIsBlackListed && <ShareButton uri={uri} />}
|
||||||
|
{!channelIsMine && (
|
||||||
|
<Button
|
||||||
|
button="alt"
|
||||||
|
icon={ICONS.TIP}
|
||||||
|
label={__('Tip')}
|
||||||
|
title={__('Send a tip to this creator')}
|
||||||
|
onClick={() => openModal(MODALS.SEND_TIP, { uri, channelIsMine, isSupport: false })}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{(channelIsMine || (!channelIsMine && supportOption)) && (
|
||||||
|
<Button
|
||||||
|
button="alt"
|
||||||
|
icon={ICONS.SUPPORT}
|
||||||
|
label={__('Support')}
|
||||||
|
title={__('Support this creator')}
|
||||||
|
onClick={() => openModal(MODALS.SEND_TIP, { uri, channelIsMine, isSupport: true })}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{!channelIsBlocked && !channelIsBlackListed && <SubscribeButton uri={permanentUrl} />}
|
{!channelIsBlocked && !channelIsBlackListed && <SubscribeButton uri={permanentUrl} />}
|
||||||
{!isSubscribed && <BlockButton uri={permanentUrl} />}
|
{!isSubscribed && <BlockButton uri={permanentUrl} />}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue