New: Collection Column/Filter Movie Index

pull/4072/head
Qstick 5 years ago
parent 1c91c9939f
commit f2fffe5304

@ -142,6 +142,7 @@
.qualityProfileName, .qualityProfileName,
.statusName, .statusName,
.studio, .studio,
.collection,
.links, .links,
.tags { .tags {
font-weight: 300; font-weight: 300;

@ -165,6 +165,7 @@ class MovieDetails extends Component {
qualityProfileId, qualityProfileId,
monitored, monitored,
studio, studio,
collection,
overview, overview,
youTubeTrailerId, youTubeTrailerId,
inCinemas, inCinemas,
@ -324,29 +325,31 @@ class MovieDetails extends Component {
</div> </div>
</div> </div>
<div className={styles.detailsLabels}> <div className={styles.details}>
<div>
{
!!runtime &&
<span className={styles.runtime}>
{runtime} Minutes
</span>
}
<InfoLabel <HeartRating
className={styles.detailsInfoLabel} rating={ratings.value}
title="Runtime" iconSize={20}
size={sizes.LARGE} />
> </div>
<span className={styles.runtime}> </div>
{runtime} Minutes
</span>
</InfoLabel>
<div className={styles.detailsLabels}>
<InfoLabel <InfoLabel
className={styles.detailsInfoLabel} className={styles.detailsInfoLabel}
title="Rating" title="Path"
size={sizes.LARGE} size={sizes.LARGE}
> >
<div> <span className={styles.path}>
<HeartRating {path}
rating={ratings.value} </span>
iconSize={16}
/>
</div>
</InfoLabel> </InfoLabel>
<InfoLabel <InfoLabel
@ -390,6 +393,19 @@ class MovieDetails extends Component {
</span> </span>
</InfoLabel> </InfoLabel>
{
!!collection &&
<InfoLabel
className={styles.detailsInfoLabel}
title="Collection"
size={sizes.LARGE}
>
<span className={styles.collection}>
{collection.name}
</span>
</InfoLabel>
}
{ {
!!studio && !!studio &&
<InfoLabel <InfoLabel
@ -569,6 +585,7 @@ MovieDetails.propTypes = {
monitored: PropTypes.bool.isRequired, monitored: PropTypes.bool.isRequired,
status: PropTypes.string.isRequired, status: PropTypes.string.isRequired,
studio: PropTypes.string, studio: PropTypes.string,
collection: PropTypes.object,
youTubeTrailerId: PropTypes.string, youTubeTrailerId: PropTypes.string,
inCinemas: PropTypes.string.isRequired, inCinemas: PropTypes.string.isRequired,
overview: PropTypes.string.isRequired, overview: PropTypes.string.isRequired,

@ -4,6 +4,7 @@
flex: 0 0 60px; flex: 0 0 60px;
} }
.collection,
.sortTitle { .sortTitle {
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';

@ -11,6 +11,7 @@
flex: 0 0 60px; flex: 0 0 60px;
} }
.collection,
.sortTitle { .sortTitle {
composes: cell; composes: cell;

@ -65,6 +65,7 @@ class MovieIndexRow extends Component {
status, status,
title, title,
titleSlug, titleSlug,
collection,
studio, studio,
qualityProfile, qualityProfile,
added, added,
@ -145,6 +146,17 @@ class MovieIndexRow extends Component {
); );
} }
if (name === 'collection') {
return (
<VirtualTableRowCell
key={name}
className={styles[name]}
>
{collection ? collection.name : null }
</VirtualTableRowCell>
);
}
if (name === 'studio') { if (name === 'studio') {
return ( return (
<VirtualTableRowCell <VirtualTableRowCell
@ -359,6 +371,7 @@ MovieIndexRow.propTypes = {
title: PropTypes.string.isRequired, title: PropTypes.string.isRequired,
titleSlug: PropTypes.string.isRequired, titleSlug: PropTypes.string.isRequired,
studio: PropTypes.string, studio: PropTypes.string,
collection: PropTypes.object,
qualityProfile: PropTypes.object.isRequired, qualityProfile: PropTypes.object.isRequired,
added: PropTypes.string, added: PropTypes.string,
inCinemas: PropTypes.string, inCinemas: PropTypes.string,

@ -110,6 +110,13 @@ export const filterPredicates = {
return dateFilterPredicate(item.added, filterValue, type); return dateFilterPredicate(item.added, filterValue, type);
}, },
collection: function(item, filterValue, type) {
const predicate = filterTypePredicates[type];
const { collection } = item;
return predicate(collection ? collection.name : '', filterValue);
},
inCinemas: function(item, filterValue, type) { inCinemas: function(item, filterValue, type) {
return dateFilterPredicate(item.inCinemas, filterValue, type); return dateFilterPredicate(item.inCinemas, filterValue, type);
}, },

@ -78,6 +78,12 @@ export const defaultState = {
isVisible: true, isVisible: true,
isModifiable: false isModifiable: false
}, },
{
name: 'collection',
label: 'Collection',
isSortable: true,
isVisible: false
},
{ {
name: 'studio', name: 'studio',
label: 'Studio', label: 'Studio',
@ -173,6 +179,12 @@ export const defaultState = {
return studio ? studio.toLowerCase() : ''; return studio ? studio.toLowerCase() : '';
}, },
collection: function(item) {
const { collection ={} } = item;
return collection.name;
},
ratings: function(item) { ratings: function(item) {
const { ratings = {} } = item; const { ratings = {} } = item;
@ -215,6 +227,25 @@ export const defaultState = {
return tagList.sort(sortByName); return tagList.sort(sortByName);
} }
}, },
{
name: 'collection',
label: 'Collection',
type: filterBuilderTypes.ARRAY,
optionsSelector: function(items) {
const collectionList = items.reduce((acc, movie) => {
if (movie.collection) {
acc.push({
id: movie.collection.name,
name: movie.collection.name
});
}
return acc;
}, []);
return collectionList.sort(sortByName);
}
},
{ {
name: 'qualityProfileId', name: 'qualityProfileId',
label: 'Quality Profile', label: 'Quality Profile',
@ -255,7 +286,7 @@ export const defaultState = {
label: 'Genres', label: 'Genres',
type: filterBuilderTypes.ARRAY, type: filterBuilderTypes.ARRAY,
optionsSelector: function(items) { optionsSelector: function(items) {
const tagList = items.reduce((acc, movie) => { const genreList = items.reduce((acc, movie) => {
movie.genres.forEach((genre) => { movie.genres.forEach((genre) => {
acc.push({ acc.push({
id: genre, id: genre,
@ -266,7 +297,7 @@ export const defaultState = {
return acc; return acc;
}, []); }, []);
return tagList.sort(sortByName); return genreList.sort(sortByName);
} }
}, },
{ {

Loading…
Cancel
Save