Add channel subscriptions count below author. #6867

Merged
Ruk33 merged 4 commits from 6746-channel-sub-count into master 2021-08-19 17:25:45 +02:00
2 changed files with 10 additions and 7 deletions
Showing only changes of commit a5af6f8874 - Show all commits
ui/component/fileTitleSection

View file

@ -8,13 +8,16 @@ import FileTitleSection from './view';
const select = (state, props) => {
const claim = makeSelectClaimForUri(props.uri)(state);
const viewers = claim && makeSelectViewersForId(claim.claim_id)(state);
const channelClaimId = claim && claim.signing_channel ? claim.signing_channel.claim_id : undefined;
const channelUri = claim && claim.signing_channel ? claim.signing_channel.canonical_url : undefined;
const subCount = channelUri && makeSelectSubCountForUri(channelUri)(state);
return {
claim,
viewers,
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
title: makeSelectTitleForUri(props.uri)(state),
subCount: channelUri && makeSelectSubCountForUri(channelUri)(state),
channelClaimId,
subCount,
};
};

View file

@ -16,7 +16,6 @@ import usePersistedState from 'effects/use-persisted-state';
import { ENABLE_MATURE } from 'config';
type Props = {
claim: ?Claim,
uri: string,
title: string,
nsfw: boolean,
@ -25,6 +24,7 @@ type Props = {
isLive?: boolean,
viewers?: number,
subCount: number,
channelClaimId?: string,
fetchSubCount: (string) => void,
};
@ -36,18 +36,18 @@ function FileTitleSection(props: Props) {
isNsfwBlocked,
livestream = false,
isLive = false,
claim,
viewers,
subCount,
channelClaimId,
fetchSubCount,
} = props;
const [hasAcknowledgedSec, setHasAcknowledgedSec] = usePersistedState('sec-nag', false);
React.useEffect(() => {
if (claim && claim.signing_channel) {
fetchSubCount(claim.signing_channel.claim_id);
if (channelClaimId) {
fetchSubCount(channelClaimId);
}
}, [claim, fetchSubCount]);
}, [channelClaimId, fetchSubCount]);
return (
<>