1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

Fixed: Show year and fix sorting for collection movies

This commit is contained in:
Bogdan 2023-10-08 01:41:15 +03:00
parent a2d505c795
commit f5692d6cf1
6 changed files with 29 additions and 21 deletions

View File

@ -1,6 +1,8 @@
import AppSectionState from 'App/State/AppSectionState';
import MovieCollection from 'typings/MovieCollection';
type MovieCollectionAppState = AppSectionState<MovieCollection>;
interface MovieCollectionAppState extends AppSectionState<MovieCollection> {
itemMap: Record<number, number>;
}
export default MovieCollectionAppState;

View File

@ -21,6 +21,7 @@ function createMapStateToProps() {
return {
...collection,
movies: [...collection.movies].sort((a, b) => b.year - a.year),
genres: Array.from(new Set(allGenres)).slice(0, 3)
};
}

View File

@ -61,6 +61,7 @@ class CollectionMovie extends Component {
const {
id,
title,
status,
overview,
year,
tmdbId,
@ -123,11 +124,11 @@ class CollectionMovie extends Component {
<div className={styles.overlay}>
<div className={styles.overlayTitle}>
{title}
{title} { year > 0 ? `(${year})` : ''}
</div>
{
id &&
id ?
<div className={styles.overlayStatus}>
<MovieIndexProgressBar
monitored={monitored}
@ -138,7 +139,8 @@ class CollectionMovie extends Component {
detailedProgressBar={detailedProgressBar}
isAvailable={isAvailable}
/>
</div>
</div> :
null
}
</div>
</Link>
@ -171,6 +173,7 @@ CollectionMovie.propTypes = {
id: PropTypes.number,
title: PropTypes.string.isRequired,
year: PropTypes.number.isRequired,
status: PropTypes.string.isRequired,
overview: PropTypes.string.isRequired,
monitored: PropTypes.bool,
collectionId: PropTypes.number.isRequired,

View File

@ -1,17 +0,0 @@
import { createSelector } from 'reselect';
function createCollectionSelector() {
return createSelector(
(state, { collectionId }) => collectionId,
(state) => state.movieCollections.itemMap,
(state) => state.movieCollections.items,
(collectionId, itemMap, allCollections) => {
if (allCollections && itemMap && collectionId in itemMap) {
return allCollections[itemMap[collectionId]];
}
return undefined;
}
);
}
export default createCollectionSelector;

View File

@ -0,0 +1,17 @@
import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';
function createCollectionSelector() {
return createSelector(
(_: AppState, { collectionId }: { collectionId: number }) => collectionId,
(state: AppState) => state.movieCollections.itemMap,
(state: AppState) => state.movieCollections.items,
(collectionId, itemMap, allCollections) => {
return allCollections && itemMap && collectionId in itemMap
? allCollections[itemMap[collectionId]]
: undefined;
}
);
}
export default createCollectionSelector;

View File

@ -12,6 +12,7 @@ public class CollectionMovieResource
public string Title { get; set; }
public string CleanTitle { get; set; }
public string SortTitle { get; set; }
public MovieStatusType Status { get; set; }
public string Overview { get; set; }
public int Runtime { get; set; }
public List<MediaCover> Images { get; set; }
@ -37,6 +38,7 @@ public static CollectionMovieResource ToResource(this MovieMetadata model, Movie
{
TmdbId = model.TmdbId,
Title = translatedTitle,
Status = model.Status,
Overview = translatedOverview,
SortTitle = model.SortTitle,
Images = model.Images,