From 6ec8e522dec573ba166fba358eedbe2de9d2da72 Mon Sep 17 00:00:00 2001 From: Qstick Date: Tue, 16 Oct 2018 21:46:35 -0400 Subject: [PATCH] Fixed: Previous airing in ArtistOverview not working --- .../Index/Overview/ArtistIndexOverview.js | 3 ++ .../Index/Overview/ArtistIndexOverviewInfo.js | 44 ++++++++++++++++--- .../Index/Overview/ArtistIndexOverviews.js | 3 ++ .../Overview/ArtistIndexOverviewsConnector.js | 1 + .../ArtistIndexOverviewOptionsModalContent.js | 18 ++++---- .../src/Store/Actions/artistIndexActions.js | 3 +- 6 files changed, 54 insertions(+), 18 deletions(-) diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverview.js b/frontend/src/Artist/Index/Overview/ArtistIndexOverview.js index 4baa47f76..0dd5fb1d2 100644 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverview.js +++ b/frontend/src/Artist/Index/Overview/ArtistIndexOverview.js @@ -86,6 +86,7 @@ class ArtistIndexOverview extends Component { overviewOptions, showRelativeDates, shortDateFormat, + longDateFormat, timeFormat, rowHeight, isSmallScreen, @@ -203,6 +204,7 @@ class ArtistIndexOverview extends Component { qualityProfile={qualityProfile} showRelativeDates={showRelativeDates} shortDateFormat={shortDateFormat} + longDateFormat={longDateFormat} timeFormat={timeFormat} {...overviewOptions} {...otherProps} @@ -246,6 +248,7 @@ ArtistIndexOverview.propTypes = { overviewOptions: PropTypes.object.isRequired, showRelativeDates: PropTypes.bool.isRequired, shortDateFormat: PropTypes.string.isRequired, + longDateFormat: PropTypes.string.isRequired, timeFormat: PropTypes.string.isRequired, isSmallScreen: PropTypes.bool.isRequired, isRefreshingArtist: PropTypes.bool.isRequired, diff --git a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.js b/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.js index 1922f7041..f7839cab5 100644 --- a/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.js +++ b/frontend/src/Artist/Index/Overview/ArtistIndexOverviewInfo.js @@ -1,6 +1,6 @@ -/* eslint max-params: 0 */ import PropTypes from 'prop-types'; import React from 'react'; +import formatDateTime from 'Utilities/Date/formatDateTime'; import getRelativeDate from 'Utilities/Date/getRelativeDate'; import formatBytes from 'Utilities/Number/formatBytes'; import { icons } from 'Helpers/Props'; @@ -22,6 +22,11 @@ const rows = [ showProp: 'showQualityProfile', valueProp: 'qualityProfileId' }, + { + name: 'lastAlbum', + showProp: 'showLastAlbum', + valueProp: 'lastAlbum' + }, { name: 'added', showProp: 'showAdded', @@ -73,22 +78,46 @@ function getInfoRowProps(row, props) { if (name === 'qualityProfileId') { return { - title: 'Quality PROFILE', + title: 'Quality Profile', iconName: icons.PROFILE, label: props.qualityProfile.name }; } + if (name === 'lastAlbum') { + const { + lastAlbum, + showRelativeDates, + shortDateFormat, + timeFormat + } = props; + + return { + title: `Last Album: ${lastAlbum.title}`, + iconName: icons.CALENDAR, + label: getRelativeDate( + lastAlbum.releaseDate, + shortDateFormat, + showRelativeDates, + { + timeFormat, + timeForToday: true + } + ) + }; + } + if (name === 'added') { const { added, - shortDateFormat, showRelativeDates, + shortDateFormat, + longDateFormat, timeFormat } = props; return { - title: 'Added', + title: `Added: ${formatDateTime(added, longDateFormat, timeFormat)}`, iconName: icons.ADD, label: getRelativeDate( added, @@ -142,6 +171,7 @@ function ArtistIndexOverviewInfo(props) { nextAiring, showRelativeDates, shortDateFormat, + longDateFormat, timeFormat } = props; @@ -154,7 +184,7 @@ function ArtistIndexOverviewInfo(props) { { !!nextAiring && - Show Previous Airing + Show Last Album @@ -254,7 +254,7 @@ ArtistIndexOverviewOptionsModalContent.propTypes = { size: PropTypes.string.isRequired, showMonitored: PropTypes.bool.isRequired, showQualityProfile: PropTypes.bool.isRequired, - showPreviousAiring: PropTypes.bool.isRequired, + showLastAlbum: PropTypes.bool.isRequired, showAdded: PropTypes.bool.isRequired, showAlbumCount: PropTypes.bool.isRequired, showPath: PropTypes.bool.isRequired, diff --git a/frontend/src/Store/Actions/artistIndexActions.js b/frontend/src/Store/Actions/artistIndexActions.js index 070e944a1..fd75b6413 100644 --- a/frontend/src/Store/Actions/artistIndexActions.js +++ b/frontend/src/Store/Actions/artistIndexActions.js @@ -43,9 +43,8 @@ export const defaultState = { detailedProgressBar: false, size: 'medium', showMonitored: true, - showNetwork: true, showQualityProfile: true, - showPreviousAiring: false, + showLastAlbum: false, showAdded: false, showAlbumCount: true, showPath: false,