Fix issue where channel upload viewcounts were creating a new line #7154

Merged
mayeaux merged 7 commits from improve-viewcount-display into master 2021-09-29 21:04:43 +02:00
4 changed files with 17 additions and 10 deletions
Showing only changes of commit fce424387b - Show all commits

View file

@ -16,6 +16,7 @@ type Props = {
isLivestream: boolean, isLivestream: boolean,
}; };
// previews used in channel overview and homepage (and other places?)
function ClaimPreviewSubtitle(props: Props) { function ClaimPreviewSubtitle(props: Props) {
const { pending, uri, claim, type, beginPublish, isLivestream } = props; const { pending, uri, claim, type, beginPublish, isLivestream } = props;
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0; const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;

View file

@ -12,7 +12,7 @@ import {
makeSelectDateForUri, makeSelectDateForUri,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc'; import { makeSelectViewCountForUri, selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
import { makeSelectIsActiveLivestream } from 'redux/selectors/livestream'; import { makeSelectIsActiveLivestream } from 'redux/selectors/livestream';
import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectShowMatureContent } from 'redux/selectors/settings';
import ClaimPreviewTile from './view'; import ClaimPreviewTile from './view';
@ -38,6 +38,7 @@ const select = (state, props) => {
isMature: makeSelectClaimIsNsfw(props.uri)(state), isMature: makeSelectClaimIsNsfw(props.uri)(state),
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state), isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
isLivestreamActive: makeSelectIsActiveLivestream(props.uri)(state), isLivestreamActive: makeSelectIsActiveLivestream(props.uri)(state),
viewCount: makeSelectViewCountForUri(props.uri)(state),
}; };
}; };

View file

@ -48,13 +48,15 @@ type Props = {
showMature: boolean, showMature: boolean,
showHiddenByUser?: boolean, showHiddenByUser?: boolean,
properties?: (Claim) => void, properties?: (Claim) => void,
live?: boolean,
collectionId?: string, collectionId?: string,
showNoSourceClaims?: boolean, showNoSourceClaims?: boolean,
isLivestream: boolean, isLivestream: boolean,
viewCount: string,
isLivestreamActive: boolean, isLivestreamActive: boolean,
}; };
// preview image cards used in related video functionality // preview image cards used in related video functionality, channel overview page and homepage
function ClaimPreviewTile(props: Props) { function ClaimPreviewTile(props: Props) {
const { const {
history, history,
@ -80,6 +82,7 @@ function ClaimPreviewTile(props: Props) {
isLivestreamActive, isLivestreamActive,
collectionId, collectionId,
mediaDuration, mediaDuration,
viewCount,
} = props; } = props;
const isRepost = claim && claim.repost_channel_url; const isRepost = claim && claim.repost_channel_url;
const isCollection = claim && claim.value_type === 'collection'; const isCollection = claim && claim.value_type === 'collection';
@ -196,6 +199,10 @@ function ClaimPreviewTile(props: Props) {
liveProperty = (claim) => <>LIVE</>; liveProperty = (claim) => <>LIVE</>;
} }
const isChannelPage = window.location.pathname.startsWith('/@');
const shouldShowViewCount = !(!viewCount || (claim && claim.repost_url) || isLivestream || !isChannelPage);
return ( return (
<li <li
onClick={handleClick} onClick={handleClick}
@ -245,7 +252,9 @@ function ClaimPreviewTile(props: Props) {
<ClaimMenuList uri={uri} collectionId={listId} channelUri={channelUri} /> <ClaimMenuList uri={uri} collectionId={listId} channelUri={channelUri} />
</div> </div>
<div> <div>
<div className="claim-tile__info"> <div className={classnames('claim-tile__info', {
'contains_view_count': shouldShowViewCount,
})}>
{isChannel ? ( {isChannel ? (
<div className="claim-tile__about--channel"> <div className="claim-tile__about--channel">
<SubscribeButton uri={repostedChannelUri || uri} /> <SubscribeButton uri={repostedChannelUri || uri} />

View file

@ -1,19 +1,19 @@
@import '../init/vars'; @import '../init/vars';
.claim-tile__info { .contains_view_count {
// accommodating for large view counts on channel overview // accommodating for large view counts on channel overview
@media (min-width: $breakpoint-large) { @media (min-width: $breakpoint-large) {
padding: var(--spacing-s) 4px !important; padding: var(--spacing-s) 4px !important;
} }
.date_time { .date_time {
font-size: 11px; font-size: 11px !important;
} }
.channel-thumbnail { .channel-thumbnail {
// accommodating for large view counts on channel overview // accommodating for large view counts on channel overview
@media (min-width: $breakpoint-large) { @media (min-width: $breakpoint-large) {
margin-right: 4px !important; margin-right: 7px !important;
} }
} }
} }
@ -32,7 +32,3 @@
} }
} }
} }
.claim-tile__about {
font-size: 11px;
}