Fix sorting on downloads/published pages
This commit is contained in:
parent
c199a24986
commit
bd785502f4
2 changed files with 22 additions and 23 deletions
|
@ -1,8 +1,11 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import FileList from './view';
|
||||
import { selectClaimsById } from 'redux/selectors/claims';
|
||||
|
||||
const select = state => ({});
|
||||
const select = state => ({
|
||||
claimsById: selectClaimsById(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({});
|
||||
|
||||
|
|
|
@ -13,32 +13,30 @@ class FileList extends React.PureComponent {
|
|||
};
|
||||
|
||||
this._sortFunctions = {
|
||||
dateNew(fileInfos) {
|
||||
return fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const height1 = fileInfo1.height;
|
||||
const height2 = fileInfo2.height;
|
||||
dateNew: (fileInfos) =>
|
||||
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id].height;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id].height;
|
||||
if (height1 > height2) {
|
||||
return -1;
|
||||
} else if (height1 < height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
dateOld(fileInfos) {
|
||||
return fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const height1 = fileInfo1.height;
|
||||
const height2 = fileInfo2.height;
|
||||
}),
|
||||
dateOld: (fileInfos) =>
|
||||
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const height1 = this.props.claimsById[fileInfo1.claim_id].height;
|
||||
const height2 = this.props.claimsById[fileInfo2.claim_id].height;
|
||||
if (height1 < height2) {
|
||||
return -1;
|
||||
} else if (height1 > height2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
title(fileInfos) {
|
||||
return fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
}),
|
||||
title: (fileInfos) =>
|
||||
fileInfos.slice().sort((fileInfo1, fileInfo2) => {
|
||||
const title1 = fileInfo1.value
|
||||
? fileInfo1.value.stream.metadata.title.toLowerCase()
|
||||
: fileInfo1.claim_name;
|
||||
|
@ -51,10 +49,9 @@ class FileList extends React.PureComponent {
|
|||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
filename(fileInfos) {
|
||||
return fileInfos.slice().sort(({ file_name: fileName1 }, { file_name: fileName2 }) => {
|
||||
}),
|
||||
filename: (fileInfos) =>
|
||||
fileInfos.slice().sort(({ file_name: fileName1 }, { file_name: fileName2 }) => {
|
||||
const fileName1Lower = fileName1.toLowerCase();
|
||||
const fileName2Lower = fileName2.toLowerCase();
|
||||
if (fileName1Lower < fileName2Lower) {
|
||||
|
@ -63,10 +60,9 @@ class FileList extends React.PureComponent {
|
|||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
getChannelSignature(fileInfo) {
|
||||
if (fileInfo.value) {
|
||||
|
|
Loading…
Reference in a new issue