From 520eae6d93a19e7c177a47081f1e0b5961890cab Mon Sep 17 00:00:00 2001 From: nukeop Date: Fri, 5 Apr 2019 00:57:31 +0200 Subject: [PATCH] Fix thumbnails on track rows --- app/components/PlaylistView/styles.scss | 22 ---------------- app/components/TrackRow/index.js | 34 ++++++++++++++++--------- app/components/TrackRow/styles.scss | 15 ++++++++--- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/app/components/PlaylistView/styles.scss b/app/components/PlaylistView/styles.scss index e6d6d2e8d8..a7b5763d46 100644 --- a/app/components/PlaylistView/styles.scss +++ b/app/components/PlaylistView/styles.scss @@ -79,26 +79,4 @@ border-top: 1px solid rgba($lightbg, 0.4); } } - - .track_thumbnail { - width: 3rem; - height: 3rem; - } - - .track_info { - display: flex; - flex-flow: row; - justify-content: space-around; - align-items: center; - margin: 0.75rem; - } - - .track_artist { - color: rgba($grey, 0.5); - margin: 0 1rem; - } - - .track_name { - - } } diff --git a/app/components/TrackRow/index.js b/app/components/TrackRow/index.js index 26c90c4cc3..fbd6ef2b00 100644 --- a/app/components/TrackRow/index.js +++ b/app/components/TrackRow/index.js @@ -10,6 +10,18 @@ import { formatDuration } from '../../utils'; import styles from './styles.scss'; class TrackRow extends React.Component { + getThumbnail(track) { + return _.get( + track, + 'image[1][\'#text\']', + _.get( + track, + 'image[0][\'#text\']', + artPlaceholder + ) + ); + } + renderAddTrackToQueueButton (index, track, addToQueue, musicSources) { return ( , + , settings ); }} @@ -79,7 +91,7 @@ class TrackRow extends React.Component { addToQueue(musicSources, { artist: track.artist.name, name: track.name, - thumbnail: _.get(track, 'image[0][\'#text\']', artPlaceholder) + thumbnail: this.getThumbnail(track) }); selectSong(0); startPlayback(); @@ -99,14 +111,12 @@ class TrackRow extends React.Component { renderTrigger (track) { return ( - {this.props.displayCover && - } + { + this.props.displayCover && + + + + } {this.props.displayTrackNumber && {track.position}} {this.props.displayArtist && {track.artist.name}} {track.name} @@ -151,7 +161,7 @@ class TrackRow extends React.Component { trigger={this.renderTrigger(track)} artist={track.artist.name} title={track.name} - thumb={_.get(track, 'image[1][\'#text\']', _.get(track, 'image[0][\'#text\']', artPlaceholder))} + thumb={ this.getThumbnail(track) } > {popupContents} diff --git a/app/components/TrackRow/styles.scss b/app/components/TrackRow/styles.scss index 7bbba3b734..806511ede9 100644 --- a/app/components/TrackRow/styles.scss +++ b/app/components/TrackRow/styles.scss @@ -87,9 +87,18 @@ } .track_thumbnail { - width: 3rem; - height: 3rem; - background-repeat: no-repeat + position: relative; + box-sizing: content-box; + height: 3em; + width: 3em; + padding: 0 !important; + + img { + position: absolute; + top: 0; + bottom: 0; + height: 100%; + } } table {