display reposts information #127

Merged
akinwale merged 1 commit from reposts-display into master 2020-03-02 18:03:58 +01:00
3 changed files with 42 additions and 9 deletions

View file

@ -99,9 +99,12 @@ class FileListItem extends React.PureComponent {
isRewardContent, isRewardContent,
channelClaimId, channelClaimId,
fullChannelUri, fullChannelUri,
repostChannel,
repostChannelUrl,
shortChannelUri, shortChannelUri,
shouldHide, shouldHide,
signingChannel; signingChannel,
isRepost;
if (claim) { if (claim) {
name = claim.name; name = claim.name;
signingChannel = claim.signing_channel; signingChannel = claim.signing_channel;
@ -111,6 +114,12 @@ class FileListItem extends React.PureComponent {
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;
repostChannelUrl = claim.repost_channel_url;
if (repostChannelUrl) {
const { claimName: repostChannelName } = parseURI(repostChannelUrl);
repostChannel = repostChannelName;
}
isRepost = !!repostChannelUrl;
if (blackListedOutpoints || filteredOutpoints) { if (blackListedOutpoints || filteredOutpoints) {
const outpointsToHide = !blackListedOutpoints const outpointsToHide = !blackListedOutpoints
@ -127,11 +136,20 @@ class FileListItem extends React.PureComponent {
return null; return null;
} }
const actualHideChannel = !isRepost && hideChannel;
const isChannel = name && name.startsWith('@'); const isChannel = name && name.startsWith('@');
const hasThumbnail = !!thumbnail; const hasThumbnail = !!thumbnail;
return ( return (
<View style={style}> <View>
{isRepost && (
<View style={fileListStyle.repostInfo}>
<Icon name={"retweet"} size={14} style={fileListStyle.repostIcon} />
<Text style={fileListStyle.repostChannelName}>
<Link text={repostChannel}
onPress={() => navigateToUri(navigation, normalizeURI(repostChannelUrl), null, false, null, false)} /> reposted</Text>
</View>
)}
<TouchableOpacity <TouchableOpacity
style={[style, isChannel ? fileListStyle.channelContainer : null]} style={[style, isChannel ? fileListStyle.channelContainer : null]}
onPress={this.onPressHandler} onPress={this.onPressHandler}
@ -212,7 +230,7 @@ class FileListItem extends React.PureComponent {
<View style={fileListStyle.titleContainer}> <View style={fileListStyle.titleContainer}>
<Text <Text
style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title} style={featuredResult ? fileListStyle.featuredTitle : fileListStyle.title}
numberOfLines={hideChannel ? 4 : 3} numberOfLines={actualHideChannel ? 4 : 3}
> >
{title || name} {title || name}
</Text> </Text>
@ -226,7 +244,7 @@ class FileListItem extends React.PureComponent {
</View> </View>
)} )}
{(channel || isChannel) && !hideChannel && ( {(channel || isChannel) && !actualHideChannel && (
<Link <Link
style={fileListStyle.publisher} style={fileListStyle.publisher}
text={isChannel ? name : channel} text={isChannel ? name : channel}

View file

@ -25,10 +25,10 @@ const claimListStyle = StyleSheet.create({
flex: 1, flex: 1,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
marginLeft: 8, marginLeft: 16,
marginRight: 8, marginRight: 16,
marginTop: 4, marginTop: 8,
marginBottom: 4, marginBottom: 12,
}, },
verticalLoading: { verticalLoading: {
width: '100%', width: '100%',

View file

@ -165,6 +165,21 @@ const fileListStyle = StyleSheet.create({
marginRight: 2, marginRight: 2,
color: '#0c604b', color: '#0c604b',
}, },
repostChannelName: {
color: Colors.DescriptionGrey,
fontFamily: 'Inter-Regular',
fontSize: 14,
},
repostIcon: {
color: Colors.DescriptionGrey,
marginRight: 4,
},
repostInfo: {
marginLeft: 16,
marginRight: 16,
alignItems: 'center',
flexDirection: 'row',
},
}); });
export default fileListStyle; export default fileListStyle;