New: Separate Ratings Columns

Fixes #7281
pull/7391/head
Qstick 3 years ago
parent 383f9647c3
commit 0a77a13fa8

@ -1,9 +1,9 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import HeartRating from 'Components/HeartRating';
import Icon from 'Components/Icon'; import Icon from 'Components/Icon';
import Label from 'Components/Label'; import Label from 'Components/Label';
import Link from 'Components/Link/Link'; import Link from 'Components/Link/Link';
import TmdbRating from 'Components/TmdbRating';
import Tooltip from 'Components/Tooltip/Tooltip'; import Tooltip from 'Components/Tooltip/Tooltip';
import { icons, kinds, sizes, tooltipPositions } from 'Helpers/Props'; import { icons, kinds, sizes, tooltipPositions } from 'Helpers/Props';
import MovieDetailsLinks from 'Movie/Details/MovieDetailsLinks'; import MovieDetailsLinks from 'Movie/Details/MovieDetailsLinks';
@ -190,7 +190,7 @@ class AddNewMovieSearchResult extends Component {
<div> <div>
<Label size={sizes.LARGE}> <Label size={sizes.LARGE}>
<HeartRating <TmdbRating
ratings={ratings} ratings={ratings}
iconSize={13} iconSize={13}
/> />

@ -1,5 +0,0 @@
.image {
align-content: center;
margin-right: 5px;
vertical-align: -0.125em;
}

File diff suppressed because one or more lines are too long

@ -22,11 +22,11 @@ class ImdbRating extends PureComponent {
let ratingString = '0.0'; let ratingString = '0.0';
if (rating) { if (rating) {
ratingString = `${rating.value}`; ratingString = `${rating.value.toFixed(1)}`;
} }
return ( return (
<span title={`${rating.votes} votes`}> <span title={`${rating ? rating.votes : 0} votes`}>
{ {
!hideIcon && !hideIcon &&
<img <img

@ -21,9 +21,11 @@ class RottenTomatoRating extends PureComponent {
const rating = ratings.rottenTomatoes; const rating = ratings.rottenTomatoes;
let ratingString = '0%'; let ratingString = '0%';
let ratingImage = rtFresh;
if (rating) { if (rating) {
ratingString = `${rating.value}%`; ratingString = `${rating.value}%`;
ratingImage = rating.value > 50 ? rtFresh : rtRotten;
} }
return ( return (
@ -32,7 +34,7 @@ class RottenTomatoRating extends PureComponent {
!hideIcon && !hideIcon &&
<img <img
className={styles.image} className={styles.image}
src={rating.value > 50 ? rtFresh : rtRotten} src={ratingImage}
style={{ style={{
height: `${iconSize}px` height: `${iconSize}px`
}} }}

@ -22,7 +22,7 @@ class TmdbRating extends PureComponent {
let ratingString = '0%'; let ratingString = '0%';
if (rating) { if (rating) {
ratingString = `${rating.value * 10}%`; ratingString = `${(rating.value * 10).toFixed()}%`;
} }
return ( return (

@ -1,6 +1,6 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import HeartRating from 'Components/HeartRating'; import TmdbRating from 'Components/TmdbRating';
import { getMovieStatusDetails } from 'Movie/MovieStatus'; import { getMovieStatusDetails } from 'Movie/MovieStatus';
import formatRuntime from 'Utilities/Date/formatRuntime'; import formatRuntime from 'Utilities/Date/formatRuntime';
import getRelativeDate from 'Utilities/Date/getRelativeDate'; import getRelativeDate from 'Utilities/Date/getRelativeDate';
@ -111,7 +111,7 @@ function DiscoverMoviePosterInfo(props) {
if (sortKey === 'ratings' && ratings) { if (sortKey === 'ratings' && ratings) {
return ( return (
<div className={styles.info}> <div className={styles.info}>
<HeartRating <TmdbRating
ratings={ratings} ratings={ratings}
/> />
</div> </div>

@ -1,6 +1,5 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import HeartRating from 'Components/HeartRating';
import Icon from 'Components/Icon'; import Icon from 'Components/Icon';
import ImportListListConnector from 'Components/ImportListListConnector'; import ImportListListConnector from 'Components/ImportListListConnector';
import IconButton from 'Components/Link/IconButton'; import IconButton from 'Components/Link/IconButton';
@ -8,6 +7,7 @@ import Link from 'Components/Link/Link';
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell'; import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell'; import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell';
import TmdbRating from 'Components/TmdbRating';
import Popover from 'Components/Tooltip/Popover'; import Popover from 'Components/Tooltip/Popover';
import AddNewDiscoverMovieModal from 'DiscoverMovie/AddNewDiscoverMovieModal'; import AddNewDiscoverMovieModal from 'DiscoverMovie/AddNewDiscoverMovieModal';
import ExcludeMovieModal from 'DiscoverMovie/Exclusion/ExcludeMovieModal'; import ExcludeMovieModal from 'DiscoverMovie/Exclusion/ExcludeMovieModal';
@ -245,7 +245,7 @@ class DiscoverMovieRow extends Component {
key={name} key={name}
className={styles[name]} className={styles[name]}
> >
<HeartRating <TmdbRating
ratings={ratings} ratings={ratings}
/> />
</VirtualTableRowCell> </VirtualTableRowCell>

@ -102,12 +102,21 @@ function MovieIndexSortMenu(props) {
</SortMenuItem> </SortMenuItem>
<SortMenuItem <SortMenuItem
name="ratings" name="imdbRating"
sortKey={sortKey} sortKey={sortKey}
sortDirection={sortDirection} sortDirection={sortDirection}
onPress={onSortSelect} onPress={onSortSelect}
> >
{translate('Ratings')} {translate('ImdbRating')}
</SortMenuItem>
<SortMenuItem
name="tmdbRating"
sortKey={sortKey}
sortDirection={sortDirection}
onPress={onSortSelect}
>
{translate('TmdbRating')}
</SortMenuItem> </SortMenuItem>
<SortMenuItem <SortMenuItem

@ -77,7 +77,9 @@
flex: 0 0 120px; flex: 0 0 120px;
} }
.ratings { .imdbRating,
.tmdbRating,
.rottenTomatoesRating {
composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css'; composes: headerCell from '~Components/Table/VirtualTableHeaderCell.css';
flex: 0 0 80px; flex: 0 0 80px;

@ -84,7 +84,9 @@
flex: 0 0 120px; flex: 0 0 120px;
} }
.ratings { .imdbRating,
.tmdbRating,
.rottenTomatoesRating {
composes: cell; composes: cell;
flex: 0 0 80px; flex: 0 0 80px;

@ -1,13 +1,15 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import HeartRating from 'Components/HeartRating';
import Icon from 'Components/Icon'; import Icon from 'Components/Icon';
import ImdbRating from 'Components/ImdbRating';
import IconButton from 'Components/Link/IconButton'; import IconButton from 'Components/Link/IconButton';
import SpinnerIconButton from 'Components/Link/SpinnerIconButton'; import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
import RottenTomatoRating from 'Components/RottenTomatoRating';
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector'; import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell'; import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell'; import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell';
import TagListConnector from 'Components/TagListConnector'; import TagListConnector from 'Components/TagListConnector';
import TmdbRating from 'Components/TmdbRating';
import Tooltip from 'Components/Tooltip/Tooltip'; import Tooltip from 'Components/Tooltip/Tooltip';
import { icons, kinds } from 'Helpers/Props'; import { icons, kinds } from 'Helpers/Props';
import DeleteMovieModal from 'Movie/Delete/DeleteMovieModal'; import DeleteMovieModal from 'Movie/Delete/DeleteMovieModal';
@ -349,13 +351,39 @@ class MovieIndexRow extends Component {
); );
} }
if (name === 'ratings') { if (name === 'tmdbRating') {
return ( return (
<VirtualTableRowCell <VirtualTableRowCell
key={name} key={name}
className={styles[name]} className={styles[name]}
> >
<HeartRating <TmdbRating
ratings={ratings}
/>
</VirtualTableRowCell>
);
}
if (name === 'rottenTomatoesRating') {
return (
<VirtualTableRowCell
key={name}
className={styles[name]}
>
<RottenTomatoRating
ratings={ratings}
/>
</VirtualTableRowCell>
);
}
if (name === 'imdbRating') {
return (
<VirtualTableRowCell
key={name}
className={styles[name]}
>
<ImdbRating
ratings={ratings} ratings={ratings}
/> />
</VirtualTableRowCell> </VirtualTableRowCell>

@ -162,6 +162,14 @@ export const filterPredicates = {
return predicate(rating, filterValue); return predicate(rating, filterValue);
}, },
rottenTomatoesRating: function(item, filterValue, type) {
const predicate = filterTypePredicates[type];
const rating = item.ratings.rottenTomatoes ? item.ratings.rottenTomatoes.value : 0;
return predicate(rating, filterValue);
},
imdbVotes: function(item, filterValue, type) { imdbVotes: function(item, filterValue, type) {
const predicate = filterTypePredicates[type]; const predicate = filterTypePredicates[type];

@ -178,8 +178,20 @@ export const defaultState = {
isVisible: true isVisible: true
}, },
{ {
name: 'ratings', name: 'tmdbRating',
label: translate('Ratings'), label: translate('TmdbRating'),
isSortable: true,
isVisible: false
},
{
name: 'rottenTomatoesRating',
label: translate('RottenTomatoesRating'),
isSortable: true,
isVisible: false
},
{
name: 'imdbRating',
label: translate('ImdbRating'),
isSortable: true, isSortable: true,
isVisible: false isVisible: false
}, },
@ -224,10 +236,22 @@ export const defaultState = {
return originalLanguage.name; return originalLanguage.name;
}, },
ratings: function(item) { imdbRating: function(item) {
const { ratings = {} } = item; const { ratings = {} } = item;
return ratings.tmdb? ratings.tmdb.value : 0; return ratings.imdb ? ratings.imdb.value : 0;
},
tmdbRating: function(item) {
const { ratings = {} } = item;
return ratings.tmdb ? ratings.tmdb.value : 0;
},
rottenTomatoesRating: function(item) {
const { ratings = {} } = item;
return ratings.rottenTomatoes ? ratings.rottenTomatoes.value : 0;
} }
}, },
@ -413,6 +437,11 @@ export const defaultState = {
label: translate('ImdbRating'), label: translate('ImdbRating'),
type: filterBuilderTypes.NUMBER type: filterBuilderTypes.NUMBER
}, },
{
name: 'rottenTomatoesRating',
label: translate('RottenTomatoesRating'),
type: filterBuilderTypes.NUMBER
},
{ {
name: 'imdbVotes', name: 'imdbVotes',
label: translate('ImdbVotes'), label: translate('ImdbVotes'),

@ -859,6 +859,7 @@
"RootFolderCheckMultipleMessage": "Multiple root folders are missing: {0}", "RootFolderCheckMultipleMessage": "Multiple root folders are missing: {0}",
"RootFolderCheckSingleMessage": "Missing root folder: {0}", "RootFolderCheckSingleMessage": "Missing root folder: {0}",
"RootFolders": "Root Folders", "RootFolders": "Root Folders",
"RottenTomatoesRating": "Tomato Rating",
"RSS": "RSS", "RSS": "RSS",
"RSSIsNotSupportedWithThisIndexer": "RSS is not supported with this indexer", "RSSIsNotSupportedWithThisIndexer": "RSS is not supported with this indexer",
"RSSSync": "RSS Sync", "RSSSync": "RSS Sync",

Loading…
Cancel
Save