show reward icon in content lists and file page
This commit is contained in:
parent
1e31d8d22b
commit
4ff2fb1def
6 changed files with 34 additions and 8 deletions
src
|
@ -18,7 +18,7 @@ const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||||
rewardedContentClaimIds: selectRewardContentClaimIds(state, props),
|
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||||
obscureNsfw: !selectShowNsfw(state),
|
obscureNsfw: !selectShowNsfw(state),
|
||||||
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
makeSelectTitleForUri,
|
makeSelectTitleForUri,
|
||||||
makeSelectThumbnailForUri,
|
makeSelectThumbnailForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
||||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import FileListItem from './view';
|
import FileListItem from './view';
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ const select = (state, props) => ({
|
||||||
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
nsfw: makeSelectClaimIsNsfw(props.uri)(state),
|
||||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||||
obscureNsfw: !selectShowNsfw(state),
|
obscureNsfw: !selectShowNsfw(state),
|
||||||
|
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||||
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: makeSelectTitleForUri(props.uri)(state),
|
||||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||||
|
|
|
@ -70,6 +70,7 @@ class FileListItem extends React.PureComponent {
|
||||||
obscureNsfw,
|
obscureNsfw,
|
||||||
onPress,
|
onPress,
|
||||||
navigation,
|
navigation,
|
||||||
|
rewardedContentClaimIds,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
hideChannel,
|
hideChannel,
|
||||||
onLongPress,
|
onLongPress,
|
||||||
|
@ -82,12 +83,21 @@ class FileListItem extends React.PureComponent {
|
||||||
const isResolving = !fileInfo && isResolvingUri;
|
const isResolving = !fileInfo && isResolvingUri;
|
||||||
const duration = claim && claim.value && claim.value.video ? claim.value.video.duration : null;
|
const duration = claim && claim.value && claim.value.video ? claim.value.video.duration : null;
|
||||||
|
|
||||||
let name, channel, height, channelClaimId, fullChannelUri, shortChannelUri, shouldHide, signingChannel;
|
let name,
|
||||||
|
channel,
|
||||||
|
height,
|
||||||
|
isRewardContent,
|
||||||
|
channelClaimId,
|
||||||
|
fullChannelUri,
|
||||||
|
shortChannelUri,
|
||||||
|
shouldHide,
|
||||||
|
signingChannel;
|
||||||
if (claim) {
|
if (claim) {
|
||||||
name = claim.name;
|
name = claim.name;
|
||||||
signingChannel = claim.signing_channel;
|
signingChannel = claim.signing_channel;
|
||||||
channel = signingChannel ? signingChannel.name : null;
|
channel = signingChannel ? signingChannel.name : null;
|
||||||
height = claim.height;
|
height = claim.height;
|
||||||
|
isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
||||||
channelClaimId = signingChannel ? signingChannel.claim_id : null;
|
channelClaimId = signingChannel ? signingChannel.claim_id : null;
|
||||||
fullChannelUri = channelClaimId ? `${channel}#${channelClaimId}` : channel;
|
fullChannelUri = channelClaimId ? `${channel}#${channelClaimId}` : channel;
|
||||||
shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
||||||
|
@ -150,9 +160,12 @@ class FileListItem extends React.PureComponent {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(title || name) && (
|
{(title || name) && (
|
||||||
<Text style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}>
|
<View style={fileListStyle.titleContainer}>
|
||||||
{this.formatTitle(title) || this.formatTitle(name)}
|
<Text style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}>
|
||||||
</Text>
|
{this.formatTitle(title) || this.formatTitle(name)}
|
||||||
|
</Text>
|
||||||
|
{isRewardContent && <Icon style={fileListStyle.rewardIcon} name="award" size={12} />}
|
||||||
|
</View>
|
||||||
)}
|
)}
|
||||||
{channel && !hideChannel && (
|
{channel && !hideChannel && (
|
||||||
<Link
|
<Link
|
||||||
|
|
|
@ -865,6 +865,7 @@ class FilePage extends React.PureComponent {
|
||||||
<Text style={filePageStyle.title} selectable>
|
<Text style={filePageStyle.title} selectable>
|
||||||
{title}
|
{title}
|
||||||
</Text>
|
</Text>
|
||||||
|
{isRewardContent && <Icon name="award" style={filePageStyle.rewardIcon} size={14} />}
|
||||||
<View style={filePageStyle.descriptionToggle}>
|
<View style={filePageStyle.descriptionToggle}>
|
||||||
<Icon name={this.state.showDescription ? 'caret-up' : 'caret-down'} size={24} />
|
<Icon name={this.state.showDescription ? 'caret-up' : 'caret-down'} size={24} />
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -105,6 +105,16 @@ const fileListStyle = StyleSheet.create({
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
|
titleContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginRight: 16,
|
||||||
|
},
|
||||||
|
rewardIcon: {
|
||||||
|
color: Colors.Red,
|
||||||
|
textAlign: 'right',
|
||||||
|
marginLeft: 4,
|
||||||
|
marginTop: 4,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default fileListStyle;
|
export default fileListStyle;
|
||||||
|
|
|
@ -354,8 +354,9 @@ const filePageStyle = StyleSheet.create({
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
},
|
},
|
||||||
rewardIcon: {
|
rewardIcon: {
|
||||||
color: Colors.White,
|
color: Colors.Red,
|
||||||
marginRight: 8,
|
marginTop: -8,
|
||||||
|
marginLeft: 8,
|
||||||
},
|
},
|
||||||
backButton: {
|
backButton: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue