Separating out the lint fixes just to make the next commmit clearer.
This commit is contained in:
infinite-persistence 2021-02-25 14:23:23 +08:00 committed by Sean Yesmunt
parent 05740cad75
commit 891207df3d
3 changed files with 17 additions and 16 deletions

View file

@ -13,7 +13,7 @@ const select = (state, props) => ({
renderMode: makeSelectFileRenderModeForUri(props.uri)(state), renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
}); });
const perform = dispatch => ({ const perform = (dispatch) => ({
triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)), triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)),
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()), claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
}); });

View file

@ -22,7 +22,7 @@ export function doOpenFileInFolder(path) {
} }
export function doOpenFileInShell(path) { export function doOpenFileInShell(path) {
return dispatch => { return (dispatch) => {
const success = shell.openPath(path); const success = shell.openPath(path);
if (!success) { if (!success) {
dispatch(doOpenFileInFolder(path)); dispatch(doOpenFileInFolder(path));
@ -31,7 +31,7 @@ export function doOpenFileInShell(path) {
} }
export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim, cb) { export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim, cb) {
return dispatch => { return (dispatch) => {
if (abandonClaim) { if (abandonClaim) {
const [txid, nout] = outpoint.split(':'); const [txid, nout] = outpoint.split(':');
dispatch(doAbandonClaim(txid, Number(nout), cb)); dispatch(doAbandonClaim(txid, Number(nout), cb));
@ -67,7 +67,7 @@ export function doDeleteFileAndMaybeGoBack(uri, deleteFromComputer, abandonClaim
} }
actions.push( actions.push(
doDeleteFile(outpoint || claimOutpoint, deleteFromComputer, abandonClaim, abandonState => { doDeleteFile(outpoint || claimOutpoint, deleteFromComputer, abandonClaim, (abandonState) => {
if (abandonState === ABANDON_STATES.DONE) { if (abandonState === ABANDON_STATES.DONE) {
if (abandonClaim) { if (abandonClaim) {
dispatch(goBack()); dispatch(goBack());

View file

@ -25,10 +25,11 @@ const HISTORY_ITEMS_PER_PAGE = 50;
export const selectState = (state: any) => state.content || {}; export const selectState = (state: any) => state.content || {};
export const selectPlayingUri = createSelector(selectState, state => state.playingUri); export const selectPlayingUri = createSelector(selectState, (state) => state.playingUri);
export const selectPrimaryUri = createSelector(selectState, state => state.primaryUri); export const selectPrimaryUri = createSelector(selectState, (state) => state.primaryUri);
export const makeSelectIsPlaying = (uri: string) => createSelector(selectPrimaryUri, primaryUri => primaryUri === uri); export const makeSelectIsPlaying = (uri: string) =>
createSelector(selectPrimaryUri, (primaryUri) => primaryUri === uri);
export const makeSelectIsPlayerFloating = (location: UrlLocation) => export const makeSelectIsPlayerFloating = (location: UrlLocation) =>
createSelector(selectPrimaryUri, selectPlayingUri, selectClaimsByUri, (primaryUri, playingUri, claimsByUri) => { createSelector(selectPrimaryUri, selectPlayingUri, selectClaimsByUri, (primaryUri, playingUri, claimsByUri) => {
@ -55,9 +56,9 @@ export const makeSelectContentPositionForUri = (uri: string) =>
return state.positions[id] ? state.positions[id][outpoint] : null; return state.positions[id] ? state.positions[id][outpoint] : null;
}); });
export const selectHistory = createSelector(selectState, state => state.history || []); export const selectHistory = createSelector(selectState, (state) => state.history || []);
export const selectHistoryPageCount = createSelector(selectHistory, history => export const selectHistoryPageCount = createSelector(selectHistory, (history) =>
Math.ceil(history.length / HISTORY_ITEMS_PER_PAGE) Math.ceil(history.length / HISTORY_ITEMS_PER_PAGE)
); );
@ -69,10 +70,10 @@ export const makeSelectHistoryForPage = (page: number) =>
}); });
export const makeSelectHistoryForUri = (uri: string) => export const makeSelectHistoryForUri = (uri: string) =>
createSelector(selectHistory, history => history.find(i => i.uri === uri)); createSelector(selectHistory, (history) => history.find((i) => i.uri === uri));
export const makeSelectHasVisitedUri = (uri: string) => export const makeSelectHasVisitedUri = (uri: string) =>
createSelector(makeSelectHistoryForUri(uri), history => Boolean(history)); createSelector(makeSelectHistoryForUri(uri), (history) => Boolean(history));
export const makeSelectNextUnplayedRecommended = (uri: string) => export const makeSelectNextUnplayedRecommended = (uri: string) =>
createSelector( createSelector(
@ -118,11 +119,11 @@ export const makeSelectNextUnplayedRecommended = (uri: string) =>
} }
const channel = claim && claim.signing_channel; const channel = claim && claim.signing_channel;
if (channel && blockedChannels.some(blockedUri => blockedUri === channel.permanent_url)) { if (channel && blockedChannels.some((blockedUri) => blockedUri === channel.permanent_url)) {
continue; continue;
} }
if (!history.some(item => item.uri === recommendedForUri[i])) { if (!history.some((item) => item.uri === recommendedForUri[i])) {
return recommendedForUri[i]; return recommendedForUri[i];
} }
} }
@ -130,12 +131,12 @@ export const makeSelectNextUnplayedRecommended = (uri: string) =>
} }
); );
export const selectRecentHistory = createSelector(selectHistory, history => { export const selectRecentHistory = createSelector(selectHistory, (history) => {
return history.slice(0, RECENT_HISTORY_AMOUNT); return history.slice(0, RECENT_HISTORY_AMOUNT);
}); });
export const makeSelectCategoryListUris = (uris: ?Array<string>, channel: string) => export const makeSelectCategoryListUris = (uris: ?Array<string>, channel: string) =>
createSelector(makeSelectClaimsInChannelForCurrentPageState(channel), channelClaims => { createSelector(makeSelectClaimsInChannelForCurrentPageState(channel), (channelClaims) => {
if (uris) return uris; if (uris) return uris;
if (channelClaims) { if (channelClaims) {
@ -153,7 +154,7 @@ export const makeSelectShouldObscurePreview = (uri: string) =>
// should probably be in lbry-redux, yarn link was fighting me // should probably be in lbry-redux, yarn link was fighting me
export const makeSelectFileExtensionForUri = (uri: string) => export const makeSelectFileExtensionForUri = (uri: string) =>
createSelector(makeSelectFileNameForUri(uri), fileName => { createSelector(makeSelectFileNameForUri(uri), (fileName) => {
return fileName && path.extname(fileName).substring(1); return fileName && path.extname(fileName).substring(1);
}); });