Simplify makeSelectTitleForUri
No need to memo given no transformation.
This commit is contained in:
parent
d03b3fd50d
commit
bf324a1b79
21 changed files with 47 additions and 44 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
selectThumbnailForUri,
|
selectThumbnailForUri,
|
||||||
makeSelectCoverForUri,
|
makeSelectCoverForUri,
|
||||||
makeSelectMetadataItemForUri,
|
makeSelectMetadataItemForUri,
|
||||||
|
@ -21,7 +21,7 @@ import ChannelForm from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
thumbnailUrl: selectThumbnailForUri(state, props.uri),
|
thumbnailUrl: selectThumbnailForUri(state, props.uri),
|
||||||
coverUrl: makeSelectCoverForUri(props.uri)(state),
|
coverUrl: makeSelectCoverForUri(props.uri)(state),
|
||||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectClaimForUri, makeSelectTitleForUri } from 'redux/selectors/claims';
|
import { makeSelectClaimForUri, selectTitleForUri } from 'redux/selectors/claims';
|
||||||
import ChannelTitle from './view';
|
import ChannelTitle from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
makeSelectReflectingClaimForUri,
|
makeSelectReflectingClaimForUri,
|
||||||
makeSelectClaimWasPurchased,
|
makeSelectClaimWasPurchased,
|
||||||
isStreamPlaceholderClaim,
|
isStreamPlaceholderClaim,
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
selectDateForUri,
|
selectDateForUri,
|
||||||
} from 'redux/selectors/claims';
|
} from 'redux/selectors/claims';
|
||||||
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
||||||
|
@ -39,7 +39,7 @@ const select = (state, props) => {
|
||||||
claim,
|
claim,
|
||||||
mediaDuration,
|
mediaDuration,
|
||||||
date: props.uri && selectDateForUri(state, props.uri),
|
date: props.uri && selectDateForUri(state, props.uri),
|
||||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
title: props.uri && selectTitleForUri(state, props.uri),
|
||||||
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
||||||
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
||||||
obscureNsfw: selectShowMatureContent(state) === false,
|
obscureNsfw: selectShowMatureContent(state) === false,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectIsUriResolving,
|
makeSelectIsUriResolving,
|
||||||
getThumbnailFromClaim,
|
getThumbnailFromClaim,
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
isStreamPlaceholderClaim,
|
isStreamPlaceholderClaim,
|
||||||
selectDateForUri,
|
selectDateForUri,
|
||||||
} from 'redux/selectors/claims';
|
} from 'redux/selectors/claims';
|
||||||
|
@ -28,7 +28,7 @@ const select = (state, props) => {
|
||||||
date: props.uri && selectDateForUri(state, props.uri),
|
date: props.uri && selectDateForUri(state, props.uri),
|
||||||
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
||||||
thumbnail: getThumbnailFromClaim(claim),
|
thumbnail: getThumbnailFromClaim(claim),
|
||||||
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
title: props.uri && selectTitleForUri(state, props.uri),
|
||||||
banState: selectBanStateForUri(state, props.uri),
|
banState: selectBanStateForUri(state, props.uri),
|
||||||
showMature: selectShowMatureContent(state),
|
showMature: selectShowMatureContent(state),
|
||||||
isMature: claim ? isClaimNsfw(claim) : false,
|
isMature: claim ? isClaimNsfw(claim) : false,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectClaimForUri, makeSelectTitleForUri } from 'redux/selectors/claims';
|
import { makeSelectClaimForUri, selectTitleForUri } from 'redux/selectors/claims';
|
||||||
import ClaimPreviewTitle from './view';
|
import ClaimPreviewTitle from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select)(ClaimPreviewTitle);
|
export default connect(select)(ClaimPreviewTitle);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
selectThumbnailForUri,
|
selectThumbnailForUri,
|
||||||
makeSelectMetadataItemForUri,
|
makeSelectMetadataItemForUri,
|
||||||
makeSelectAmountForUri,
|
makeSelectAmountForUri,
|
||||||
|
@ -25,7 +25,7 @@ import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
thumbnailUrl: selectThumbnailForUri(state, props.uri),
|
thumbnailUrl: selectThumbnailForUri(state, props.uri),
|
||||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||||
tags: makeSelectMetadataItemForUri(props.uri, 'tags')(state),
|
tags: makeSelectMetadataItemForUri(props.uri, 'tags')(state),
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
makeSelectIsUriResolving,
|
makeSelectIsUriResolving,
|
||||||
getThumbnailFromClaim,
|
getThumbnailFromClaim,
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
makeSelectChannelForClaimUri,
|
makeSelectChannelForClaimUri,
|
||||||
selectClaimIsNsfwForUri,
|
selectClaimIsNsfwForUri,
|
||||||
selectClaimIdForUri,
|
selectClaimIdForUri,
|
||||||
|
@ -41,7 +41,7 @@ const select = (state, props) => {
|
||||||
channelClaim: collectionUri && makeSelectChannelForClaimUri(collectionUri)(state),
|
channelClaim: collectionUri && makeSelectChannelForClaimUri(collectionUri)(state),
|
||||||
isResolvingUri: collectionUri && makeSelectIsUriResolving(collectionUri)(state),
|
isResolvingUri: collectionUri && makeSelectIsUriResolving(collectionUri)(state),
|
||||||
thumbnail: getThumbnailFromClaim(claim),
|
thumbnail: getThumbnailFromClaim(claim),
|
||||||
title: collectionUri && makeSelectTitleForUri(collectionUri)(state),
|
title: collectionUri && selectTitleForUri(state, collectionUri),
|
||||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
filteredOutpoints: selectFilteredOutpoints(state),
|
filteredOutpoints: selectFilteredOutpoints(state),
|
||||||
blockedChannelUris: selectMutedChannels(state),
|
blockedChannelUris: selectMutedChannels(state),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectTitleForUri, selectClaimIsNsfwForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
import { selectTitleForUri, selectClaimIsNsfwForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
|
||||||
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
|
||||||
import {
|
import {
|
||||||
makeSelectNextUrlForCollectionAndUrl,
|
makeSelectNextUrlForCollectionAndUrl,
|
||||||
|
@ -30,7 +30,7 @@ const select = (state, props) => {
|
||||||
uri,
|
uri,
|
||||||
primaryUri,
|
primaryUri,
|
||||||
playingUri,
|
playingUri,
|
||||||
title: makeSelectTitleForUri(uri)(state),
|
title: selectTitleForUri(state, uri),
|
||||||
fileInfo: makeSelectFileInfoForUri(uri)(state),
|
fileInfo: makeSelectFileInfoForUri(uri)(state),
|
||||||
mature: selectClaimIsNsfwForUri(state, uri),
|
mature: selectClaimIsNsfwForUri(state, uri),
|
||||||
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectTitleForUri } from 'redux/selectors/claims';
|
import { selectTitleForUri } from 'redux/selectors/claims';
|
||||||
import FileTitleSection from './view';
|
import FileTitleSection from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select)(FileTitleSection);
|
export default connect(select)(FileTitleSection);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
|
import { doFetchSubCount, selectSubCountForUri } from 'lbryinc';
|
||||||
import { makeSelectTitleForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
import { selectTitleForUri, makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||||
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
|
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
|
||||||
import { makeSelectViewersForId } from 'redux/selectors/livestream';
|
import { makeSelectViewersForId } from 'redux/selectors/livestream';
|
||||||
import FileTitleSection from './view';
|
import FileTitleSection from './view';
|
||||||
|
@ -15,7 +15,7 @@ const select = (state, props) => {
|
||||||
return {
|
return {
|
||||||
viewers,
|
viewers,
|
||||||
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
channelClaimId,
|
channelClaimId,
|
||||||
subCount,
|
subCount,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import fileViewerEmbeddedTitle from './view';
|
import fileViewerEmbeddedTitle from './view';
|
||||||
import { makeSelectTagInClaimOrChannelForUri, makeSelectTitleForUri } from 'redux/selectors/claims';
|
import { makeSelectTagInClaimOrChannelForUri, selectTitleForUri } from 'redux/selectors/claims';
|
||||||
import { PREFERENCE_EMBED } from 'constants/tags';
|
import { PREFERENCE_EMBED } from 'constants/tags';
|
||||||
|
|
||||||
export default connect((state, props) => {
|
export default connect((state, props) => {
|
||||||
return {
|
return {
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
preferEmbed: makeSelectTagInClaimOrChannelForUri(props.uri, PREFERENCE_EMBED)(state),
|
preferEmbed: makeSelectTagInClaimOrChannelForUri(props.uri, PREFERENCE_EMBED)(state),
|
||||||
};
|
};
|
||||||
})(fileViewerEmbeddedTitle);
|
})(fileViewerEmbeddedTitle);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
selectClaimIsMine,
|
selectClaimIsMine,
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
getThumbnailFromClaim,
|
getThumbnailFromClaim,
|
||||||
selectClaimForUri,
|
selectClaimForUri,
|
||||||
makeSelectIsUriResolving,
|
makeSelectIsUriResolving,
|
||||||
|
@ -17,7 +17,7 @@ const select = (state, props) => {
|
||||||
return {
|
return {
|
||||||
uri: props.uri,
|
uri: props.uri,
|
||||||
claim,
|
claim,
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
thumbnail: getThumbnailFromClaim(claim),
|
thumbnail: getThumbnailFromClaim(claim),
|
||||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||||
channelIsMine: selectClaimIsMine(state, claim),
|
channelIsMine: selectClaimIsMine(state, claim),
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { connect } from 'react-redux';
|
||||||
import { doHideModal } from 'redux/actions/app';
|
import { doHideModal } from 'redux/actions/app';
|
||||||
import {
|
import {
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
selectRepostError,
|
selectRepostError,
|
||||||
selectRepostLoading,
|
selectRepostLoading,
|
||||||
selectMyClaimsWithoutChannels,
|
selectMyClaimsWithoutChannels,
|
||||||
|
@ -29,7 +29,7 @@ const select = (state, props) => ({
|
||||||
enteredContentClaim: makeSelectClaimForUri(props.contentUri)(state),
|
enteredContentClaim: makeSelectClaimForUri(props.contentUri)(state),
|
||||||
enteredRepostClaim: makeSelectClaimForUri(props.repostUri, false)(state),
|
enteredRepostClaim: makeSelectClaimForUri(props.repostUri, false)(state),
|
||||||
enteredRepostAmount: makeSelectEffectiveAmountForUri(props.repostUri)(state),
|
enteredRepostAmount: makeSelectEffectiveAmountForUri(props.repostUri)(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
balance: selectBalance(state),
|
balance: selectBalance(state),
|
||||||
error: selectRepostError(state),
|
error: selectRepostError(state),
|
||||||
reposting: selectRepostLoading(state),
|
reposting: selectRepostLoading(state),
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { selectHasNavigated, selectScrollStartingPosition, selectWelcomeVersion
|
||||||
import { selectHomepageData } from 'redux/selectors/settings';
|
import { selectHomepageData } from 'redux/selectors/settings';
|
||||||
import Router from './view';
|
import Router from './view';
|
||||||
import { normalizeURI } from 'util/lbryURI';
|
import { normalizeURI } from 'util/lbryURI';
|
||||||
import { makeSelectTitleForUri } from 'redux/selectors/claims';
|
import { selectTitleForUri } from 'redux/selectors/claims';
|
||||||
import { doSetHasNavigated } from 'redux/actions/app';
|
import { doSetHasNavigated } from 'redux/actions/app';
|
||||||
import { doUserSetReferrer } from 'redux/actions/user';
|
import { doUserSetReferrer } from 'redux/actions/user';
|
||||||
import { selectHasUnclaimedRefereeReward } from 'redux/selectors/rewards';
|
import { selectHasUnclaimedRefereeReward } from 'redux/selectors/rewards';
|
||||||
|
@ -28,7 +28,7 @@ const select = (state) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uri,
|
uri,
|
||||||
title: makeSelectTitleForUri(uri)(state),
|
title: selectTitleForUri(state, uri),
|
||||||
currentScroll: selectScrollStartingPosition(state),
|
currentScroll: selectScrollStartingPosition(state),
|
||||||
isAuthenticated: selectUserVerifiedEmail(state),
|
isAuthenticated: selectUserVerifiedEmail(state),
|
||||||
welcomeVersion: selectWelcomeVersion(state),
|
welcomeVersion: selectWelcomeVersion(state),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectClaimForUri, makeSelectTitleForUri } from 'redux/selectors/claims';
|
import { makeSelectClaimForUri, selectTitleForUri } from 'redux/selectors/claims';
|
||||||
import SocialShare from './view';
|
import SocialShare from './view';
|
||||||
import { selectUserInviteReferralCode, selectUser } from 'redux/selectors/user';
|
import { selectUserInviteReferralCode, selectUser } from 'redux/selectors/user';
|
||||||
import { makeSelectContentPositionForUri } from 'redux/selectors/content';
|
import { makeSelectContentPositionForUri } from 'redux/selectors/content';
|
||||||
|
@ -8,7 +8,7 @@ const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
referralCode: selectUserInviteReferralCode(state),
|
referralCode: selectUserInviteReferralCode(state),
|
||||||
user: selectUser(state),
|
user: selectUser(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
position: makeSelectContentPositionForUri(props.uri)(state),
|
position: makeSelectContentPositionForUri(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
selectClaimIsMineForUri,
|
selectClaimIsMineForUri,
|
||||||
selectFetchingMyChannels,
|
selectFetchingMyChannels,
|
||||||
|
@ -24,7 +24,7 @@ const select = (state, props) => ({
|
||||||
instantTipEnabled: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state),
|
instantTipEnabled: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state),
|
||||||
instantTipMax: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state),
|
instantTipMax: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state),
|
||||||
isPending: selectIsSendingSupport(state),
|
isPending: selectIsSendingSupport(state),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default withRouter(connect(select, { doHideModal, doSendTip, doSendCashTip })(WalletSendTip));
|
export default withRouter(connect(select, { doHideModal, doSendTip, doSendCashTip })(WalletSendTip));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doDeleteFileAndMaybeGoBack } from 'redux/actions/file';
|
import { doDeleteFileAndMaybeGoBack } from 'redux/actions/file';
|
||||||
import {
|
import {
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectIsAbandoningClaimForUri,
|
makeSelectIsAbandoningClaimForUri,
|
||||||
selectClaimIsMineForUri,
|
selectClaimIsMineForUri,
|
||||||
|
@ -12,7 +12,7 @@ import ModalRemoveFile from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claimIsMine: selectClaimIsMineForUri(state, props.uri),
|
claimIsMine: selectClaimIsMineForUri(state, props.uri),
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
isAbandoning: makeSelectIsAbandoningClaimForUri(props.uri)(state),
|
isAbandoning: makeSelectIsAbandoningClaimForUri(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
selectClaimIsMine,
|
selectClaimIsMine,
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
getThumbnailFromClaim,
|
getThumbnailFromClaim,
|
||||||
makeSelectCoverForUri,
|
makeSelectCoverForUri,
|
||||||
selectCurrentChannelPage,
|
selectCurrentChannelPage,
|
||||||
|
@ -21,7 +21,7 @@ const select = (state, props) => {
|
||||||
const claim = selectClaimForUri(state, props.uri);
|
const claim = selectClaimForUri(state, props.uri);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: makeSelectTitleForUri(props.uri)(state),
|
title: selectTitleForUri(state, props.uri),
|
||||||
thumbnail: getThumbnailFromClaim(claim),
|
thumbnail: getThumbnailFromClaim(claim),
|
||||||
cover: makeSelectCoverForUri(props.uri)(state),
|
cover: makeSelectCoverForUri(props.uri)(state),
|
||||||
channelIsMine: selectClaimIsMine(state, claim),
|
channelIsMine: selectClaimIsMine(state, claim),
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { connect } from 'react-redux';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
import CollectionPage from './view';
|
import CollectionPage from './view';
|
||||||
import {
|
import {
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
getThumbnailFromClaim,
|
getThumbnailFromClaim,
|
||||||
selectClaimIsMine,
|
selectClaimIsMine,
|
||||||
makeSelectClaimIsPending,
|
makeSelectClaimIsPending,
|
||||||
|
@ -38,7 +38,7 @@ const select = (state, props) => {
|
||||||
collectionUrls: makeSelectUrlsForCollectionId(collectionId)(state),
|
collectionUrls: makeSelectUrlsForCollectionId(collectionId)(state),
|
||||||
collectionCount: makeSelectCountForCollectionId(collectionId)(state),
|
collectionCount: makeSelectCountForCollectionId(collectionId)(state),
|
||||||
isResolvingCollection: makeSelectIsResolvingCollectionForId(collectionId)(state),
|
isResolvingCollection: makeSelectIsResolvingCollectionForId(collectionId)(state),
|
||||||
title: makeSelectTitleForUri(uri)(state),
|
title: selectTitleForUri(state, uri),
|
||||||
thumbnail: getThumbnailFromClaim(claim),
|
thumbnail: getThumbnailFromClaim(claim),
|
||||||
isMyClaim: selectClaimIsMine(state, claim), // or collection is mine?
|
isMyClaim: selectClaimIsMine(state, claim), // or collection is mine?
|
||||||
isMyCollection: makeSelectCollectionIsMine(collectionId)(state),
|
isMyCollection: makeSelectCollectionIsMine(collectionId)(state),
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectIsUriResolving,
|
makeSelectIsUriResolving,
|
||||||
makeSelectTotalPagesForChannel,
|
makeSelectTotalPagesForChannel,
|
||||||
makeSelectTitleForUri,
|
selectTitleForUri,
|
||||||
selectClaimIsMine,
|
selectClaimIsMine,
|
||||||
makeSelectClaimIsPending,
|
makeSelectClaimIsPending,
|
||||||
selectIsStreamPlaceholderForUri,
|
selectIsStreamPlaceholderForUri,
|
||||||
|
@ -76,7 +76,7 @@ const select = (state, props) => {
|
||||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
totalPages: makeSelectTotalPagesForChannel(uri, PAGE_SIZE)(state),
|
totalPages: makeSelectTotalPagesForChannel(uri, PAGE_SIZE)(state),
|
||||||
isSubscribed: makeSelectChannelInSubscriptions(uri)(state),
|
isSubscribed: makeSelectChannelInSubscriptions(uri)(state),
|
||||||
title: makeSelectTitleForUri(uri)(state),
|
title: selectTitleForUri(state, uri),
|
||||||
claimIsMine: selectClaimIsMine(state, claim),
|
claimIsMine: selectClaimIsMine(state, claim),
|
||||||
claimIsPending: makeSelectClaimIsPending(uri)(state),
|
claimIsPending: makeSelectClaimIsPending(uri)(state),
|
||||||
isLivestream: selectIsStreamPlaceholderForUri(state, uri),
|
isLivestream: selectIsStreamPlaceholderForUri(state, uri),
|
||||||
|
|
|
@ -332,10 +332,11 @@ export const makeSelectTotalPagesInChannelSearch = (uri: string) =>
|
||||||
return byChannel['pageCount'];
|
return byChannel['pageCount'];
|
||||||
});
|
});
|
||||||
|
|
||||||
export const selectMetadataForUri = createCachedSelector(selectClaimForUri, (claim, uri) => {
|
export const selectMetadataForUri = (state: State, uri: string) => {
|
||||||
|
const claim = selectClaimForUri(state, uri);
|
||||||
const metadata = claim && claim.value;
|
const metadata = claim && claim.value;
|
||||||
return metadata || (claim === undefined ? undefined : null);
|
return metadata || (claim === undefined ? undefined : null);
|
||||||
})((state, uri) => String(uri));
|
};
|
||||||
|
|
||||||
export const makeSelectMetadataForUri = (uri: string) =>
|
export const makeSelectMetadataForUri = (uri: string) =>
|
||||||
createSelector(makeSelectClaimForUri(uri), (claim) => {
|
createSelector(makeSelectClaimForUri(uri), (claim) => {
|
||||||
|
@ -348,8 +349,10 @@ export const makeSelectMetadataItemForUri = (uri: string, key: string) =>
|
||||||
return metadata ? metadata[key] : undefined;
|
return metadata ? metadata[key] : undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
export const makeSelectTitleForUri = (uri: string) =>
|
export const selectTitleForUri = (state: State, uri: string) => {
|
||||||
createSelector(makeSelectMetadataForUri(uri), (metadata) => metadata && metadata.title);
|
const metadata = selectMetadataForUri(state, uri);
|
||||||
|
return metadata && metadata.title;
|
||||||
|
};
|
||||||
|
|
||||||
export const selectDateForUri = createCachedSelector(
|
export const selectDateForUri = createCachedSelector(
|
||||||
selectClaimForUri, // input: (state, uri, ?returnRepost)
|
selectClaimForUri, // input: (state, uri, ?returnRepost)
|
||||||
|
|
Loading…
Reference in a new issue