mirror of
https://github.com/Radarr/Radarr
synced 2026-05-09 05:23:07 +02:00
Fixed: Show year and fix sorting for collection movies
This commit is contained in:
parent
a2d505c795
commit
f5692d6cf1
6 changed files with 29 additions and 21 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
import AppSectionState from 'App/State/AppSectionState';
|
import AppSectionState from 'App/State/AppSectionState';
|
||||||
import MovieCollection from 'typings/MovieCollection';
|
import MovieCollection from 'typings/MovieCollection';
|
||||||
|
|
||||||
type MovieCollectionAppState = AppSectionState<MovieCollection>;
|
interface MovieCollectionAppState extends AppSectionState<MovieCollection> {
|
||||||
|
itemMap: Record<number, number>;
|
||||||
|
}
|
||||||
|
|
||||||
export default MovieCollectionAppState;
|
export default MovieCollectionAppState;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ function createMapStateToProps() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...collection,
|
...collection,
|
||||||
|
movies: [...collection.movies].sort((a, b) => b.year - a.year),
|
||||||
genres: Array.from(new Set(allGenres)).slice(0, 3)
|
genres: Array.from(new Set(allGenres)).slice(0, 3)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ class CollectionMovie extends Component {
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
|
status,
|
||||||
overview,
|
overview,
|
||||||
year,
|
year,
|
||||||
tmdbId,
|
tmdbId,
|
||||||
|
|
@ -123,11 +124,11 @@ class CollectionMovie extends Component {
|
||||||
|
|
||||||
<div className={styles.overlay}>
|
<div className={styles.overlay}>
|
||||||
<div className={styles.overlayTitle}>
|
<div className={styles.overlayTitle}>
|
||||||
{title}
|
{title} { year > 0 ? `(${year})` : ''}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
id &&
|
id ?
|
||||||
<div className={styles.overlayStatus}>
|
<div className={styles.overlayStatus}>
|
||||||
<MovieIndexProgressBar
|
<MovieIndexProgressBar
|
||||||
monitored={monitored}
|
monitored={monitored}
|
||||||
|
|
@ -138,7 +139,8 @@ class CollectionMovie extends Component {
|
||||||
detailedProgressBar={detailedProgressBar}
|
detailedProgressBar={detailedProgressBar}
|
||||||
isAvailable={isAvailable}
|
isAvailable={isAvailable}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div> :
|
||||||
|
null
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
@ -171,6 +173,7 @@ CollectionMovie.propTypes = {
|
||||||
id: PropTypes.number,
|
id: PropTypes.number,
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
year: PropTypes.number.isRequired,
|
year: PropTypes.number.isRequired,
|
||||||
|
status: PropTypes.string.isRequired,
|
||||||
overview: PropTypes.string.isRequired,
|
overview: PropTypes.string.isRequired,
|
||||||
monitored: PropTypes.bool,
|
monitored: PropTypes.bool,
|
||||||
collectionId: PropTypes.number.isRequired,
|
collectionId: PropTypes.number.isRequired,
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
17
frontend/src/Store/Selectors/createCollectionSelector.ts
Normal file
17
frontend/src/Store/Selectors/createCollectionSelector.ts
Normal 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;
|
||||||
|
|
@ -12,6 +12,7 @@ public class CollectionMovieResource
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string CleanTitle { get; set; }
|
public string CleanTitle { get; set; }
|
||||||
public string SortTitle { get; set; }
|
public string SortTitle { get; set; }
|
||||||
|
public MovieStatusType Status { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public int Runtime { get; set; }
|
public int Runtime { get; set; }
|
||||||
public List<MediaCover> Images { get; set; }
|
public List<MediaCover> Images { get; set; }
|
||||||
|
|
@ -37,6 +38,7 @@ public static CollectionMovieResource ToResource(this MovieMetadata model, Movie
|
||||||
{
|
{
|
||||||
TmdbId = model.TmdbId,
|
TmdbId = model.TmdbId,
|
||||||
Title = translatedTitle,
|
Title = translatedTitle,
|
||||||
|
Status = model.Status,
|
||||||
Overview = translatedOverview,
|
Overview = translatedOverview,
|
||||||
SortTitle = model.SortTitle,
|
SortTitle = model.SortTitle,
|
||||||
Images = model.Images,
|
Images = model.Images,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue