From 9880e2ec1bb4d1c78343af828856a5953179d649 Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Tue, 28 Nov 2023 20:09:31 +0100 Subject: [PATCH] New: Show Proper or Repack tag in interactive search (cherry picked from commit efb000529b5dff42829df3ef151e4750a7b15cf6) Closes #4386 --- frontend/src/Album/TrackQuality.js | 56 +++++++++++++++---- .../InteractiveSearchRow.css | 4 ++ .../InteractiveSearch/InteractiveSearchRow.js | 2 +- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/frontend/src/Album/TrackQuality.js b/frontend/src/Album/TrackQuality.js index ca94227a0..6eac5d2f8 100644 --- a/frontend/src/Album/TrackQuality.js +++ b/frontend/src/Album/TrackQuality.js @@ -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 ( + + ); + } + + if (quality.revision.version && quality.revision.version > 1) { + return ( + + ); + } +} + function TrackQuality(props) { const { className, title, quality, size, - isCutoffNotMet + isCutoffNotMet, + showRevision } = props; if (!quality) { @@ -40,13 +72,15 @@ function TrackQuality(props) { } return ( - + + {revisionLabel(className, quality, showRevision)} + ); } @@ -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; diff --git a/frontend/src/InteractiveSearch/InteractiveSearchRow.css b/frontend/src/InteractiveSearch/InteractiveSearchRow.css index c1079c792..ffea82600 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearchRow.css +++ b/frontend/src/InteractiveSearch/InteractiveSearchRow.css @@ -22,6 +22,10 @@ text-align: center; } +.quality { + white-space: nowrap; +} + .customFormatScore { composes: cell from '~Components/Table/Cells/TableRowCell.css'; diff --git a/frontend/src/InteractiveSearch/InteractiveSearchRow.js b/frontend/src/InteractiveSearch/InteractiveSearchRow.js index ce32f12bd..3029d2d2f 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearchRow.js +++ b/frontend/src/InteractiveSearch/InteractiveSearchRow.js @@ -178,7 +178,7 @@ class InteractiveSearchRow extends Component { - +