Selector change

- and remove from where it was unused
This commit is contained in:
Rafael 2022-04-20 10:06:30 -03:00 committed by Thomas Zarebczan
parent 089fc52a7d
commit 0dccabe692
9 changed files with 16 additions and 20 deletions

View file

@ -1,11 +1,11 @@
import { connect } from 'react-redux';
import { selectInsufficientCreditsForUri } from 'redux/selectors/content';
import { makeSelectClaimWasPurchased } from 'redux/selectors/claims';
import { selectClaimWasPurchasedForUri } from 'redux/selectors/claims';
import ClaimInsufficientCredits from './view';
const select = (state, props) => ({
isInsufficientCredits: selectInsufficientCreditsForUri(state, props.uri),
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
claimWasPurchased: selectClaimWasPurchasedForUri(state, props.uri),
});
export default connect(select)(ClaimInsufficientCredits);

View file

@ -5,7 +5,6 @@ import {
selectClaimIsMine,
makeSelectClaimIsPending,
makeSelectReflectingClaimForUri,
makeSelectClaimWasPurchased,
selectTitleForUri,
selectDateForUri,
} from 'redux/selectors/claims';
@ -45,7 +44,6 @@ const select = (state, props) => {
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
isSubscribed: props.uri && selectIsSubscribedForUri(state, props.uri),
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
isLivestream,
isLivestreamActive: isLivestream && selectIsActiveLivestreamForUri(state, props.uri),
livestreamViewerCount: isLivestream && claim ? selectViewersForId(state, claim.claim_id) : undefined,

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { selectClaimIsMine, selectClaimForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
import { selectClaimIsMine, selectClaimForUri } from 'redux/selectors/claims';
import {
makeSelectFileInfoForUri,
makeSelectDownloadingForUri,
@ -21,7 +21,6 @@ const select = (state, props) => {
claimIsMine: selectClaimIsMine(state, claim),
claim,
costInfo: selectCostInfoForUri(state, props.uri),
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
};
};

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { selectClaimForUri, makeSelectClaimWasPurchased, selectClaimIsMine } from 'redux/selectors/claims';
import { selectClaimForUri, selectClaimWasPurchasedForUri, selectClaimIsMine } from 'redux/selectors/claims';
import { selectCostInfoForUri, doFetchCostInfoForUri, selectFetchingCostInfoForUri } from 'lbryinc';
import FilePrice from './view';
@ -9,7 +9,7 @@ const select = (state, props) => {
return {
claim,
claimIsMine: selectClaimIsMine(state, claim),
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
claimWasPurchased: selectClaimWasPurchasedForUri(state, props.uri),
costInfo: selectCostInfoForUri(state, props.uri),
fetching: selectFetchingCostInfoForUri(state, props.uri),
};

View file

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import {
selectClaimForUri,
selectTitleForUri,
makeSelectClaimWasPurchased,
selectClaimWasPurchasedForUri,
selectGeoRestrictionForUri,
} from 'redux/selectors/claims';
import { makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
@ -51,7 +51,7 @@ const select = (state, props) => {
renderMode: makeSelectFileRenderModeForUri(uri)(state),
videoTheaterMode: selectClientSetting(state, SETTINGS.VIDEO_THEATER_MODE),
costInfo: selectCostInfoForUri(state, uri),
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
claimWasPurchased: selectClaimWasPurchasedForUri(state, uri),
nextListUri: collectionId && makeSelectNextUrlForCollectionAndUrl(collectionId, uri)(state),
previousListUri: collectionId && makeSelectPreviousUrlForCollectionAndUrl(collectionId, uri)(state),
collectionId,

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import { doUriInitiatePlay } from 'redux/actions/content';
import { makeSelectClaimWasPurchased, selectClaimForUri } from 'redux/selectors/claims';
import { selectClaimWasPurchasedForUri, selectClaimForUri } from 'redux/selectors/claims';
import { makeSelectFileInfoForUri } from 'redux/selectors/file_info';
import * as SETTINGS from 'constants/settings';
import { selectCostInfoForUri } from 'lbryinc';
@ -36,7 +36,7 @@ const select = (state, props) => {
autoplay: selectClientSetting(state, SETTINGS.AUTOPLAY_MEDIA),
costInfo: selectCostInfoForUri(state, uri),
renderMode: makeSelectFileRenderModeForUri(uri)(state),
claimWasPurchased: makeSelectClaimWasPurchased(uri)(state),
claimWasPurchased: selectClaimWasPurchasedForUri(state, uri),
authenticated: selectUserVerifiedEmail(state),
isCurrentClaimLive: selectIsActiveLivestreamForUri(state, uri),
isLivestreamClaim: isStreamPlaceholderClaim(claim),

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux';
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri } from 'redux/selectors/file_info';
import { makeSelectClaimWasPurchased } from 'redux/selectors/claims';
import { selectClaimWasPurchasedForUri } from 'redux/selectors/claims';
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
import { makeSelectFileRenderModeForUri, selectPrimaryUri } from 'redux/selectors/content';
import { withRouter } from 'react-router';
@ -14,7 +14,7 @@ const select = (state, props) => ({
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
costInfo: selectCostInfoForUri(state, props.uri),
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
claimWasPurchased: selectClaimWasPurchasedForUri(state, props.uri),
});
const perform = (dispatch) => ({

View file

@ -5,7 +5,7 @@ import * as MODALS from 'constants/modal_types';
import { ipcRenderer } from 'electron';
// @endif
import { doOpenModal, doAnalyticsView, doAnaltyicsPurchaseEvent } from 'redux/actions/app';
import { makeSelectClaimForUri, selectClaimIsMineForUri, makeSelectClaimWasPurchased } from 'redux/selectors/claims';
import { makeSelectClaimForUri, selectClaimIsMineForUri, selectClaimWasPurchasedForUri } from 'redux/selectors/claims';
import {
makeSelectFileInfoForUri,
selectFileInfosByOutpoint,
@ -179,7 +179,7 @@ export function doPlayUri(
const fileInfo = makeSelectFileInfoForUri(uri)(state);
const uriIsStreamable = makeSelectUriIsStreamable(uri)(state);
const downloadingByOutpoint = selectDownloadingByOutpoint(state);
const claimWasPurchased = makeSelectClaimWasPurchased(uri)(state);
const claimWasPurchased = selectClaimWasPurchasedForUri(state, uri);
const alreadyDownloaded = fileInfo && (fileInfo.completed || (fileInfo.blobs_remaining === 0 && uriIsStreamable));
const alreadyDownloading = fileInfo && !!downloadingByOutpoint[fileInfo.outpoint];

View file

@ -294,10 +294,9 @@ export const makeSelectMyPurchasesForPage = (query: ?string, page: number = 1) =
}
);
export const makeSelectClaimWasPurchased = (uri: string) =>
createSelector(makeSelectClaimForUri(uri), (claim) => {
return claim && claim.purchase_receipt !== undefined;
});
export const selectClaimWasPurchasedForUri = createSelector(selectClaimForUri, (claim) =>
Boolean(claim?.purchase_receipt !== undefined)
);
export const selectAllFetchingChannelClaims = createSelector(selectState, (state) => state.fetchingChannelClaims || {});