1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-22 07:42:28 +00:00

New: Show Proper or Repack tag in interactive search

(cherry picked from commit efb000529b5dff42829df3ef151e4750a7b15cf6)

Closes #4386
This commit is contained in:
Stevie Robinson 2023-11-28 20:09:31 +01:00 committed by Bogdan
parent 7a71c3397b
commit 9880e2ec1b
3 changed files with 51 additions and 11 deletions

View file

@ -3,6 +3,7 @@ import React from 'react';
import Label from 'Components/Label';
import { kinds } from 'Helpers/Props';
import formatBytes from 'Utilities/Number/formatBytes';
import translate from 'Utilities/String/translate';
function getTooltip(title, quality, size) {
if (!title) {
@ -26,13 +27,44 @@ function getTooltip(title, quality, size) {
return title;
}
function revisionLabel(className, quality, showRevision) {
if (!showRevision) {
return;
}
if (quality.revision.isRepack) {
return (
<Label
className={className}
kind={kinds.PRIMARY}
title={translate('Repack')}
>
R
</Label>
);
}
if (quality.revision.version && quality.revision.version > 1) {
return (
<Label
className={className}
kind={kinds.PRIMARY}
title={translate('Proper')}
>
P
</Label>
);
}
}
function TrackQuality(props) {
const {
className,
title,
quality,
size,
isCutoffNotMet
isCutoffNotMet,
showRevision
} = props;
if (!quality) {
@ -40,13 +72,15 @@ function TrackQuality(props) {
}
return (
<Label
className={className}
kind={isCutoffNotMet ? kinds.INVERSE : kinds.DEFAULT}
title={getTooltip(title, quality, size)}
>
{quality.quality.name}
</Label>
<span>
<Label
className={className}
kind={isCutoffNotMet ? kinds.INVERSE : kinds.DEFAULT}
title={getTooltip(title, quality, size)}
>
{quality.quality.name}
</Label>{revisionLabel(className, quality, showRevision)}
</span>
);
}
@ -55,11 +89,13 @@ TrackQuality.propTypes = {
title: PropTypes.string,
quality: PropTypes.object.isRequired,
size: PropTypes.number,
isCutoffNotMet: PropTypes.bool
isCutoffNotMet: PropTypes.bool,
showRevision: PropTypes.bool
};
TrackQuality.defaultProps = {
title: ''
title: '',
showRevision: false
};
export default TrackQuality;

View file

@ -22,6 +22,10 @@
text-align: center;
}
.quality {
white-space: nowrap;
}
.customFormatScore {
composes: cell from '~Components/Table/Cells/TableRowCell.css';

View file

@ -178,7 +178,7 @@ class InteractiveSearchRow extends Component {
</TableRowCell>
<TableRowCell className={styles.quality}>
<TrackQuality quality={quality} />
<TrackQuality quality={quality} showRevision={true} />
</TableRowCell>
<TableRowCell className={styles.customFormatScore}>