commit
9a676ee311
6 changed files with 56 additions and 25 deletions
35
dist/bundle.es.js
vendored
35
dist/bundle.es.js
vendored
|
@ -1363,9 +1363,9 @@ const selectMyClaims = reselect.createSelector(selectMyActiveClaims, selectClaim
|
|||
return [...claims, ...pendingClaims];
|
||||
});
|
||||
|
||||
const selectMyClaimsWithoutChannels = reselect.createSelector(selectMyClaims, myClaims => myClaims.filter(claim => !claim.name.match(/^@/)));
|
||||
const selectMyClaimsWithoutChannels = reselect.createSelector(selectMyClaims, myClaims => myClaims.filter(claim => !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp));
|
||||
|
||||
const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => myClaims.map(claim => `lbry://${claim.name}#${claim.claim_id}`));
|
||||
const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => myClaims.sort((a, b) => b.timestamp - a.timestamp).map(claim => `lbry://${claim.name}#${claim.claim_id}`));
|
||||
|
||||
const selectAllMyClaimsByOutpoint = reselect.createSelector(selectMyClaimsRaw, claims => new Set(claims && claims.length ? claims.map(claim => `${claim.txid}:${claim.nout}`) : null));
|
||||
|
||||
|
@ -2262,7 +2262,7 @@ function doClaimSearch(amount = 20, options = {}) {
|
|||
|
||||
dispatch({
|
||||
type: CLAIM_SEARCH_COMPLETED,
|
||||
data: { resolveInfo, uris }
|
||||
data: { resolveInfo, uris, append: options.page && options.page !== 1 }
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -2444,7 +2444,7 @@ const selectFileListDownloadedSort = reselect.createSelector(selectState$3, stat
|
|||
|
||||
const selectDownloadedUris = reselect.createSelector(selectFileInfosDownloaded,
|
||||
// We should use permament_url but it doesn't exist in file_list
|
||||
info => info.map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`));
|
||||
info => info.slice().reverse().map(claim => console.log(claim) || `lbry://${claim.claim_name}#${claim.claim_id}`));
|
||||
|
||||
//
|
||||
|
||||
|
@ -3112,12 +3112,14 @@ from, isBackgroundSearch = false) => (dispatch, getState) => {
|
|||
const actions = [];
|
||||
|
||||
data.forEach(result => {
|
||||
const uri = buildURI({
|
||||
claimName: result.name,
|
||||
claimId: result.claimId
|
||||
});
|
||||
actions.push(doResolveUri(uri));
|
||||
uris.push(uri);
|
||||
if (result.name) {
|
||||
const uri = buildURI({
|
||||
claimName: result.name,
|
||||
claimId: result.claimId
|
||||
});
|
||||
actions.push(doResolveUri(uri));
|
||||
uris.push(uri);
|
||||
}
|
||||
});
|
||||
|
||||
actions.push({
|
||||
|
@ -3128,7 +3130,7 @@ from, isBackgroundSearch = false) => (dispatch, getState) => {
|
|||
}
|
||||
});
|
||||
dispatch(batchActions(...actions));
|
||||
}).catch(() => {
|
||||
}).catch(e => {
|
||||
dispatch({
|
||||
type: SEARCH_FAIL
|
||||
});
|
||||
|
@ -3497,9 +3499,18 @@ reducers[CLAIM_SEARCH_STARTED] = state => {
|
|||
});
|
||||
};
|
||||
reducers[CLAIM_SEARCH_COMPLETED] = (state, action) => {
|
||||
const { lastClaimSearchUris } = state;
|
||||
|
||||
let newClaimSearchUris = [];
|
||||
if (action.data.append) {
|
||||
newClaimSearchUris = lastClaimSearchUris.concat(action.data.uris);
|
||||
} else {
|
||||
newClaimSearchUris = action.data.uris;
|
||||
}
|
||||
|
||||
return _extends$5({}, handleClaimAction(state, action), {
|
||||
fetchingClaimSearch: false,
|
||||
lastClaimSearchUris: action.data.uris
|
||||
lastClaimSearchUris: newClaimSearchUris
|
||||
});
|
||||
};
|
||||
reducers[CLAIM_SEARCH_FAILED] = state => {
|
||||
|
|
|
@ -265,7 +265,7 @@ export function doFetchChannelListMine() {
|
|||
};
|
||||
}
|
||||
|
||||
export function doClaimSearch(amount: number = 20, options: {} = {}) {
|
||||
export function doClaimSearch(amount: number = 20, options: { page?: number } = {}) {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.CLAIM_SEARCH_STARTED,
|
||||
|
@ -281,7 +281,7 @@ export function doClaimSearch(amount: number = 20, options: {} = {}) {
|
|||
|
||||
dispatch({
|
||||
type: ACTIONS.CLAIM_SEARCH_COMPLETED,
|
||||
data: { resolveInfo, uris },
|
||||
data: { resolveInfo, uris, append: options.page && options.page !== 1 },
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -117,12 +117,14 @@ export const doSearch = (
|
|||
const actions = [];
|
||||
|
||||
data.forEach(result => {
|
||||
const uri = buildURI({
|
||||
claimName: result.name,
|
||||
claimId: result.claimId,
|
||||
});
|
||||
actions.push(doResolveUri(uri));
|
||||
uris.push(uri);
|
||||
if (result.name) {
|
||||
const uri = buildURI({
|
||||
claimName: result.name,
|
||||
claimId: result.claimId,
|
||||
});
|
||||
actions.push(doResolveUri(uri));
|
||||
uris.push(uri);
|
||||
}
|
||||
});
|
||||
|
||||
actions.push({
|
||||
|
@ -134,7 +136,7 @@ export const doSearch = (
|
|||
});
|
||||
dispatch(batchActions(...actions));
|
||||
})
|
||||
.catch(() => {
|
||||
.catch(e => {
|
||||
dispatch({
|
||||
type: ACTIONS.SEARCH_FAIL,
|
||||
});
|
||||
|
|
|
@ -21,6 +21,7 @@ type State = {
|
|||
abandoningById: { [string]: boolean },
|
||||
fetchingChannelClaims: { [string]: number },
|
||||
fetchingMyChannels: boolean,
|
||||
lastClaimSearchUris: Array<string>,
|
||||
claimsByChannel: {
|
||||
[string]: {
|
||||
all: Array<string>,
|
||||
|
@ -279,10 +280,19 @@ reducers[ACTIONS.CLAIM_SEARCH_STARTED] = (state: State): State => {
|
|||
});
|
||||
};
|
||||
reducers[ACTIONS.CLAIM_SEARCH_COMPLETED] = (state: State, action: any): State => {
|
||||
const { lastClaimSearchUris } = state;
|
||||
|
||||
let newClaimSearchUris = [];
|
||||
if (action.data.append) {
|
||||
newClaimSearchUris = lastClaimSearchUris.concat(action.data.uris);
|
||||
} else {
|
||||
newClaimSearchUris = action.data.uris;
|
||||
}
|
||||
|
||||
return {
|
||||
...handleClaimAction(state, action),
|
||||
fetchingClaimSearch: false,
|
||||
lastClaimSearchUris: action.data.uris,
|
||||
lastClaimSearchUris: newClaimSearchUris,
|
||||
};
|
||||
};
|
||||
reducers[ACTIONS.CLAIM_SEARCH_FAILED] = (state: State): State => {
|
||||
|
|
|
@ -256,12 +256,16 @@ export const selectMyClaims = createSelector(
|
|||
|
||||
export const selectMyClaimsWithoutChannels = createSelector(
|
||||
selectMyClaims,
|
||||
myClaims => myClaims.filter(claim => !claim.name.match(/^@/))
|
||||
myClaims =>
|
||||
myClaims.filter(claim => !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp)
|
||||
);
|
||||
|
||||
export const selectMyClaimUrisWithoutChannels = createSelector(
|
||||
selectMyClaimsWithoutChannels,
|
||||
myClaims => myClaims.map(claim => `lbry://${claim.name}#${claim.claim_id}`)
|
||||
myClaims =>
|
||||
myClaims
|
||||
.sort((a, b) => b.timestamp - a.timestamp)
|
||||
.map(claim => `lbry://${claim.name}#${claim.claim_id}`)
|
||||
);
|
||||
|
||||
export const selectAllMyClaimsByOutpoint = createSelector(
|
||||
|
|
|
@ -232,5 +232,9 @@ export const selectFileListDownloadedSort = createSelector(
|
|||
export const selectDownloadedUris = createSelector(
|
||||
selectFileInfosDownloaded,
|
||||
// We should use permament_url but it doesn't exist in file_list
|
||||
info => info.map(claim => `lbry://${claim.claim_name}#${claim.claim_id}`)
|
||||
info =>
|
||||
info
|
||||
.slice()
|
||||
.reverse()
|
||||
.map(claim => console.log(claim) || `lbry://${claim.claim_name}#${claim.claim_id}`)
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue