Fix #986 published claims out of order #1018

Merged
Jeremy1026 merged 7 commits from fix/986-published-claims-out-of-order into master 2018-02-27 05:55:31 +01:00
2 changed files with 28 additions and 4 deletions

View file

@ -16,6 +16,8 @@ Web UI version numbers should always match the corresponding version of LBRY App
*
### Fixed
* Fixed sort by date of published content ([#986](https://github.com/lbryio/lbry-app/issues/986))
* Fix night mode start time, set to 9PM (#1050)
* Fix night mode start time, set to 9PM ([#1050](https://github.com/lbryio/lbry-app/issues/1050))
*

View file

@ -9,12 +9,33 @@ class FileList extends React.PureComponent {
super(props);
this.state = {
sortBy: 'date',
sortBy: 'dateNew',
};
this._sortFunctions = {
date(fileInfos) {
return fileInfos.slice().reverse();
dateNew(fileInfos) {
return fileInfos.slice().sort((fileInfo1, fileInfo2) => {
const height1 = fileInfo1.height
const height2 = fileInfo2.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
if (height1 < height2) {
return -1;
} else if (height1 > height2) {
return 1;
}
return 0;
});
},
title(fileInfos) {
return fileInfos.slice().sort((fileInfo1, fileInfo2) => {
@ -95,7 +116,8 @@ class FileList extends React.PureComponent {
<span className="sort-section">
{__('Sort by')}{' '}
<FormField type="select" onChange={this.handleSortChanged.bind(this)}>
<option value="date">{__('Date')}</option>
<option value="dateNew">{__('Newest First')}</option>
<option value="dateOld">{__('Oldest First')}</option>
<option value="title">{__('Title')}</option>
</FormField>
</span>