From 76bcf94f1d9d12c7da9d03c7957c53e15f264ab7 Mon Sep 17 00:00:00 2001 From: ta264 Date: Thu, 23 Dec 2021 21:41:43 +0000 Subject: [PATCH] Fixed: Added missing sort token details for poster views Fixes #1424 --- .../Author/Index/Posters/AuthorIndexPoster.js | 3 + .../Index/Posters/AuthorIndexPosterInfo.js | 58 ++++++++++++++----- .../Book/Index/Posters/BookIndexPosterInfo.js | 36 ++++++------ 3 files changed, 65 insertions(+), 32 deletions(-) diff --git a/frontend/src/Author/Index/Posters/AuthorIndexPoster.js b/frontend/src/Author/Index/Posters/AuthorIndexPoster.js index 40a4c3294..78173b089 100644 --- a/frontend/src/Author/Index/Posters/AuthorIndexPoster.js +++ b/frontend/src/Author/Index/Posters/AuthorIndexPoster.js @@ -94,6 +94,7 @@ class AuthorIndexPoster extends Component { showMonitored, showQualityProfile, qualityProfile, + metadataProfile, showSearchAction, showRelativeDates, shortDateFormat, @@ -259,6 +260,7 @@ class AuthorIndexPoster extends Component { sizeOnDisk={sizeOnDisk} qualityProfile={qualityProfile} showQualityProfile={showQualityProfile} + metadataProfile={metadataProfile} showRelativeDates={showRelativeDates} shortDateFormat={shortDateFormat} timeFormat={timeFormat} @@ -300,6 +302,7 @@ AuthorIndexPoster.propTypes = { showMonitored: PropTypes.bool.isRequired, showQualityProfile: PropTypes.bool.isRequired, qualityProfile: PropTypes.object.isRequired, + metadataProfile: PropTypes.object.isRequired, showSearchAction: PropTypes.bool.isRequired, showRelativeDates: PropTypes.bool.isRequired, shortDateFormat: PropTypes.string.isRequired, diff --git a/frontend/src/Author/Index/Posters/AuthorIndexPosterInfo.js b/frontend/src/Author/Index/Posters/AuthorIndexPosterInfo.js index d1d378321..9171188fa 100644 --- a/frontend/src/Author/Index/Posters/AuthorIndexPosterInfo.js +++ b/frontend/src/Author/Index/Posters/AuthorIndexPosterInfo.js @@ -8,8 +8,10 @@ function AuthorIndexPosterInfo(props) { const { qualityProfile, showQualityProfile, - previousAiring, + metadataProfile, added, + nextBook, + lastBook, bookCount, path, sizeOnDisk, @@ -27,20 +29,10 @@ function AuthorIndexPosterInfo(props) { ); } - if (sortKey === 'previousAiring' && previousAiring) { + if (sortKey === 'metadataProfileId') { return (
- { - getRelativeDate( - previousAiring, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true - } - ) - } + {metadataProfile.name}
); } @@ -63,6 +55,42 @@ function AuthorIndexPosterInfo(props) { ); } + if (sortKey === 'nextBook' && nextBook) { + const date = getRelativeDate( + nextBook.releaseDate, + shortDateFormat, + showRelativeDates, + { + timeFormat, + timeForToday: false + } + ); + + return ( +
+ {`Next Book ${date}`} +
+ ); + } + + if (sortKey === 'lastBook' && lastBook) { + const date = getRelativeDate( + lastBook.releaseDate, + shortDateFormat, + showRelativeDates, + { + timeFormat, + timeForToday: false + } + ); + + return ( +
+ {`Last Book ${date}`} +
+ ); + } + if (sortKey === 'bookCount') { let books = '1 book'; @@ -101,8 +129,10 @@ function AuthorIndexPosterInfo(props) { AuthorIndexPosterInfo.propTypes = { qualityProfile: PropTypes.object.isRequired, showQualityProfile: PropTypes.bool.isRequired, - previousAiring: PropTypes.string, + metadataProfile: PropTypes.object.isRequired, added: PropTypes.string, + nextBook: PropTypes.object, + lastBook: PropTypes.object, bookCount: PropTypes.number.isRequired, path: PropTypes.string.isRequired, sizeOnDisk: PropTypes.number, diff --git a/frontend/src/Book/Index/Posters/BookIndexPosterInfo.js b/frontend/src/Book/Index/Posters/BookIndexPosterInfo.js index 59a5deecf..77e72f22b 100644 --- a/frontend/src/Book/Index/Posters/BookIndexPosterInfo.js +++ b/frontend/src/Book/Index/Posters/BookIndexPosterInfo.js @@ -8,8 +8,8 @@ function BookIndexPosterInfo(props) { const { qualityProfile, showQualityProfile, - previousAiring, added, + releaseDate, author, bookFileCount, sizeOnDisk, @@ -27,27 +27,27 @@ function BookIndexPosterInfo(props) { ); } - if (sortKey === 'previousAiring' && previousAiring) { + if (sortKey === 'added' && added) { + const addedDate = getRelativeDate( + added, + shortDateFormat, + showRelativeDates, + { + timeFormat, + timeForToday: false + } + ); + return (
- { - getRelativeDate( - previousAiring, - shortDateFormat, - showRelativeDates, - { - timeFormat, - timeForToday: true - } - ) - } + {`Added ${addedDate}`}
); } - if (sortKey === 'added' && added) { - const addedDate = getRelativeDate( - added, + if (sortKey === 'releaseDate' && added) { + const date = getRelativeDate( + releaseDate, shortDateFormat, showRelativeDates, { @@ -58,7 +58,7 @@ function BookIndexPosterInfo(props) { return (
- {`Added ${addedDate}`} + {`Released ${date}`}
); } @@ -101,9 +101,9 @@ function BookIndexPosterInfo(props) { BookIndexPosterInfo.propTypes = { qualityProfile: PropTypes.object.isRequired, showQualityProfile: PropTypes.bool.isRequired, - previousAiring: PropTypes.string, author: PropTypes.object.isRequired, added: PropTypes.string, + releaseDate: PropTypes.string, bookFileCount: PropTypes.number.isRequired, sizeOnDisk: PropTypes.number, sortKey: PropTypes.string.isRequired,