Skip to content

Commit

Permalink
Small Reduction of compelxity in TracksResults
Browse files Browse the repository at this point in the history
  • Loading branch information
trekiteasy committed Jan 30, 2019
1 parent 9c3a803 commit c5bba5f
Showing 1 changed file with 18 additions and 33 deletions.
51 changes: 18 additions & 33 deletions app/components/SearchResults/TracksResults/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import _ from 'lodash';

import TrackRow from '../../TrackRow';

Expand All @@ -17,44 +18,28 @@ class TracksResults extends React.Component {
<table>
<tbody>
{(collection || []).slice(0, limit).map((track, index) => {

if (track) {
if (track.name && track.image && track.artist) {
if (!track.artist.name) {
track.artist = { name: track.artist };
}

return < TrackRow
key={'search-result-track-row-' + index}
track={track}
index={'popular-track-' + index}
clearQueue={this.props.clearQueue}
addToQueue={this.props.addToQueue}
startPlayback={this.props.startPlayback}
selectSong={this.props.selectSong}
musicSources={this.props.musicSources}
displayArtist={true}
displayDuration={false}
displayPlayCount={false}
displayCover={true}
/>;
if (track && _.hasIn(track, 'name') & _.hasIn(track, 'image') && _.hasIn(track, 'artist')) {
if (!track.artist.name) {
track.artist = { name: track.artist };
}

return < TrackRow
key={'search-result-track-row-' + index}
track={track}
index={'popular-track-' + index}
clearQueue={this.props.clearQueue}
addToQueue={this.props.addToQueue}
startPlayback={this.props.startPlayback}
selectSong={this.props.selectSong}
musicSources={this.props.musicSources}
displayArtist={true}
displayDuration={false}
displayPlayCount={false}
displayCover={true}
/>;
}
})}
</tbody>
</table>
/* <div className={styles.popular_tracks_container}>
{(collection || []).slice(0, limit).map((track, i) => {
if (track) {
if (track.name && track.image && track.artist) {
{
return this.renderTrack(track, i);
}
}
}
})}
</div>*/
);
}
}
Expand Down

0 comments on commit c5bba5f

Please sign in to comment.