From 96e4163c6156a7ecb34ab1eb9dbebf0921c8f6ae Mon Sep 17 00:00:00 2001 From: Jeremy Curcio <jeremy1026@gmail.com> Date: Thu, 15 Feb 2018 10:21:35 -0500 Subject: [PATCH 1/5] Fix sort by date --- src/renderer/component/fileList/view.jsx | 34 +++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index 8dcccadc3..cca8dec98 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -9,12 +9,35 @@ 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) => { + console.log(fileInfo1); + 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) => { + console.log(fileInfo1); + 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) => { @@ -65,6 +88,8 @@ class FileList extends React.PureComponent { const { sortBy } = this.state; const content = []; + console.log(sortBy); + this._sortFunctions[sortBy](fileInfos).forEach(fileInfo => { const uriParams = {}; @@ -95,7 +120,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">{__('Date (Newest First)')}</option> + <option value="dateOld">{__('Date (Oldest First)')}</option> <option value="title">{__('Title')}</option> </FormField> </span> From 3e6757a35d29788e0acf8bf67ff2984adcd32a94 Mon Sep 17 00:00:00 2001 From: Jeremy Curcio <jeremy1026@gmail.com> Date: Thu, 15 Feb 2018 10:23:03 -0500 Subject: [PATCH 2/5] Remove debug --- src/renderer/component/fileList/view.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index cca8dec98..a5e62f776 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -15,7 +15,6 @@ class FileList extends React.PureComponent { this._sortFunctions = { dateNew(fileInfos) { return fileInfos.slice().sort((fileInfo1, fileInfo2) => { - console.log(fileInfo1); const height1 = fileInfo1.height const height2 = fileInfo2.height if (height1 > height2) { From d1eed7f7de594f9196a49325139367b2ee1bcce4 Mon Sep 17 00:00:00 2001 From: Jeremy Curcio <jeremy1026@gmail.com> Date: Thu, 15 Feb 2018 10:25:22 -0500 Subject: [PATCH 3/5] Add to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e414ff7cb..ce228e9d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ 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)) * ### Deprecated From 34b6ef674b5219eed6e306031d21859797ad2beb Mon Sep 17 00:00:00 2001 From: Jeremy Curcio <jeremy1026@gmail.com> Date: Thu, 15 Feb 2018 10:49:31 -0500 Subject: [PATCH 4/5] Remove a couple more debugs --- src/renderer/component/fileList/view.jsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index a5e62f776..f2654b0f1 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -27,7 +27,6 @@ class FileList extends React.PureComponent { }, dateOld(fileInfos) { return fileInfos.slice().sort((fileInfo1, fileInfo2) => { - console.log(fileInfo1); const height1 = fileInfo1.height const height2 = fileInfo2.height if (height1 < height2) { @@ -87,8 +86,6 @@ class FileList extends React.PureComponent { const { sortBy } = this.state; const content = []; - console.log(sortBy); - this._sortFunctions[sortBy](fileInfos).forEach(fileInfo => { const uriParams = {}; From 4b2a4d2a10ffae0c032a5d6294cc2f71617af638 Mon Sep 17 00:00:00 2001 From: Jeremy Curcio <jeremy1026@gmail.com> Date: Thu, 15 Feb 2018 12:55:25 -0500 Subject: [PATCH 5/5] Change title of date sort options --- src/renderer/component/fileList/view.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/component/fileList/view.jsx b/src/renderer/component/fileList/view.jsx index f2654b0f1..afb446323 100644 --- a/src/renderer/component/fileList/view.jsx +++ b/src/renderer/component/fileList/view.jsx @@ -116,8 +116,8 @@ class FileList extends React.PureComponent { <span className="sort-section"> {__('Sort by')}{' '} <FormField type="select" onChange={this.handleSortChanged.bind(this)}> - <option value="dateNew">{__('Date (Newest First)')}</option> - <option value="dateOld">{__('Date (Oldest First)')}</option> + <option value="dateNew">{__('Newest First')}</option> + <option value="dateOld">{__('Oldest First')}</option> <option value="title">{__('Title')}</option> </FormField> </span>