Fixed: Multiple warnings for episode combined into one tooltip

Fixes #3890
This commit is contained in:
Mark McDowall 2020-08-02 11:33:15 -07:00
parent ac75a31641
commit 0cc06fcba8
1 changed files with 20 additions and 12 deletions

View File

@ -17,6 +17,20 @@ function getAlternateTitles(seasonNumber, sceneSeasonNumber, alternateTitles) {
});
}
function getWarningMessage(unverifiedSceneNumbering, seriesType, absoluteEpisodeNumber) {
const messages = [];
if (unverifiedSceneNumbering) {
messages.push('Scene number hasn\'t been verified yet');
}
if (seriesType === 'anime' && !absoluteEpisodeNumber) {
messages.push('Episode does not have an absolute episode number');
}
return messages.join('\n');
}
function EpisodeNumber(props) {
const {
seasonNumber,
@ -38,6 +52,8 @@ function EpisodeNumber(props) {
(seriesType === 'anime' && sceneAbsoluteEpisodeNumber !== undefined) ||
!!alternateTitles.length;
const warningMessage = getWarningMessage(unverifiedSceneNumbering, seriesType, absoluteEpisodeNumber);
return (
<span>
{
@ -94,24 +110,16 @@ function EpisodeNumber(props) {
}
{
unverifiedSceneNumbering &&
warningMessage ?
<Icon
className={styles.warning}
name={icons.WARNING}
kind={kinds.WARNING}
title="Scene number hasn't been verified yet"
/>
title={warningMessage}
/> :
null
}
{
seriesType === 'anime' && !absoluteEpisodeNumber &&
<Icon
className={styles.warning}
name={icons.WARNING}
kind={kinds.WARNING}
title="Episode does not have an absolute episode number"
/>
}
</span>
);
}