Rename formatPreferredWordScore to formatCustomFormatScore

This commit is contained in:
Bogdan 2023-07-25 21:56:23 +03:00 committed by Mark McDowall
parent ae3dd5730e
commit 3937545e15
9 changed files with 24 additions and 22 deletions

View File

@ -7,7 +7,7 @@ import DescriptionListItemTitle from 'Components/DescriptionList/DescriptionList
import Link from 'Components/Link/Link'; import Link from 'Components/Link/Link';
import formatDateTime from 'Utilities/Date/formatDateTime'; import formatDateTime from 'Utilities/Date/formatDateTime';
import formatAge from 'Utilities/Number/formatAge'; import formatAge from 'Utilities/Number/formatAge';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import styles from './HistoryDetails.css'; import styles from './HistoryDetails.css';
function HistoryDetails(props) { function HistoryDetails(props) {
@ -68,7 +68,7 @@ function HistoryDetails(props) {
customFormatScore && customFormatScore !== '0' ? customFormatScore && customFormatScore !== '0' ?
<DescriptionListItem <DescriptionListItem
title="Custom Format Score" title="Custom Format Score"
data={formatPreferredWordScore(customFormatScore)} data={formatCustomFormatScore(customFormatScore)}
/> : /> :
null null
} }
@ -200,7 +200,7 @@ function HistoryDetails(props) {
customFormatScore && customFormatScore !== '0' ? customFormatScore && customFormatScore !== '0' ?
<DescriptionListItem <DescriptionListItem
title="Custom Format Score" title="Custom Format Score"
data={formatPreferredWordScore(customFormatScore)} data={formatCustomFormatScore(customFormatScore)}
/> : /> :
null null
} }
@ -246,7 +246,7 @@ function HistoryDetails(props) {
customFormatScore && customFormatScore !== '0' ? customFormatScore && customFormatScore !== '0' ?
<DescriptionListItem <DescriptionListItem
title="Custom Format Score" title="Custom Format Score"
data={formatPreferredWordScore(customFormatScore)} data={formatCustomFormatScore(customFormatScore)}
/> : /> :
null null
} }

View File

@ -13,7 +13,7 @@ import EpisodeTitleLink from 'Episode/EpisodeTitleLink';
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber'; import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
import { icons, tooltipPositions } from 'Helpers/Props'; import { icons, tooltipPositions } from 'Helpers/Props';
import SeriesTitleLink from 'Series/SeriesTitleLink'; import SeriesTitleLink from 'Series/SeriesTitleLink';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import HistoryDetailsModal from './Details/HistoryDetailsModal'; import HistoryDetailsModal from './Details/HistoryDetailsModal';
import HistoryEventTypeCell from './HistoryEventTypeCell'; import HistoryEventTypeCell from './HistoryEventTypeCell';
import styles from './HistoryRow.css'; import styles from './HistoryRow.css';
@ -212,7 +212,7 @@ class HistoryRow extends Component {
className={styles.customFormatScore} className={styles.customFormatScore}
> >
<Tooltip <Tooltip
anchor={formatPreferredWordScore( anchor={formatCustomFormatScore(
customFormatScore, customFormatScore,
customFormats.length customFormats.length
)} )}

View File

@ -18,7 +18,7 @@ import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal'; import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
import SeriesTitleLink from 'Series/SeriesTitleLink'; import SeriesTitleLink from 'Series/SeriesTitleLink';
import formatBytes from 'Utilities/Number/formatBytes'; import formatBytes from 'Utilities/Number/formatBytes';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import QueueStatusCell from './QueueStatusCell'; import QueueStatusCell from './QueueStatusCell';
import RemoveQueueItemModal from './RemoveQueueItemModal'; import RemoveQueueItemModal from './RemoveQueueItemModal';
import TimeleftCell from './TimeleftCell'; import TimeleftCell from './TimeleftCell';
@ -269,7 +269,7 @@ class QueueRow extends Component {
className={styles.customFormatScore} className={styles.customFormatScore}
> >
<Tooltip <Tooltip
anchor={formatPreferredWordScore( anchor={formatCustomFormatScore(
customFormatScore, customFormatScore,
customFormats.length customFormats.length
)} )}

View File

@ -14,7 +14,7 @@ import EpisodeFormats from 'Episode/EpisodeFormats';
import EpisodeLanguages from 'Episode/EpisodeLanguages'; import EpisodeLanguages from 'Episode/EpisodeLanguages';
import EpisodeQuality from 'Episode/EpisodeQuality'; import EpisodeQuality from 'Episode/EpisodeQuality';
import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import styles from './EpisodeHistoryRow.css'; import styles from './EpisodeHistoryRow.css';
function getTitle(eventType) { function getTitle(eventType) {
@ -126,7 +126,7 @@ class EpisodeHistoryRow extends Component {
<TableRowCell className={styles.customFormatScore}> <TableRowCell className={styles.customFormatScore}>
<Tooltip <Tooltip
anchor={ anchor={
formatPreferredWordScore(customFormatScore, customFormats.length) formatCustomFormatScore(customFormatScore, customFormats.length)
} }
tooltip={<EpisodeFormats formats={customFormats} />} tooltip={<EpisodeFormats formats={customFormats} />}
position={tooltipPositions.BOTTOM} position={tooltipPositions.BOTTOM}

View File

@ -30,7 +30,7 @@ import {
import { SelectStateInputProps } from 'typings/props'; import { SelectStateInputProps } from 'typings/props';
import Rejection from 'typings/Rejection'; import Rejection from 'typings/Rejection';
import formatBytes from 'Utilities/Number/formatBytes'; import formatBytes from 'Utilities/Number/formatBytes';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import translate from 'Utilities/String/translate'; import translate from 'Utilities/String/translate';
import InteractiveImportRowCellPlaceholder from './InteractiveImportRowCellPlaceholder'; import InteractiveImportRowCellPlaceholder from './InteractiveImportRowCellPlaceholder';
import styles from './InteractiveImportRow.css'; import styles from './InteractiveImportRow.css';
@ -431,7 +431,7 @@ function InteractiveImportRow(props: InteractiveImportRowProps) {
<TableRowCell> <TableRowCell>
{customFormats?.length ? ( {customFormats?.length ? (
<Popover <Popover
anchor={formatPreferredWordScore(customFormatScore)} anchor={formatCustomFormatScore(customFormatScore)}
title={translate('CustomFormats')} title={translate('CustomFormats')}
body={ body={
<div className={styles.customFormatTooltip}> <div className={styles.customFormatTooltip}>

View File

@ -19,7 +19,7 @@ import CustomFormat from 'typings/CustomFormat';
import formatDateTime from 'Utilities/Date/formatDateTime'; import formatDateTime from 'Utilities/Date/formatDateTime';
import formatAge from 'Utilities/Number/formatAge'; import formatAge from 'Utilities/Number/formatAge';
import formatBytes from 'Utilities/Number/formatBytes'; import formatBytes from 'Utilities/Number/formatBytes';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import OverrideMatchModal from './OverrideMatch/OverrideMatchModal'; import OverrideMatchModal from './OverrideMatch/OverrideMatchModal';
import Peers from './Peers'; import Peers from './Peers';
import ReleaseEpisode from './ReleaseEpisode'; import ReleaseEpisode from './ReleaseEpisode';
@ -236,7 +236,7 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) {
<TableRowCell className={styles.customFormatScore}> <TableRowCell className={styles.customFormatScore}>
<Tooltip <Tooltip
anchor={formatPreferredWordScore( anchor={formatCustomFormatScore(
customFormatScore, customFormatScore,
customFormats.length customFormats.length
)} )}

View File

@ -15,7 +15,7 @@ import MediaInfoConnector from 'EpisodeFile/MediaInfoConnector';
import * as mediaInfoTypes from 'EpisodeFile/mediaInfoTypes'; import * as mediaInfoTypes from 'EpisodeFile/mediaInfoTypes';
import { tooltipPositions } from 'Helpers/Props'; import { tooltipPositions } from 'Helpers/Props';
import formatBytes from 'Utilities/Number/formatBytes'; import formatBytes from 'Utilities/Number/formatBytes';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import formatRuntime from 'Utilities/Number/formatRuntime'; import formatRuntime from 'Utilities/Number/formatRuntime';
import styles from './EpisodeRow.css'; import styles from './EpisodeRow.css';
@ -204,7 +204,7 @@ class EpisodeRow extends Component {
className={styles.customFormatScore} className={styles.customFormatScore}
> >
<Tooltip <Tooltip
anchor={formatPreferredWordScore( anchor={formatCustomFormatScore(
customFormatScore, customFormatScore,
customFormats.length customFormats.length
)} )}

View File

@ -16,7 +16,7 @@ import EpisodeNumber from 'Episode/EpisodeNumber';
import EpisodeQuality from 'Episode/EpisodeQuality'; import EpisodeQuality from 'Episode/EpisodeQuality';
import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber'; import SeasonEpisodeNumber from 'Episode/SeasonEpisodeNumber';
import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import styles from './SeriesHistoryRow.css'; import styles from './SeriesHistoryRow.css';
function getTitle(eventType) { function getTitle(eventType) {
@ -146,7 +146,7 @@ class SeriesHistoryRow extends Component {
<TableRowCell className={styles.customFormatScore}> <TableRowCell className={styles.customFormatScore}>
<Tooltip <Tooltip
anchor={ anchor={
formatPreferredWordScore(customFormatScore, customFormats.length) formatCustomFormatScore(customFormatScore, customFormats.length)
} }
tooltip={<EpisodeFormats formats={customFormats} />} tooltip={<EpisodeFormats formats={customFormats} />}
position={tooltipPositions.BOTTOM} position={tooltipPositions.BOTTOM}

View File

@ -1,5 +1,7 @@
function formatCustomFormatScore(
function formatPreferredWordScore(input, customFormatsLength = 0) { input?: number,
customFormatsLength = 0
): string {
const score = Number(input); const score = Number(input);
if (score > 0) { if (score > 0) {
@ -7,10 +9,10 @@ function formatPreferredWordScore(input, customFormatsLength = 0) {
} }
if (score < 0) { if (score < 0) {
return score; return `${score}`;
} }
return customFormatsLength > 0 ? '+0' : ''; return customFormatsLength > 0 ? '+0' : '';
} }
export default formatPreferredWordScore; export default formatCustomFormatScore;