From 4ae382cea7de2a2ca8c4267229a9f5c79bc0af78 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Wed, 14 Aug 2024 19:26:52 +0300 Subject: [PATCH] Fixed: Showing multi-languages for movies parsed without languages --- .../src/Activity/Blocklist/BlocklistRow.js | 4 +- frontend/src/Activity/History/HistoryRow.js | 4 +- frontend/src/Activity/Queue/QueueRow.js | 4 +- .../Interactive/InteractiveImportRow.tsx | 4 +- .../InteractiveSearchRow.tsx | 4 +- .../OverrideMatchModalContent.tsx | 4 +- frontend/src/Movie/History/MovieHistoryRow.js | 4 +- .../{MovieLanguage.js => MovieLanguages.tsx} | 43 +++++++------------ .../MovieFile/Editor/MovieFileEditorRow.js | 4 +- .../MovieFile/MovieFileLanguageConnector.js | 4 +- 10 files changed, 33 insertions(+), 46 deletions(-) rename frontend/src/Movie/{MovieLanguage.js => MovieLanguages.tsx} (58%) diff --git a/frontend/src/Activity/Blocklist/BlocklistRow.js b/frontend/src/Activity/Blocklist/BlocklistRow.js index 0690d8d36..279fb5fa5 100644 --- a/frontend/src/Activity/Blocklist/BlocklistRow.js +++ b/frontend/src/Activity/Blocklist/BlocklistRow.js @@ -7,7 +7,7 @@ import TableSelectCell from 'Components/Table/Cells/TableSelectCell'; import TableRow from 'Components/Table/TableRow'; import { icons, kinds } from 'Helpers/Props'; import MovieFormats from 'Movie/MovieFormats'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import MovieQuality from 'Movie/MovieQuality'; import MovieTitleLink from 'Movie/MovieTitleLink'; import translate from 'Utilities/String/translate'; @@ -104,7 +104,7 @@ class BlocklistRow extends Component { if (name === 'languages') { return ( - diff --git a/frontend/src/Activity/History/HistoryRow.js b/frontend/src/Activity/History/HistoryRow.js index 2f62d3268..9bc7b3717 100644 --- a/frontend/src/Activity/History/HistoryRow.js +++ b/frontend/src/Activity/History/HistoryRow.js @@ -7,7 +7,7 @@ import TableRow from 'Components/Table/TableRow'; import Tooltip from 'Components/Tooltip/Tooltip'; import { icons, tooltipPositions } from 'Helpers/Props'; import MovieFormats from 'Movie/MovieFormats'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import MovieQuality from 'Movie/MovieQuality'; import MovieTitleLink from 'Movie/MovieTitleLink'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore'; @@ -113,7 +113,7 @@ class HistoryRow extends Component { if (name === 'languages') { return ( - diff --git a/frontend/src/Activity/Queue/QueueRow.js b/frontend/src/Activity/Queue/QueueRow.js index 2c25efe1c..a1956727b 100644 --- a/frontend/src/Activity/Queue/QueueRow.js +++ b/frontend/src/Activity/Queue/QueueRow.js @@ -12,7 +12,7 @@ import Tooltip from 'Components/Tooltip/Tooltip'; import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal'; import MovieFormats from 'Movie/MovieFormats'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import MovieQuality from 'Movie/MovieQuality'; import MovieTitleLink from 'Movie/MovieTitleLink'; import formatBytes from 'Utilities/Number/formatBytes'; @@ -175,7 +175,7 @@ class QueueRow extends Component { if (name === 'languages') { return ( - diff --git a/frontend/src/InteractiveImport/Interactive/InteractiveImportRow.tsx b/frontend/src/InteractiveImport/Interactive/InteractiveImportRow.tsx index 898a74945..2e4789683 100644 --- a/frontend/src/InteractiveImport/Interactive/InteractiveImportRow.tsx +++ b/frontend/src/InteractiveImport/Interactive/InteractiveImportRow.tsx @@ -17,7 +17,7 @@ import Language from 'Language/Language'; import IndexerFlags from 'Movie/IndexerFlags'; import Movie from 'Movie/Movie'; import MovieFormats from 'Movie/MovieFormats'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import MovieQuality from 'Movie/MovieQuality'; import { QualityModel } from 'Quality/Quality'; import { @@ -322,7 +322,7 @@ function InteractiveImportRow(props: InteractiveImportRowProps) { {showLanguagePlaceholder && } {!showLanguagePlaceholder && !!languages && ( - + )} diff --git a/frontend/src/InteractiveSearch/InteractiveSearchRow.tsx b/frontend/src/InteractiveSearch/InteractiveSearchRow.tsx index 981f69dd5..497cb0bf3 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearchRow.tsx +++ b/frontend/src/InteractiveSearch/InteractiveSearchRow.tsx @@ -12,7 +12,7 @@ import type DownloadProtocol from 'DownloadClient/DownloadProtocol'; import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import Language from 'Language/Language'; import MovieFormats from 'Movie/MovieFormats'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import MovieQuality from 'Movie/MovieQuality'; import { QualityModel } from 'Quality/Quality'; import CustomFormat from 'typings/CustomFormat'; @@ -262,7 +262,7 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) { - + diff --git a/frontend/src/InteractiveSearch/OverrideMatch/OverrideMatchModalContent.tsx b/frontend/src/InteractiveSearch/OverrideMatch/OverrideMatchModalContent.tsx index bab577848..8f8321856 100644 --- a/frontend/src/InteractiveSearch/OverrideMatch/OverrideMatchModalContent.tsx +++ b/frontend/src/InteractiveSearch/OverrideMatch/OverrideMatchModalContent.tsx @@ -15,7 +15,7 @@ import SelectMovieModal from 'InteractiveImport/Movie/SelectMovieModal'; import SelectQualityModal from 'InteractiveImport/Quality/SelectQualityModal'; import Language from 'Language/Language'; import Movie from 'Movie/Movie'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import MovieQuality from 'Movie/MovieQuality'; import { QualityModel } from 'Quality/Quality'; import { grabRelease } from 'Store/Actions/releaseActions'; @@ -215,7 +215,7 @@ function OverrideMatchModalContent(props: OverrideMatchModalContentProps) { data={ diff --git a/frontend/src/Movie/History/MovieHistoryRow.js b/frontend/src/Movie/History/MovieHistoryRow.js index 97f18c81f..8b42a7e7d 100644 --- a/frontend/src/Movie/History/MovieHistoryRow.js +++ b/frontend/src/Movie/History/MovieHistoryRow.js @@ -8,7 +8,7 @@ import TableRowCell from 'Components/Table/Cells/TableRowCell'; import TableRow from 'Components/Table/TableRow'; import { icons, kinds } from 'Helpers/Props'; import MovieFormats from 'Movie/MovieFormats'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import MovieQuality from 'Movie/MovieQuality'; import formatDateTime from 'Utilities/Date/formatDateTime'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore'; @@ -89,7 +89,7 @@ class MovieHistoryRow extends Component { - diff --git a/frontend/src/Movie/MovieLanguage.js b/frontend/src/Movie/MovieLanguages.tsx similarity index 58% rename from frontend/src/Movie/MovieLanguage.js rename to frontend/src/Movie/MovieLanguages.tsx index 1d819d514..d259bd0ba 100644 --- a/frontend/src/Movie/MovieLanguage.js +++ b/frontend/src/Movie/MovieLanguages.tsx @@ -1,18 +1,21 @@ -import PropTypes from 'prop-types'; import React from 'react'; import Label from 'Components/Label'; import Popover from 'Components/Tooltip/Popover'; import { kinds, tooltipPositions } from 'Helpers/Props'; +import Language from 'Language/Language'; import translate from 'Utilities/String/translate'; -function MovieLanguage(props) { - const { - className, - languages, - isCutoffNotMet - } = props; +interface MovieLanguagesProps { + className?: string; + languages: Language[]; + isCutoffNotMet?: boolean; +} + +function MovieLanguages(props: MovieLanguagesProps) { + const { className, languages, isCutoffNotMet = true } = props; - if (!languages) { + // TODO: Typescript - Remove once everything is converted + if (!languages || languages.length === 0) { return null; } @@ -41,15 +44,9 @@ function MovieLanguage(props) { title={translate('Languages')} body={
    - { - languages.map((language) => { - return ( -
  • - {language.name} -
  • - ); - }) - } + {languages.map((language) => ( +
  • {language.name}
  • + ))}
} position={tooltipPositions.LEFT} @@ -57,14 +54,4 @@ function MovieLanguage(props) { ); } -MovieLanguage.propTypes = { - className: PropTypes.string, - languages: PropTypes.arrayOf(PropTypes.object), - isCutoffNotMet: PropTypes.bool -}; - -MovieLanguage.defaultProps = { - isCutoffNotMet: true -}; - -export default MovieLanguage; +export default MovieLanguages; diff --git a/frontend/src/MovieFile/Editor/MovieFileEditorRow.js b/frontend/src/MovieFile/Editor/MovieFileEditorRow.js index 5c0604efa..41890ce1b 100644 --- a/frontend/src/MovieFile/Editor/MovieFileEditorRow.js +++ b/frontend/src/MovieFile/Editor/MovieFileEditorRow.js @@ -11,7 +11,7 @@ import Tooltip from 'Components/Tooltip/Tooltip'; import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import IndexerFlags from 'Movie/IndexerFlags'; import MovieFormats from 'Movie/MovieFormats'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import MovieQuality from 'Movie/MovieQuality'; import FileEditModal from 'MovieFile/Edit/FileEditModal'; import MediaInfoConnector from 'MovieFile/MediaInfoConnector'; @@ -185,7 +185,7 @@ class MovieFileEditorRow extends Component { { !showLanguagePlaceholder && !!languages && - diff --git a/frontend/src/MovieFile/MovieFileLanguageConnector.js b/frontend/src/MovieFile/MovieFileLanguageConnector.js index af4b239e6..4bbd41236 100644 --- a/frontend/src/MovieFile/MovieFileLanguageConnector.js +++ b/frontend/src/MovieFile/MovieFileLanguageConnector.js @@ -1,6 +1,6 @@ import { connect } from 'react-redux'; import { createSelector } from 'reselect'; -import MovieLanguage from 'Movie/MovieLanguage'; +import MovieLanguages from 'Movie/MovieLanguages'; import createMovieFileSelector from 'Store/Selectors/createMovieFileSelector'; function createMapStateToProps() { @@ -14,4 +14,4 @@ function createMapStateToProps() { ); } -export default connect(createMapStateToProps)(MovieLanguage); +export default connect(createMapStateToProps)(MovieLanguages);