default sort to newest content
This commit is contained in:
parent
99e08fc733
commit
d127725045
5 changed files with 38 additions and 11 deletions
19
dist/bundle.es.js
vendored
19
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) => a.confirmations - b.confirmations).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 => `lbry://${claim.claim_name}#${claim.claim_id}`));
|
||||
|
||||
//
|
||||
|
||||
|
@ -3497,9 +3497,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 },
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -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) => a.confirmations - b.confirmations)
|
||||
.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 => `lbry://${claim.claim_name}#${claim.claim_id}`)
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue