Add badge for duplicates count

This commit is contained in:
Gabriel Augendre 2016-05-07 19:18:07 +02:00
parent b930036a45
commit 45046b77e3
No known key found for this signature in database
GPG key ID: D2B6A5B41FC438B1
2 changed files with 8 additions and 4 deletions

View file

@ -73,8 +73,12 @@ var DuplicateFinderBox = React.createClass({
}
var playlistBox = <p>Loading...</p>;
var dupsCount = this.state.dups && this.state.dups.length;
if (!this.props.playlistsLoading) {
playlistBox = <PlaylistBox handleClick={this.handlePlaylistClick} dupsLoading={this.state.dupsLoading} playlists={this.props.playlists}/>;
playlistBox = <PlaylistBox handleClick={this.handlePlaylistClick}
dupsCount={dupsCount}
dupsLoading={this.state.dupsLoading}
playlists={this.props.playlists}/>;
}
return (

View file

@ -30,14 +30,14 @@ var PlaylistBox = React.createClass({
playlists = this.props.playlists.map(function (pl) {
var id = pl.id;
var active = currentId == id;
var classes = this.props.dupsLoading ? "disabled" : "";
var dupsCount = active ? !this.props.dupsLoading && this.props.dupsCount : "";
return (
<ListGroupItem href="#"
onClick={this.clickOnItem.bind(this, id, pl.owner.id, pl.name)}
className={classes}
disabled={this.props.dupsLoading}
active={active}
key={id}>
{pl.name}
{pl.name} <span className="badge">{dupsCount}</span>
</ListGroupItem>
);
}, this);