diff --git a/CHANGELOG.md b/CHANGELOG.md index ae7cb6c1d..bb6a26cfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) * diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 8dcccadc3..afb446323 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -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 { {__('Sort by')}{' '} - + +