Skip to content

Commit

Permalink
New: IMDb ratings and genres in add movie search results
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed Dec 12, 2023
1 parent fa62f3f commit 43d2f28
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
Expand Up @@ -85,8 +85,13 @@
margin-top: 20px;
}

.studio,
.genres {
margin-left: 5px;
}

.links {
margin-left: 8px;
margin-left: 5px;
pointer-events: all;
}

Expand Down
Expand Up @@ -5,6 +5,7 @@ interface CssExports {
'certification': string;
'content': string;
'exclusionIcon': string;
'genres': string;
'icons': string;
'links': string;
'overlay': string;
Expand All @@ -14,6 +15,7 @@ interface CssExports {
'runtime': string;
'searchResult': string;
'statusContainer': string;
'studio': string;
'title': string;
'titleContainer': string;
'titleRow': string;
Expand Down
46 changes: 43 additions & 3 deletions frontend/src/AddMovie/AddNewMovie/AddNewMovieSearchResult.js
@@ -1,6 +1,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Icon from 'Components/Icon';
import ImdbRating from 'Components/ImdbRating';
import Label from 'Components/Label';
import Link from 'Components/Link/Link';
import TmdbRating from 'Components/TmdbRating';
Expand Down Expand Up @@ -61,6 +62,7 @@ class AddNewMovieSearchResult extends Component {
titleSlug,
year,
studio,
genres,
status,
overview,
ratings,
Expand Down Expand Up @@ -197,13 +199,46 @@ class AddNewMovieSearchResult extends Component {
/>
</Label>

{
ratings.imdb ?
<Label size={sizes.LARGE}>
<ImdbRating
ratings={ratings}
iconSize={13}
/>
</Label> :
null
}

{
!!studio &&
<Label size={sizes.LARGE}>
{studio}
<Icon
name={icons.STUDIO}
size={13}
/>

<span className={styles.studio}>
{studio}
</span>
</Label>
}

{
genres.length > 0 ?
<Label size={sizes.LARGE}>
<Icon
name={icons.GENRE}
size={13}
/>

<span className={styles.genres}>
{genres.slice(0, 3).join(', ')}
</span>
</Label> :
null
}

<Tooltip
anchor={
<Label
Expand All @@ -215,15 +250,15 @@ class AddNewMovieSearchResult extends Component {
/>

<span className={styles.links}>
Links
{translate('Links')}
</span>
</Label>
}
tooltip={
<MovieDetailsLinks
tmdbId={tmdbId}
youTubeTrailerId={youTubeTrailerId}
imdbId={imdbId}
youTubeTrailerId={youTubeTrailerId}
/>
}
canFlip={true}
Expand Down Expand Up @@ -273,6 +308,7 @@ AddNewMovieSearchResult.propTypes = {
titleSlug: PropTypes.string.isRequired,
year: PropTypes.number.isRequired,
studio: PropTypes.string,
genres: PropTypes.arrayOf(PropTypes.string),
status: PropTypes.string.isRequired,
overview: PropTypes.string,
ratings: PropTypes.object.isRequired,
Expand All @@ -294,4 +330,8 @@ AddNewMovieSearchResult.propTypes = {
certification: PropTypes.string
};

AddNewMovieSearchResult.defaultProps = {
genres: []
};

export default AddNewMovieSearchResult;

0 comments on commit 43d2f28

Please sign in to comment.