Fixed: Avoid displaying multi-languages for episodes parsed without languages

This commit is contained in:
Bogdan 2024-08-12 20:24:24 +03:00
parent 2f04b037a1
commit 7a04882831
2 changed files with 16 additions and 28 deletions

View File

@ -15,6 +15,7 @@ import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
import useEpisode from 'Episode/useEpisode'; import useEpisode from 'Episode/useEpisode';
import usePrevious from 'Helpers/Hooks/usePrevious'; import usePrevious from 'Helpers/Hooks/usePrevious';
import { icons, tooltipPositions } from 'Helpers/Props'; import { icons, tooltipPositions } from 'Helpers/Props';
import Language from 'Language/Language';
import { QualityModel } from 'Quality/Quality'; import { QualityModel } from 'Quality/Quality';
import SeriesTitleLink from 'Series/SeriesTitleLink'; import SeriesTitleLink from 'Series/SeriesTitleLink';
import useSeries from 'Series/useSeries'; import useSeries from 'Series/useSeries';
@ -31,7 +32,7 @@ interface HistoryRowProps {
id: number; id: number;
episodeId: number; episodeId: number;
seriesId: number; seriesId: number;
languages: object[]; languages: Language[];
quality: QualityModel; quality: QualityModel;
customFormats?: CustomFormat[]; customFormats?: CustomFormat[];
customFormatScore: number; customFormatScore: number;

View File

@ -1,18 +1,21 @@
import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import Label from 'Components/Label'; import Label from 'Components/Label';
import Popover from 'Components/Tooltip/Popover'; import Popover from 'Components/Tooltip/Popover';
import { kinds, tooltipPositions } from 'Helpers/Props'; import { kinds, tooltipPositions } from 'Helpers/Props';
import Language from 'Language/Language';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
function EpisodeLanguages(props) { interface EpisodeLanguagesProps {
const { className?: string;
className, languages: Language[];
languages, isCutoffNotMet?: boolean;
isCutoffNotMet }
} = props;
if (!languages) { function EpisodeLanguages(props: EpisodeLanguagesProps) {
const { className, languages, isCutoffNotMet = true } = props;
// TODO: Typescript - Remove once everything is converted
if (!languages || languages.length === 0) {
return null; return null;
} }
@ -41,15 +44,9 @@ function EpisodeLanguages(props) {
title={translate('Languages')} title={translate('Languages')}
body={ body={
<ul> <ul>
{ {languages.map((language) => (
languages.map((language) => { <li key={language.id}>{language.name}</li>
return ( ))}
<li key={language.id}>
{language.name}
</li>
);
})
}
</ul> </ul>
} }
position={tooltipPositions.LEFT} position={tooltipPositions.LEFT}
@ -57,14 +54,4 @@ function EpisodeLanguages(props) {
); );
} }
EpisodeLanguages.propTypes = {
className: PropTypes.string,
languages: PropTypes.arrayOf(PropTypes.object),
isCutoffNotMet: PropTypes.bool
};
EpisodeLanguages.defaultProps = {
isCutoffNotMet: true
};
export default EpisodeLanguages; export default EpisodeLanguages;