remove trending in favor of lastClaimSearchUris
This commit is contained in:
parent
12f4c032b8
commit
e8466bbeec
13 changed files with 49 additions and 165 deletions
87
dist/bundle.es.js
vendored
87
dist/bundle.es.js
vendored
|
@ -231,9 +231,6 @@ const FETCH_COST_INFO_FAILED = 'FETCH_COST_INFO_FAILED';
|
|||
const TOGGLE_TAG_FOLLOW = 'TOGGLE_TAG_FOLLOW';
|
||||
const TAG_ADD = 'TAG_ADD';
|
||||
const TAG_DELETE = 'TAG_DELETE';
|
||||
const FETCH_TRENDING_STARTED = 'FETCH_TRENDING_STARTED';
|
||||
const FETCH_TRENDING_COMPLETED = 'FETCH_TRENDING_COMPLETED';
|
||||
const FETCH_TRENDING_FAILED = 'FETCH_TRENDING_FAILED';
|
||||
|
||||
var action_types = /*#__PURE__*/Object.freeze({
|
||||
WINDOW_FOCUSED: WINDOW_FOCUSED,
|
||||
|
@ -428,10 +425,7 @@ var action_types = /*#__PURE__*/Object.freeze({
|
|||
FETCH_COST_INFO_FAILED: FETCH_COST_INFO_FAILED,
|
||||
TOGGLE_TAG_FOLLOW: TOGGLE_TAG_FOLLOW,
|
||||
TAG_ADD: TAG_ADD,
|
||||
TAG_DELETE: TAG_DELETE,
|
||||
FETCH_TRENDING_STARTED: FETCH_TRENDING_STARTED,
|
||||
FETCH_TRENDING_COMPLETED: FETCH_TRENDING_COMPLETED,
|
||||
FETCH_TRENDING_FAILED: FETCH_TRENDING_FAILED
|
||||
TAG_DELETE: TAG_DELETE
|
||||
});
|
||||
|
||||
const API_DOWN = 'apiDown';
|
||||
|
@ -1423,6 +1417,10 @@ const makeSelectTagsForUri = uri => reselect.createSelector(makeSelectMetadataFo
|
|||
return metadata && metadata.tags || [];
|
||||
});
|
||||
|
||||
const selectFetchingClaimSearch = reselect.createSelector(selectState$1, state => state.fetchingClaimSearch);
|
||||
|
||||
const selectLastClaimSearchUris = reselect.createSelector(selectState$1, state => state.lastClaimSearchUris);
|
||||
|
||||
const selectState$2 = state => state.wallet || {};
|
||||
|
||||
const selectWalletState = selectState$2;
|
||||
|
@ -2191,7 +2189,7 @@ function doFetchChannelListMine() {
|
|||
};
|
||||
}
|
||||
|
||||
function doClaimSearch(amount = 20, options = {}, cb) {
|
||||
function doClaimSearch(amount = 20, options = {}) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: CLAIM_SEARCH_STARTED
|
||||
|
@ -2207,12 +2205,8 @@ function doClaimSearch(amount = 20, options = {}, cb) {
|
|||
|
||||
dispatch({
|
||||
type: CLAIM_SEARCH_COMPLETED,
|
||||
data: { resolveInfo }
|
||||
data: { resolveInfo, uris }
|
||||
});
|
||||
|
||||
if (cb) {
|
||||
cb(null, uris);
|
||||
}
|
||||
};
|
||||
|
||||
const failure = err => {
|
||||
|
@ -2220,9 +2214,6 @@ function doClaimSearch(amount = 20, options = {}, cb) {
|
|||
type: CLAIM_SEARCH_FAILED,
|
||||
error: err
|
||||
});
|
||||
if (cb) {
|
||||
cb(err);
|
||||
}
|
||||
};
|
||||
|
||||
lbryProxy.claim_search(_extends$3({
|
||||
|
@ -2776,32 +2767,6 @@ const doDeleteTag = name => ({
|
|||
}
|
||||
});
|
||||
|
||||
const doFetchByTags = (amount = 10, options = {}) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: FETCH_TRENDING_STARTED
|
||||
});
|
||||
|
||||
const callback = (error, uris = []) => {
|
||||
if (error) {
|
||||
return dispatch({
|
||||
type: FETCH_TRENDING_FAILED,
|
||||
error
|
||||
});
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: FETCH_TRENDING_COMPLETED,
|
||||
data: {
|
||||
uris
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
dispatch(doClaimSearch(amount, options, callback));
|
||||
};
|
||||
};
|
||||
|
||||
var _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
const reducers = {};
|
||||
|
@ -2817,7 +2782,9 @@ const defaultState = {
|
|||
myChannelClaims: new Set(),
|
||||
fetchingMyChannels: false,
|
||||
abandoningById: {},
|
||||
pendingById: {}
|
||||
pendingById: {},
|
||||
fetchingClaimSearch: false,
|
||||
lastClaimSearchUris: []
|
||||
};
|
||||
|
||||
function handleClaimAction(state, action) {
|
||||
|
@ -2860,7 +2827,7 @@ function handleClaimAction(state, action) {
|
|||
}
|
||||
|
||||
reducers[RESOLVE_URIS_COMPLETED] = (state, action) => {
|
||||
return handleClaimAction(state, action);
|
||||
return _extends$4({}, handleClaimAction(state, action));
|
||||
};
|
||||
|
||||
reducers[FETCH_CLAIM_LIST_MINE_STARTED] = state => Object.assign({}, state, {
|
||||
|
@ -3041,7 +3008,10 @@ reducers[CLAIM_SEARCH_STARTED] = state => {
|
|||
});
|
||||
};
|
||||
reducers[CLAIM_SEARCH_COMPLETED] = (state, action) => {
|
||||
return _extends$4({}, handleClaimAction(state, action), { fetchingClaimSearch: false });
|
||||
return _extends$4({}, handleClaimAction(state, action), {
|
||||
fetchingClaimSearch: false,
|
||||
lastClaimSearchUris: action.data.uris
|
||||
});
|
||||
};
|
||||
reducers[CLAIM_SEARCH_FAILED] = state => {
|
||||
return Object.assign({}, state, {
|
||||
|
@ -3774,9 +3744,7 @@ function getDefaultRecommendedTags() {
|
|||
|
||||
const defaultState$7 = {
|
||||
followedTags: defaultFollowedTags,
|
||||
knownTags: getDefaultRecommendedTags(),
|
||||
trending: [],
|
||||
fetchingTrending: false
|
||||
knownTags: getDefaultRecommendedTags()
|
||||
};
|
||||
|
||||
const tagsReducer = handleActions({
|
||||
|
@ -3821,18 +3789,7 @@ const tagsReducer = handleActions({
|
|||
knownTags: newKnownTags,
|
||||
followedTags: newFollowedTags
|
||||
});
|
||||
},
|
||||
[FETCH_TRENDING_STARTED]: state => _extends$b({}, state, {
|
||||
fetchingTrending: true
|
||||
}),
|
||||
[FETCH_TRENDING_COMPLETED]: (state, action) => _extends$b({}, state, {
|
||||
trending: action.data.uris,
|
||||
fetchingTrending: false
|
||||
}),
|
||||
[FETCH_TRENDING_FAILED]: state => _extends$b({}, state, {
|
||||
trending: [],
|
||||
fetchingTrending: false
|
||||
})
|
||||
}
|
||||
}, defaultState$7);
|
||||
|
||||
const selectState$5 = state => state.content || {};
|
||||
|
@ -3896,10 +3853,6 @@ const selectUnfollowedTags = reselect.createSelector(selectKnownTagsByName, sele
|
|||
return tagsToReturn;
|
||||
});
|
||||
|
||||
const selectTrendingUris = reselect.createSelector(selectState$7, state => state.trending || []);
|
||||
|
||||
const selectFetchingTrending = reselect.createSelector(selectState$7, state => state.fetchingTrending);
|
||||
|
||||
exports.ACTIONS = action_types;
|
||||
exports.Lbry = lbryProxy;
|
||||
exports.PAGES = pages;
|
||||
|
@ -3920,13 +3873,13 @@ exports.doAddTag = doAddTag;
|
|||
exports.doBalanceSubscribe = doBalanceSubscribe;
|
||||
exports.doBlurSearchInput = doBlurSearchInput;
|
||||
exports.doCheckAddressIsMine = doCheckAddressIsMine;
|
||||
exports.doClaimSearch = doClaimSearch;
|
||||
exports.doCreateChannel = doCreateChannel;
|
||||
exports.doDeletePurchasedUri = doDeletePurchasedUri;
|
||||
exports.doDeleteTag = doDeleteTag;
|
||||
exports.doDismissError = doDismissError;
|
||||
exports.doDismissToast = doDismissToast;
|
||||
exports.doError = doError;
|
||||
exports.doFetchByTags = doFetchByTags;
|
||||
exports.doFetchChannelListMine = doFetchChannelListMine;
|
||||
exports.doFetchClaimListMine = doFetchClaimListMine;
|
||||
exports.doFetchClaimsByChannel = doFetchClaimsByChannel;
|
||||
|
@ -4025,8 +3978,8 @@ exports.selectDraftTransactionAmount = selectDraftTransactionAmount;
|
|||
exports.selectDraftTransactionError = selectDraftTransactionError;
|
||||
exports.selectError = selectError;
|
||||
exports.selectFailedPurchaseUris = selectFailedPurchaseUris;
|
||||
exports.selectFetchingClaimSearch = selectFetchingClaimSearch;
|
||||
exports.selectFetchingMyChannels = selectFetchingMyChannels;
|
||||
exports.selectFetchingTrending = selectFetchingTrending;
|
||||
exports.selectFileInfosByOutpoint = selectFileInfosByOutpoint;
|
||||
exports.selectFileInfosDownloaded = selectFileInfosDownloaded;
|
||||
exports.selectFileListDownloadedSort = selectFileListDownloadedSort;
|
||||
|
@ -4040,6 +3993,7 @@ exports.selectIsFetchingFileListDownloadedOrPublished = selectIsFetchingFileList
|
|||
exports.selectIsFetchingTransactions = selectIsFetchingTransactions;
|
||||
exports.selectIsSearching = selectIsSearching;
|
||||
exports.selectIsSendingSupport = selectIsSendingSupport;
|
||||
exports.selectLastClaimSearchUris = selectLastClaimSearchUris;
|
||||
exports.selectLastPurchasedUri = selectLastPurchasedUri;
|
||||
exports.selectMyActiveClaims = selectMyActiveClaims;
|
||||
exports.selectMyChannelClaims = selectMyChannelClaims;
|
||||
|
@ -4070,7 +4024,6 @@ exports.selectTotalDownloadProgress = selectTotalDownloadProgress;
|
|||
exports.selectTransactionItems = selectTransactionItems;
|
||||
exports.selectTransactionListFilter = selectTransactionListFilter;
|
||||
exports.selectTransactionsById = selectTransactionsById;
|
||||
exports.selectTrendingUris = selectTrendingUris;
|
||||
exports.selectUnfollowedTags = selectUnfollowedTags;
|
||||
exports.selectUrisLoading = selectUrisLoading;
|
||||
exports.selectWalletDecryptPending = selectWalletDecryptPending;
|
||||
|
|
2
dist/flow-typed/Claim.js
vendored
2
dist/flow-typed/Claim.js
vendored
|
@ -10,7 +10,6 @@ declare type ChannelClaim = GenericClaim & {
|
|||
|
||||
declare type StreamClaim = GenericClaim & {
|
||||
is_channel_signature_valid?: boolean,
|
||||
signing_channel?: ChannelClaim,
|
||||
value: StreamMetadata,
|
||||
};
|
||||
|
||||
|
@ -33,6 +32,7 @@ declare type GenericClaim = {
|
|||
txid: string, // unique tx id
|
||||
type: 'claim' | 'update' | 'support',
|
||||
value_type: 'stream' | 'channel',
|
||||
signing_channel?: ChannelClaim,
|
||||
meta: {
|
||||
activation_height: number,
|
||||
claims_in_channel?: number,
|
||||
|
|
9
dist/flow-typed/Tags.js
vendored
9
dist/flow-typed/Tags.js
vendored
|
@ -1,8 +1,6 @@
|
|||
declare type TagState = {
|
||||
followedTags: FollowedTags,
|
||||
knownTags: KnownTags,
|
||||
trending: Array<string>,
|
||||
fetchingTrending: boolean,
|
||||
};
|
||||
|
||||
declare type Tag = {
|
||||
|
@ -21,10 +19,3 @@ declare type TagAction = {
|
|||
name: string,
|
||||
},
|
||||
};
|
||||
|
||||
declare type TrendingTagAction = {
|
||||
type: string,
|
||||
data: {
|
||||
uris: Array<string>,
|
||||
},
|
||||
};
|
||||
|
|
2
flow-typed/Claim.js
vendored
2
flow-typed/Claim.js
vendored
|
@ -9,7 +9,6 @@ declare type ChannelClaim = GenericClaim & {
|
|||
|
||||
declare type StreamClaim = GenericClaim & {
|
||||
is_channel_signature_valid?: boolean,
|
||||
signing_channel?: ChannelClaim,
|
||||
value: StreamMetadata,
|
||||
};
|
||||
|
||||
|
@ -32,6 +31,7 @@ declare type GenericClaim = {
|
|||
txid: string, // unique tx id
|
||||
type: 'claim' | 'update' | 'support',
|
||||
value_type: 'stream' | 'channel',
|
||||
signing_channel?: ChannelClaim,
|
||||
meta: {
|
||||
activation_height: number,
|
||||
claims_in_channel?: number,
|
||||
|
|
9
flow-typed/Tags.js
vendored
9
flow-typed/Tags.js
vendored
|
@ -1,8 +1,6 @@
|
|||
declare type TagState = {
|
||||
followedTags: FollowedTags,
|
||||
knownTags: KnownTags,
|
||||
trending: Array<string>,
|
||||
fetchingTrending: boolean,
|
||||
};
|
||||
|
||||
declare type Tag = {
|
||||
|
@ -21,10 +19,3 @@ declare type TagAction = {
|
|||
name: string,
|
||||
},
|
||||
};
|
||||
|
||||
declare type TrendingTagAction = {
|
||||
type: string,
|
||||
data: {
|
||||
uris: Array<string>,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -221,6 +221,3 @@ export const FETCH_COST_INFO_FAILED = 'FETCH_COST_INFO_FAILED';
|
|||
export const TOGGLE_TAG_FOLLOW = 'TOGGLE_TAG_FOLLOW';
|
||||
export const TAG_ADD = 'TAG_ADD';
|
||||
export const TAG_DELETE = 'TAG_DELETE';
|
||||
export const FETCH_TRENDING_STARTED = 'FETCH_TRENDING_STARTED';
|
||||
export const FETCH_TRENDING_COMPLETED = 'FETCH_TRENDING_COMPLETED';
|
||||
export const FETCH_TRENDING_FAILED = 'FETCH_TRENDING_FAILED';
|
||||
|
|
12
src/index.js
12
src/index.js
|
@ -45,6 +45,7 @@ export {
|
|||
doResolveUri,
|
||||
doFetchChannelListMine,
|
||||
doCreateChannel,
|
||||
doClaimSearch,
|
||||
} from 'redux/actions/claims';
|
||||
|
||||
export { doDeletePurchasedUri, doPurchaseUri, doFileGet } from 'redux/actions/file';
|
||||
|
@ -87,7 +88,7 @@ export {
|
|||
doUpdateBlockHeight,
|
||||
} from 'redux/actions/wallet';
|
||||
|
||||
export { doToggleTagFollow, doAddTag, doDeleteTag, doFetchByTags } from 'redux/actions/tags';
|
||||
export { doToggleTagFollow, doAddTag, doDeleteTag } from 'redux/actions/tags';
|
||||
|
||||
// utils
|
||||
export { batchActions } from 'util/batchActions';
|
||||
|
@ -164,6 +165,8 @@ export {
|
|||
selectPlayingUri,
|
||||
selectChannelClaimCounts,
|
||||
selectCurrentChannelPage,
|
||||
selectFetchingClaimSearch,
|
||||
selectLastClaimSearchUris,
|
||||
} from 'redux/selectors/claims';
|
||||
|
||||
export {
|
||||
|
@ -227,9 +230,4 @@ export {
|
|||
selectTransactionListFilter,
|
||||
} from 'redux/selectors/wallet';
|
||||
|
||||
export {
|
||||
selectFollowedTags,
|
||||
selectUnfollowedTags,
|
||||
selectTrendingUris,
|
||||
selectFetchingTrending,
|
||||
} from 'redux/selectors/tags';
|
||||
export { selectFollowedTags, selectUnfollowedTags } from 'redux/selectors/tags';
|
||||
|
|
|
@ -265,11 +265,7 @@ export function doFetchChannelListMine() {
|
|||
};
|
||||
}
|
||||
|
||||
export function doClaimSearch(
|
||||
amount: number = 20,
|
||||
options: {} = {},
|
||||
cb: (?Error, ?Array<string>) => void
|
||||
) {
|
||||
export function doClaimSearch(amount: number = 20, options: {} = {}) {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.CLAIM_SEARCH_STARTED,
|
||||
|
@ -285,12 +281,8 @@ export function doClaimSearch(
|
|||
|
||||
dispatch({
|
||||
type: ACTIONS.CLAIM_SEARCH_COMPLETED,
|
||||
data: { resolveInfo },
|
||||
data: { resolveInfo, uris },
|
||||
});
|
||||
|
||||
if (cb) {
|
||||
cb(null, uris);
|
||||
}
|
||||
};
|
||||
|
||||
const failure = err => {
|
||||
|
@ -298,9 +290,6 @@ export function doClaimSearch(
|
|||
type: ACTIONS.CLAIM_SEARCH_FAILED,
|
||||
error: err,
|
||||
});
|
||||
if (cb) {
|
||||
cb(err);
|
||||
}
|
||||
};
|
||||
|
||||
Lbry.claim_search({
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import Lbry from 'lbry';
|
||||
import { doClaimSearch } from 'redux/actions/claims';
|
||||
|
||||
export const doToggleTagFollow = (name: string) => ({
|
||||
type: ACTIONS.TOGGLE_TAG_FOLLOW,
|
||||
|
@ -23,29 +22,3 @@ export const doDeleteTag = (name: string) => ({
|
|||
name,
|
||||
},
|
||||
});
|
||||
|
||||
export const doFetchByTags = (amount: number = 10, options: Object = {}) => {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRENDING_STARTED,
|
||||
});
|
||||
|
||||
const callback = (error: ?Error, uris: ?Array<string> = []) => {
|
||||
if (error) {
|
||||
return dispatch({
|
||||
type: ACTIONS.FETCH_TRENDING_FAILED,
|
||||
error,
|
||||
});
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRENDING_COMPLETED,
|
||||
data: {
|
||||
uris,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
dispatch(doClaimSearch(amount, options, callback));
|
||||
};
|
||||
};
|
||||
|
|
|
@ -43,6 +43,8 @@ const defaultState = {
|
|||
fetchingMyChannels: false,
|
||||
abandoningById: {},
|
||||
pendingById: {},
|
||||
fetchingClaimSearch: false,
|
||||
lastClaimSearchUris: [],
|
||||
};
|
||||
|
||||
function handleClaimAction(state: State, action: any): State {
|
||||
|
@ -91,7 +93,9 @@ function handleClaimAction(state: State, action: any): State {
|
|||
}
|
||||
|
||||
reducers[ACTIONS.RESOLVE_URIS_COMPLETED] = (state: State, action: any): State => {
|
||||
return handleClaimAction(state, action);
|
||||
return {
|
||||
...handleClaimAction(state, action),
|
||||
};
|
||||
};
|
||||
|
||||
reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_STARTED] = (state: State): State =>
|
||||
|
@ -275,7 +279,11 @@ reducers[ACTIONS.CLAIM_SEARCH_STARTED] = (state: State): State => {
|
|||
});
|
||||
};
|
||||
reducers[ACTIONS.CLAIM_SEARCH_COMPLETED] = (state: State, action: any): State => {
|
||||
return { ...handleClaimAction(state, action), fetchingClaimSearch: false };
|
||||
return {
|
||||
...handleClaimAction(state, action),
|
||||
fetchingClaimSearch: false,
|
||||
lastClaimSearchUris: action.data.uris,
|
||||
};
|
||||
};
|
||||
reducers[ACTIONS.CLAIM_SEARCH_FAILED] = (state: State): State => {
|
||||
return Object.assign({}, state, {
|
||||
|
|
|
@ -16,8 +16,6 @@ function getDefaultRecommendedTags() {
|
|||
const defaultState: TagState = {
|
||||
followedTags: defaultFollowedTags,
|
||||
knownTags: getDefaultRecommendedTags(),
|
||||
trending: [],
|
||||
fetchingTrending: false,
|
||||
};
|
||||
|
||||
export const tagsReducer = handleActions(
|
||||
|
@ -67,20 +65,6 @@ export const tagsReducer = handleActions(
|
|||
followedTags: newFollowedTags,
|
||||
};
|
||||
},
|
||||
[ACTIONS.FETCH_TRENDING_STARTED]: (state: TagState) => ({
|
||||
...state,
|
||||
fetchingTrending: true,
|
||||
}),
|
||||
[ACTIONS.FETCH_TRENDING_COMPLETED]: (state: TagState, action: TrendingTagAction) => ({
|
||||
...state,
|
||||
trending: action.data.uris,
|
||||
fetchingTrending: false,
|
||||
}),
|
||||
[ACTIONS.FETCH_TRENDING_FAILED]: (state: TagState) => ({
|
||||
...state,
|
||||
trending: [],
|
||||
fetchingTrending: false,
|
||||
}),
|
||||
},
|
||||
defaultState
|
||||
);
|
||||
|
|
|
@ -441,3 +441,13 @@ export const makeSelectTagsForUri = (uri: string) =>
|
|||
return (metadata && metadata.tags) || [];
|
||||
}
|
||||
);
|
||||
|
||||
export const selectFetchingClaimSearch = createSelector(
|
||||
selectState,
|
||||
state => state.fetchingClaimSearch
|
||||
);
|
||||
|
||||
export const selectLastClaimSearchUris = createSelector(
|
||||
selectState,
|
||||
state => state.lastClaimSearchUris
|
||||
);
|
||||
|
|
|
@ -36,13 +36,3 @@ export const selectUnfollowedTags = createSelector(
|
|||
return tagsToReturn;
|
||||
}
|
||||
);
|
||||
|
||||
export const selectTrendingUris = createSelector(
|
||||
selectState,
|
||||
state => state.trending || []
|
||||
);
|
||||
|
||||
export const selectFetchingTrending = createSelector(
|
||||
selectState,
|
||||
state => state.fetchingTrending
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue