1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-25 22:46:31 -04:00

Convert store selectors to Typescript

This commit is contained in:
Bogdan
2023-07-30 16:23:41 +03:00
committed by Mark McDowall
parent 94c6b0fde3
commit a57b35a196
35 changed files with 250 additions and 173 deletions
@@ -4,6 +4,7 @@ import { useSelector } from 'react-redux';
import { icons } from 'Helpers/Props';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import dimensions from 'Styles/Variables/dimensions';
import QualityProfile from 'typings/QualityProfile';
import { UiSettings } from 'typings/UiSettings';
import formatDateTime from 'Utilities/Date/formatDateTime';
import getRelativeDate from 'Utilities/Date/getRelativeDate';
@@ -36,7 +37,7 @@ interface SeriesIndexOverviewInfoProps {
monitored: boolean;
nextAiring?: string;
network?: string;
qualityProfile: object;
qualityProfile?: QualityProfile;
previousAiring?: string;
added?: string;
seasonCount: number;
@@ -115,13 +116,10 @@ function getInfoRowProps(
};
}
if (name === 'qualityProfileId') {
if (name === 'qualityProfileId' && !!props.qualityProfile?.name) {
return {
title: 'Quality Profile',
iconName: icons.PROFILE,
// TODO: Type QualityProfile
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore ts(2339)
label: props.qualityProfile.name,
};
}
@@ -202,7 +202,7 @@ function SeriesIndexPoster(props: SeriesIndexPosterProps) {
</div>
) : null}
{showQualityProfile ? (
{showQualityProfile && !!qualityProfile?.name ? (
<div className={styles.title} title={translate('QualityProfile')}>
{qualityProfile.name}
</div>
@@ -11,7 +11,7 @@ interface SeriesIndexPosterInfoProps {
originalLanguage?: Language;
network?: string;
showQualityProfile: boolean;
qualityProfile: QualityProfile;
qualityProfile?: QualityProfile;
previousAiring?: string;
added?: string;
seasonCount: number;
@@ -58,7 +58,11 @@ function SeriesIndexPosterInfo(props: SeriesIndexPosterInfoProps) {
);
}
if (sortKey === 'qualityProfileId' && !showQualityProfile) {
if (
sortKey === 'qualityProfileId' &&
!showQualityProfile &&
!!qualityProfile?.name
) {
return (
<div className={styles.info} title={translate('QualityProfile')}>
{qualityProfile.name}
@@ -242,7 +242,7 @@ function SeriesIndexRow(props: SeriesIndexRowProps) {
if (name === 'qualityProfileId') {
return (
<VirtualTableRowCell key={name} className={styles[name]}>
{qualityProfile.name}
{qualityProfile?.name ?? ''}
</VirtualTableRowCell>
);
}